Skip to content

Commit

Permalink
Test spm.
Browse files Browse the repository at this point in the history
  • Loading branch information
BB9z committed Jul 6, 2024
1 parent 19d110e commit 992984d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 4 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
]
)
20 changes: 20 additions & 0 deletions make-package.command
Original file line number Diff line number Diff line change
Expand Up @@ -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<itemCount; i++)); do
/usr/libexec/PlistBuddy -c "Delete :AvailableLibraries:$i:DebugSymbolsPath" "./LAME.xcframework/Info.plist"
done
fi

echo "\nPackaging..."
zip -r -9 LAME.xcframework.zip LAME.xcframework LICENSE LICENSE-LAME COPYING

checksum=$(swift package compute-checksum LAME.xcframework.zip)
Expand Down

0 comments on commit 992984d

Please sign in to comment.