From ba5548bdef8947c9ace7a2f0c06e6446ed1f584f Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 10:28:08 -0600 Subject: [PATCH 1/9] Enhance OpusCompile workflow with symbol sanitization Added symbol sanitization step to avoid Unity conflicts and create a universal libopus.a. --- .github/workflows/OpusCompile.yml | 94 ++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 2482add..9168e85 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -279,7 +279,9 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \ -DCMAKE_OSX_SYSROOT=${{ env.SDK }} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DOPUS_BUILD_PROGRAMS=OFF + -DOPUS_BUILD_PROGRAMS=OFF \ + -DEC_PREFIX=opus_ec_ \ + -DEC_PREFIX_OVERRIDE=1 - name: Build working-directory: ./build @@ -292,12 +294,102 @@ jobs: find . -name "*.a" -exec file {} \; find . -name "*.a" -exec lipo -info {} \; + - name: Sanitize symbols to avoid Unity symbol conflicts (simplified) + working-directory: ./build + run: | + echo "Installing llvm (provides llvm-objcopy)..." + brew install llvm + # Ensure llvm tools are on PATH for the remainder of this step + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + + set -euo pipefail + + echo "Collecting global defined symbols from libopus.a..." + # Select only defined symbols (T,D,B,S) from the archive and deduplicate + nm -g libopus.a | awk '/ [TDBS] /{print $3}' | sort -u > allsyms.txt + + echo "Creating symbol mapping for renaming (skipping public 'opus' symbols)..." + : > mapping.txt + grep -v -E '^_opus' allsyms.txt | while read -r sym; do + [ -z "$sym" ] && continue + echo "$sym ${sym}_libopus" >> mapping.txt + done + + if [ -s mapping.txt ]; then + echo "Attempting archive-level objcopy rename (single step)..." + + # Try operating on the archive directly (faster). If the tool doesn't support archives, + # fall back to extracting members and operating per-object (older llvm/objcopy may be limited). + if llvm-objcopy --redefine-syms=mapping.txt libopus.a; then + echo "Archive-level rename succeeded. Verifying..." + nm -g libopus.a | grep compute_allocation || true + else + echo "Archive-level rename failed; falling back to per-object processing..." + echo "Extracting libopus.a..." + ar -x libopus.a + echo "Applying symbol renames to object files..." + for f in *.o; do + llvm-objcopy --redefine-syms=mapping.txt "$f" || true + done + echo "Repacking sanitized lib into libopus_sanitized.a" + ar rcs libopus_sanitized.a *.o + echo "Verification: search for compute_allocation in sanitized archive (should be renamed or absent)" + nm -g libopus_sanitized.a | grep compute_allocation || true + mv libopus_sanitized.a libopus.a + fi + else + echo "No non-opus symbols found to rename. Skipping sanitization." + fi + - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: ${{ env.OUTPUT_NAME }}-libopus.a path: ./build/libopus.a + iOS-universal: + runs-on: macos-latest + needs: iOS + steps: + - name: Download device artifact + uses: actions/download-artifact@v4 + with: + name: ios-device-arm64-libopus.a + path: device + + - name: Download simulator-arm64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-arm64-libopus.a + path: sim_arm64 + + - name: Download simulator-x86_64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-x86_64-libopus.a + path: sim_x86 + + - name: Create universal libopus.a + run: | + set -euo pipefail + echo "Finding slices..." + find device sim_arm64 sim_x86 -name "libopus.a" -print + slices=$(find device sim_arm64 sim_x86 -name "libopus.a" -print | tr '\n' ' ') + if [ -z "$slices" ]; then + echo "No slices found! Listing directories:" && ls -la device sim_arm64 sim_x86 || true + exit 1 + fi + mkdir -p universal + echo "Creating universal binary from: $slices" + lipo -create $slices -output universal/libopus_universal.a + lipo -info universal/libopus_universal.a + + - name: Upload Universal Artifact + uses: actions/upload-artifact@v4 + with: + name: ios-universal-libopus.a + path: universal/libopus_universal.a + Wasm: runs-on: ubuntu-latest steps: From 1ac1d9ebb5e1b92d3d47e6a137d8596a3e5a6b83 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 10:50:06 -0600 Subject: [PATCH 2/9] Fix build error --- .github/workflows/OpusCompile.yml | 36 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 9168e85..44c3ec7 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -272,6 +272,7 @@ jobs: working-directory: ./build run: | cmake ../opus \ + -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_SYSTEM_NAME=iOS \ @@ -279,9 +280,7 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \ -DCMAKE_OSX_SYSROOT=${{ env.SDK }} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DOPUS_BUILD_PROGRAMS=OFF \ - -DEC_PREFIX=opus_ec_ \ - -DEC_PREFIX_OVERRIDE=1 + -DOPUS_BUILD_PROGRAMS=OFF - name: Build working-directory: ./build @@ -294,7 +293,7 @@ jobs: find . -name "*.a" -exec file {} \; find . -name "*.a" -exec lipo -info {} \; - - name: Sanitize symbols to avoid Unity symbol conflicts (simplified) + - name: Sanitize symbols to avoid Unity symbol conflicts working-directory: ./build run: | echo "Installing llvm (provides llvm-objcopy)..." @@ -351,6 +350,8 @@ jobs: runs-on: macos-latest needs: iOS steps: + - uses: actions/checkout@v4 + - name: Download device artifact uses: actions/download-artifact@v4 with: @@ -369,26 +370,35 @@ jobs: name: ios-simulator-x86_64-libopus.a path: sim_x86 - - name: Create universal libopus.a + - name: Create XCFramework (use available slices) run: | set -euo pipefail echo "Finding slices..." - find device sim_arm64 sim_x86 -name "libopus.a" -print - slices=$(find device sim_arm64 sim_x86 -name "libopus.a" -print | tr '\n' ' ') - if [ -z "$slices" ]; then + readarray -t slices < <(find device sim_arm64 sim_x86 -name "libopus.a") + if [ ${#slices[@]} -eq 0 ]; then echo "No slices found! Listing directories:" && ls -la device sim_arm64 sim_x86 || true exit 1 fi + mkdir -p universal - echo "Creating universal binary from: $slices" - lipo -create $slices -output universal/libopus_universal.a - lipo -info universal/libopus_universal.a + echo "Found slices:" && printf '%s' "${slices[@]}" + + # Build xcodebuild args for all available slices (headers come from checked out repo) + xc_args=() + for s in "${slices[@]}"; do + xc_args+=( -library "$s" -headers "opus/include" ) + done + + echo "Creating XCFramework with xcodebuild..." + if xcodebuild -create-xcframework "${xc_args[@]}" -output universal/libopus.xcframework; then + echo "XCFramework created successfully." + ls -la universal || true - name: Upload Universal Artifact uses: actions/upload-artifact@v4 with: - name: ios-universal-libopus.a - path: universal/libopus_universal.a + name: ios-universal-libopus + path: universal/* Wasm: runs-on: ubuntu-latest From 7a1feb2b1361efe8255e95f4e0497e45b913e55c Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 11:00:05 -0600 Subject: [PATCH 3/9] Update OpusCompile.yml with EC prefix and loggingfix Added EC prefix configuration and improved logging. --- .github/workflows/OpusCompile.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 44c3ec7..3dbb853 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -272,7 +272,6 @@ jobs: working-directory: ./build run: | cmake ../opus \ - -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_SYSTEM_NAME=iOS \ @@ -280,7 +279,9 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \ -DCMAKE_OSX_SYSROOT=${{ env.SDK }} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DOPUS_BUILD_PROGRAMS=OFF + -DOPUS_BUILD_PROGRAMS=OFF \ + -DEC_PREFIX=opus_ec_ \ + -DEC_PREFIX_OVERRIDE=1 - name: Build working-directory: ./build @@ -293,7 +294,7 @@ jobs: find . -name "*.a" -exec file {} \; find . -name "*.a" -exec lipo -info {} \; - - name: Sanitize symbols to avoid Unity symbol conflicts + - name: Sanitize symbols to avoid Unity symbol conflicts (simplified) working-directory: ./build run: | echo "Installing llvm (provides llvm-objcopy)..." @@ -381,7 +382,8 @@ jobs: fi mkdir -p universal - echo "Found slices:" && printf '%s' "${slices[@]}" + echo "Found slices:" && printf '%s +' "${slices[@]}" # Build xcodebuild args for all available slices (headers come from checked out repo) xc_args=() @@ -393,6 +395,25 @@ jobs: if xcodebuild -create-xcframework "${xc_args[@]}" -output universal/libopus.xcframework; then echo "XCFramework created successfully." ls -la universal || true + else + echo "xcodebuild failed; attempting lipo fallback when possible..." + if [ ${#slices[@]} -eq 1 ]; then + cp "${slices[0]}" universal/libopus_universal.a + echo "Copied single slice to universal/libopus_universal.a" + lipo -info universal/libopus_universal.a || true + else + echo "Attempting lipo -create on available slices..." + if lipo -create "${slices[@]}" -output universal/libopus_universal.a; then + lipo -info universal/libopus_universal.a + else + echo "lipo failed; printing archs for inspection:" + for s in "${slices[@]}"; do + echo "$s -> $(lipo -info "$s")" + done + exit 1 + fi + fi + fi - name: Upload Universal Artifact uses: actions/upload-artifact@v4 From 6cd7dc08b0c4d974695d5402fc998d165f75fbed Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 11:02:07 -0600 Subject: [PATCH 4/9] Fix echo command syntax in OpusCompile.yml --- .github/workflows/OpusCompile.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 3dbb853..9facb78 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -382,8 +382,7 @@ jobs: fi mkdir -p universal - echo "Found slices:" && printf '%s -' "${slices[@]}" + echo "Found slices:" && printf '%s' "${slices[@]}" # Build xcodebuild args for all available slices (headers come from checked out repo) xc_args=() From 89efb786ef8f3169e9e2e7fcb7e882c5d4db2af0 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 11:10:56 -0600 Subject: [PATCH 5/9] Refactor slice collection and output in OpusCompile.yml Updated the script to collect slices into an array using a while loop for compatibility with bash 3.x. Changed the output format for found slices. --- .github/workflows/OpusCompile.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 9facb78..63adc1c 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -375,14 +375,20 @@ jobs: run: | set -euo pipefail echo "Finding slices..." - readarray -t slices < <(find device sim_arm64 sim_x86 -name "libopus.a") + + # Collect slices into array (bash 3.x compatible - no readarray) + slices=() + while IFS= read -r file; do + [ -n "$file" ] && slices+=("$file") + done <<< "$(find device sim_arm64 sim_x86 -name "libopus.a" 2>/dev/null)" + if [ ${#slices[@]} -eq 0 ]; then echo "No slices found! Listing directories:" && ls -la device sim_arm64 sim_x86 || true exit 1 fi mkdir -p universal - echo "Found slices:" && printf '%s' "${slices[@]}" + echo "Found slices: ${slices[*]}" # Build xcodebuild args for all available slices (headers come from checked out repo) xc_args=() @@ -405,7 +411,7 @@ jobs: if lipo -create "${slices[@]}" -output universal/libopus_universal.a; then lipo -info universal/libopus_universal.a else - echo "lipo failed; printing archs for inspection:" + echo "lipo failed; printing archs for inspection:" for s in "${slices[@]}"; do echo "$s -> $(lipo -info "$s")" done From 3c972045d9b13ebd8fc68accf3a7a777cca8c1b6 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Thu, 1 Jan 2026 11:16:19 -0600 Subject: [PATCH 6/9] Enhance OpusCompile workflow with cloning and XCFramework creation Added steps to clone the opus repository and create an XCFramework from the downloaded artifacts. --- .github/workflows/OpusCompile.yml | 72 ++++++++++++------------------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 63adc1c..d48d42f 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -353,6 +353,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Clone opus for headers + run: git clone --depth 1 https://github.com/xiph/opus.git + - name: Download device artifact uses: actions/download-artifact@v4 with: @@ -371,54 +374,35 @@ jobs: name: ios-simulator-x86_64-libopus.a path: sim_x86 - - name: Create XCFramework (use available slices) + - name: Create XCFramework run: | set -euo pipefail - echo "Finding slices..." - - # Collect slices into array (bash 3.x compatible - no readarray) - slices=() - while IFS= read -r file; do - [ -n "$file" ] && slices+=("$file") - done <<< "$(find device sim_arm64 sim_x86 -name "libopus.a" 2>/dev/null)" - - if [ ${#slices[@]} -eq 0 ]; then - echo "No slices found! Listing directories:" && ls -la device sim_arm64 sim_x86 || true - exit 1 - fi - mkdir -p universal - echo "Found slices: ${slices[*]}" - # Build xcodebuild args for all available slices (headers come from checked out repo) - xc_args=() - for s in "${slices[@]}"; do - xc_args+=( -library "$s" -headers "opus/include" ) - done - - echo "Creating XCFramework with xcodebuild..." - if xcodebuild -create-xcframework "${xc_args[@]}" -output universal/libopus.xcframework; then - echo "XCFramework created successfully." - ls -la universal || true - else - echo "xcodebuild failed; attempting lipo fallback when possible..." - if [ ${#slices[@]} -eq 1 ]; then - cp "${slices[0]}" universal/libopus_universal.a - echo "Copied single slice to universal/libopus_universal.a" - lipo -info universal/libopus_universal.a || true - else - echo "Attempting lipo -create on available slices..." - if lipo -create "${slices[@]}" -output universal/libopus_universal.a; then - lipo -info universal/libopus_universal.a - else - echo "lipo failed; printing archs for inspection:" - for s in "${slices[@]}"; do - echo "$s -> $(lipo -info "$s")" - done - exit 1 - fi - fi - fi + echo "=== Checking downloaded artifacts ===" + ls -la device/ sim_arm64/ sim_x86/ || true + + echo "=== Architecture info ===" + lipo -info device/libopus.a || true + lipo -info sim_arm64/libopus.a || true + lipo -info sim_x86/libopus.a || true + + # Combine simulator slices (arm64 + x86_64) into a fat library + echo "=== Creating fat simulator library ===" + mkdir -p simulator + lipo -create sim_arm64/libopus.a sim_x86/libopus.a -output simulator/libopus.a + echo "Fat simulator library:" + lipo -info simulator/libopus.a + + # Create XCFramework with device (arm64) and simulator (arm64+x86_64) + echo "=== Creating XCFramework ===" + xcodebuild -create-xcframework \ + -library device/libopus.a -headers opus/include \ + -library simulator/libopus.a -headers opus/include \ + -output universal/libopus.xcframework + + echo "=== XCFramework created ===" + ls -laR universal/ - name: Upload Universal Artifact uses: actions/upload-artifact@v4 From 9a9352e3f809022478bbba892f75f0e23377bd55 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Fri, 2 Jan 2026 11:32:56 -0600 Subject: [PATCH 7/9] Refactor symbol sanitization process in workflow --- .github/workflows/OpusCompile.yml | 32 +++++++------------------------ 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index d48d42f..4743d26 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -279,9 +279,7 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \ -DCMAKE_OSX_SYSROOT=${{ env.SDK }} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DOPUS_BUILD_PROGRAMS=OFF \ - -DEC_PREFIX=opus_ec_ \ - -DEC_PREFIX_OVERRIDE=1 + -DOPUS_BUILD_PROGRAMS=OFF - name: Build working-directory: ./build @@ -294,7 +292,7 @@ jobs: find . -name "*.a" -exec file {} \; find . -name "*.a" -exec lipo -info {} \; - - name: Sanitize symbols to avoid Unity symbol conflicts (simplified) + - name: Sanitize symbols to avoid Unity symbol conflicts working-directory: ./build run: | echo "Installing llvm (provides llvm-objcopy)..." @@ -316,31 +314,15 @@ jobs: done if [ -s mapping.txt ]; then - echo "Attempting archive-level objcopy rename (single step)..." - - # Try operating on the archive directly (faster). If the tool doesn't support archives, - # fall back to extracting members and operating per-object (older llvm/objcopy may be limited). - if llvm-objcopy --redefine-syms=mapping.txt libopus.a; then - echo "Archive-level rename succeeded. Verifying..." - nm -g libopus.a | grep compute_allocation || true - else - echo "Archive-level rename failed; falling back to per-object processing..." - echo "Extracting libopus.a..." - ar -x libopus.a - echo "Applying symbol renames to object files..." - for f in *.o; do - llvm-objcopy --redefine-syms=mapping.txt "$f" || true - done - echo "Repacking sanitized lib into libopus_sanitized.a" - ar rcs libopus_sanitized.a *.o - echo "Verification: search for compute_allocation in sanitized archive (should be renamed or absent)" - nm -g libopus_sanitized.a | grep compute_allocation || true - mv libopus_sanitized.a libopus.a - fi + echo "Applying symbol renames..." + llvm-objcopy --redefine-syms=mapping.txt libopus.a + echo "Verification:" + nm -g libopus.a | grep compute_allocation || true else echo "No non-opus symbols found to rename. Skipping sanitization." fi + - name: Upload Artifact uses: actions/upload-artifact@v4 with: From 4a9a97a9bdb8e3601ebf1b414b37a1c7d74ac8b2 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Fri, 2 Jan 2026 11:43:34 -0600 Subject: [PATCH 8/9] Add Apple-universal job to OpusCompile workflow --- .github/workflows/OpusCompile.yml | 148 +++++++++++++++++------------- 1 file changed, 85 insertions(+), 63 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 4743d26..9a47c51 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -328,69 +328,91 @@ jobs: with: name: ${{ env.OUTPUT_NAME }}-libopus.a path: ./build/libopus.a - - iOS-universal: - runs-on: macos-latest - needs: iOS - steps: - - uses: actions/checkout@v4 - - - name: Clone opus for headers - run: git clone --depth 1 https://github.com/xiph/opus.git - - - name: Download device artifact - uses: actions/download-artifact@v4 - with: - name: ios-device-arm64-libopus.a - path: device - - - name: Download simulator-arm64 artifact - uses: actions/download-artifact@v4 - with: - name: ios-simulator-arm64-libopus.a - path: sim_arm64 - - - name: Download simulator-x86_64 artifact - uses: actions/download-artifact@v4 - with: - name: ios-simulator-x86_64-libopus.a - path: sim_x86 - - - name: Create XCFramework - run: | - set -euo pipefail - mkdir -p universal - - echo "=== Checking downloaded artifacts ===" - ls -la device/ sim_arm64/ sim_x86/ || true - - echo "=== Architecture info ===" - lipo -info device/libopus.a || true - lipo -info sim_arm64/libopus.a || true - lipo -info sim_x86/libopus.a || true - - # Combine simulator slices (arm64 + x86_64) into a fat library - echo "=== Creating fat simulator library ===" - mkdir -p simulator - lipo -create sim_arm64/libopus.a sim_x86/libopus.a -output simulator/libopus.a - echo "Fat simulator library:" - lipo -info simulator/libopus.a - - # Create XCFramework with device (arm64) and simulator (arm64+x86_64) - echo "=== Creating XCFramework ===" - xcodebuild -create-xcframework \ - -library device/libopus.a -headers opus/include \ - -library simulator/libopus.a -headers opus/include \ - -output universal/libopus.xcframework - - echo "=== XCFramework created ===" - ls -laR universal/ - - - name: Upload Universal Artifact - uses: actions/upload-artifact@v4 - with: - name: ios-universal-libopus - path: universal/* + + Apple-universal: + runs-on: macos-latest + needs: [iOS, MacOS] + steps: + - uses: actions/checkout@v4 + + - name: Clone opus for headers + run: git clone --depth 1 https://github.com/xiph/opus.git + + - name: Download device artifact + uses: actions/download-artifact@v4 + with: + name: ios-device-arm64-libopus.a + path: device + + - name: Download simulator-arm64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-arm64-libopus.a + path: sim_arm64 + + - name: Download simulator-x86_64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-x86_64-libopus.a + path: sim_x86 + + - name: Download macOS-arm64 artifact + uses: actions/download-artifact@v4 + with: + name: macos-arm64-opus.dylib + path: macos_arm64 + + - name: Download macOS-x64 artifact + uses: actions/download-artifact@v4 + with: + name: macos-x64-opus.dylib + path: macos_x64 + + - name: Create XCFramework + run: | + set -euo pipefail + mkdir -p universal + + echo "=== Checking downloaded artifacts ===" + ls -la device/ sim_arm64/ sim_x86/ macos_arm64/ macos_x64/ || true + + echo "=== Architecture info ===" + lipo -info device/libopus.a || true + lipo -info sim_arm64/libopus.a || true + lipo -info sim_x86/libopus.a || true + file macos_arm64/opus.dylib || true + file macos_x64/opus.dylib || true + + # Combine simulator slices (arm64 + x86_64) into a fat library + echo "=== Creating fat simulator library ===" + mkdir -p simulator + lipo -create sim_arm64/libopus.a sim_x86/libopus.a -output simulator/libopus.a + echo "Fat simulator library:" + lipo -info simulator/libopus.a + + # Combine macOS slices (arm64 + x86_64) into a fat library + echo "=== Creating fat macOS library ===" + mkdir -p macos + lipo -create macos_arm64/opus.dylib macos_x64/opus.dylib -output macos/libopus.dylib + echo "Fat macOS library:" + lipo -info macos/libopus.dylib + + # Create XCFramework with device, simulator, and macOS + echo "=== Creating XCFramework ===" + xcodebuild -create-xcframework \ + -library device/libopus.a -headers opus/include \ + -library simulator/libopus.a -headers opus/include \ + -library macos/libopus.dylib -headers opus/include \ + -output universal/libopus.xcframework + + echo "=== XCFramework created ===" + ls -laR universal/ + + - name: Upload Universal Artifact + uses: actions/upload-artifact@v4 + with: + name: apple-universal-libopus + path: universal/* Wasm: runs-on: ubuntu-latest From 1086a8595c7ed9104cbf884310459a706d13ca97 Mon Sep 17 00:00:00 2001 From: Katherine Ruud Date: Fri, 2 Jan 2026 11:50:31 -0600 Subject: [PATCH 9/9] Add iOS-universal workflow for XCFramework creation --- .github/workflows/OpusCompile.yml | 148 +++++++++++++----------------- 1 file changed, 63 insertions(+), 85 deletions(-) diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index 9a47c51..4743d26 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -328,91 +328,69 @@ jobs: with: name: ${{ env.OUTPUT_NAME }}-libopus.a path: ./build/libopus.a - - Apple-universal: - runs-on: macos-latest - needs: [iOS, MacOS] - steps: - - uses: actions/checkout@v4 - - - name: Clone opus for headers - run: git clone --depth 1 https://github.com/xiph/opus.git - - - name: Download device artifact - uses: actions/download-artifact@v4 - with: - name: ios-device-arm64-libopus.a - path: device - - - name: Download simulator-arm64 artifact - uses: actions/download-artifact@v4 - with: - name: ios-simulator-arm64-libopus.a - path: sim_arm64 - - - name: Download simulator-x86_64 artifact - uses: actions/download-artifact@v4 - with: - name: ios-simulator-x86_64-libopus.a - path: sim_x86 - - - name: Download macOS-arm64 artifact - uses: actions/download-artifact@v4 - with: - name: macos-arm64-opus.dylib - path: macos_arm64 - - - name: Download macOS-x64 artifact - uses: actions/download-artifact@v4 - with: - name: macos-x64-opus.dylib - path: macos_x64 - - - name: Create XCFramework - run: | - set -euo pipefail - mkdir -p universal - - echo "=== Checking downloaded artifacts ===" - ls -la device/ sim_arm64/ sim_x86/ macos_arm64/ macos_x64/ || true - - echo "=== Architecture info ===" - lipo -info device/libopus.a || true - lipo -info sim_arm64/libopus.a || true - lipo -info sim_x86/libopus.a || true - file macos_arm64/opus.dylib || true - file macos_x64/opus.dylib || true - - # Combine simulator slices (arm64 + x86_64) into a fat library - echo "=== Creating fat simulator library ===" - mkdir -p simulator - lipo -create sim_arm64/libopus.a sim_x86/libopus.a -output simulator/libopus.a - echo "Fat simulator library:" - lipo -info simulator/libopus.a - - # Combine macOS slices (arm64 + x86_64) into a fat library - echo "=== Creating fat macOS library ===" - mkdir -p macos - lipo -create macos_arm64/opus.dylib macos_x64/opus.dylib -output macos/libopus.dylib - echo "Fat macOS library:" - lipo -info macos/libopus.dylib - - # Create XCFramework with device, simulator, and macOS - echo "=== Creating XCFramework ===" - xcodebuild -create-xcframework \ - -library device/libopus.a -headers opus/include \ - -library simulator/libopus.a -headers opus/include \ - -library macos/libopus.dylib -headers opus/include \ - -output universal/libopus.xcframework - - echo "=== XCFramework created ===" - ls -laR universal/ - - - name: Upload Universal Artifact - uses: actions/upload-artifact@v4 - with: - name: apple-universal-libopus - path: universal/* + + iOS-universal: + runs-on: macos-latest + needs: iOS + steps: + - uses: actions/checkout@v4 + + - name: Clone opus for headers + run: git clone --depth 1 https://github.com/xiph/opus.git + + - name: Download device artifact + uses: actions/download-artifact@v4 + with: + name: ios-device-arm64-libopus.a + path: device + + - name: Download simulator-arm64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-arm64-libopus.a + path: sim_arm64 + + - name: Download simulator-x86_64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-simulator-x86_64-libopus.a + path: sim_x86 + + - name: Create XCFramework + run: | + set -euo pipefail + mkdir -p universal + + echo "=== Checking downloaded artifacts ===" + ls -la device/ sim_arm64/ sim_x86/ || true + + echo "=== Architecture info ===" + lipo -info device/libopus.a || true + lipo -info sim_arm64/libopus.a || true + lipo -info sim_x86/libopus.a || true + + # Combine simulator slices (arm64 + x86_64) into a fat library + echo "=== Creating fat simulator library ===" + mkdir -p simulator + lipo -create sim_arm64/libopus.a sim_x86/libopus.a -output simulator/libopus.a + echo "Fat simulator library:" + lipo -info simulator/libopus.a + + # Create XCFramework with device (arm64) and simulator (arm64+x86_64) + echo "=== Creating XCFramework ===" + xcodebuild -create-xcframework \ + -library device/libopus.a -headers opus/include \ + -library simulator/libopus.a -headers opus/include \ + -output universal/libopus.xcframework + + echo "=== XCFramework created ===" + ls -laR universal/ + + - name: Upload Universal Artifact + uses: actions/upload-artifact@v4 + with: + name: ios-universal-libopus + path: universal/* Wasm: runs-on: ubuntu-latest