From 992984dd9851ba8cce0fb2265416d97ffebfe357 Mon Sep 17 00:00:00 2001 From: BB9z Date: Sat, 6 Jul 2024 10:47:41 +0800 Subject: [PATCH] Test spm. --- .github/workflows/ci.yml | 5 ++--- Package.swift | 19 ++++--------------- make-package.command | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c8c8e5..6fd666d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,9 @@ jobs: runs-on: macos-14 steps: - uses: actions/checkout@v4 - - name: XCFramework Make + - name: Package XCFramework run: | - cd macosx - ./make-xcframework.sh + ./make-package.command env: # Seems unable build visionOS at the moment B9_BUILD_VISION_OS: false diff --git a/Package.swift b/Package.swift index 93ea449..7ce4433 100644 --- a/Package.swift +++ b/Package.swift @@ -14,25 +14,14 @@ let package = Package( .visionOS(.v1), ], products: [ - // Things get complicated when we change the libaray type from static to dynamic. - // A wrapper is required. https://stackoverflow.com/a/65255303 - .library(name: "LAME", type: .dynamic, targets: ["LAME-Target"]) + .library(name: "LAME", targets: ["LAME"]) ], dependencies: [], targets: [ - .target( - name: "LAME-Target", - dependencies: ["LAME-Prebuild"], - path: "SwiftPM" - ), -// .binaryTarget( -// name: "LAME-Prebuild", -// path: "macosx/LAME.xcframework" -// ), .binaryTarget( - name: "LAME-Prebuild", - url: "https://github.com/BB9z/LAME-xcframework/releases/download/3.100.1/LAME.xcframework.zip", - checksum: "cc45eb59d17ec4c38f75bb054d01faca3aaefeeaee544ca0c7a07e6820898c0f" + name: "LAME", + url: "https://github.com/BB9z/LAME-xcframework/releases/download/3.100.0/Next-LAME.xcframework.zip", + checksum: "88c82d17aea63648de5d5a8c3f8097ada4144dc46ac1325fd07e5c9afe5d9d02" ) ] ) diff --git a/make-package.command b/make-package.command index a18c0bd..8f42d0d 100755 --- a/make-package.command +++ b/make-package.command @@ -17,6 +17,26 @@ sh ./make-xcframework.sh cd "$ROOT_DIR" mv "$ROOT_DIR/macosx/LAME.xcframework" "$ROOT_DIR" + +readonly countDSYMs=$(find "$ROOT_DIR/LAME.xcframework" -name "*.dSYM" | wc -l) +readonly hasDSYMs=$((countDSYMs > 0)) +# echo "hasDSYMs: $hasDSYMs" + +if [ $hasDSYMs = 1 ]; then + echo "\nPackaging with dSYMs..." + zip -r -9 LAME.xcframework_with_dsyms.zip LAME.xcframework LICENSE LICENSE-LAME COPYING + + echo "\nRemove dSYMs for package again..." + find "$ROOT_DIR/LAME.xcframework" -name "dSYMs" -type d -exec rm -rfv {} + + + echo "Remove DebugSymbolsPath in Info.plist." + local itemCount=$(/usr/libexec/PlistBuddy -c "Print :AvailableLibraries" "./LAME.xcframework/Info.plist" | grep -c "Dict") + for ((i=0; i