-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-apple.sh
executable file
·61 lines (44 loc) · 1.31 KB
/
build-apple.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Exit if anything fails
set -e
# Setup
BUILD_DIR=platform-build
if [ ! -d $BUILD_DIR ]; then
mkdir $BUILD_DIR
fi
cd $BUILD_DIR
# Build static libs
for TARGET in aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
do
rustup target add $TARGET
# Apple's App Sandbox disallows SysV semaphores; use POSIX semaphores instead
cargo build -r --target=$TARGET # --features posix-sem
done
echo "Done with rustup"
# Create XCFramework zip
#
FRAMEWORK="HelloWorld.xcframework"
LIBNAME=libhello.a
# mkdir mac-lipo ios-sim-lipo
mkdir ios-sim-lipo
echo "Made lipo directories"
IOS_SIM_LIPO=ios-sim-lipo/$LIBNAME
# MAC_LIPO=mac-lipo/$LIBNAME
lipo -create -output $IOS_SIM_LIPO \
../target/aarch64-apple-ios-sim/release/$LIBNAME \
../target/x86_64-apple-ios/release/$LIBNAME
echo "Created $IOS_SIM_LIPO"
# lipo -create -output $MAC_LIPO \
# ../target/aarch64-apple-darwin/release/$LIBNAME \
# ../target/x86_64-apple-darwin/release/$LIBNAME
# echo "Created $MAC_LIPO"
# -library $MAC_LIPO \
xcodebuild -create-xcframework \
-library $IOS_SIM_LIPO \
-library ../target/aarch64-apple-ios/release/$LIBNAME \
-output $FRAMEWORK
zip -r $FRAMEWORK.zip $FRAMEWORK
# Cleanup
#
# rm -rf ios-sim-lipo mac-lipo $FRAMEWORK
rm -rf ios-sim-lipo $FRAMEWORK