forked from swiftlang/swift-foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_local
executable file
·46 lines (41 loc) · 1.07 KB
/
create_local
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
set -e
ARCH=""
LIB_DIR=""
LIB_EXT=""
PLATFORM_DIR=""
CONFIGURATION="release"
if [[ $MACHTYPE == *linux* ]]; then
if [[ $MACHTYPE == *aarch64* ]]; then
ARCH="aarch64"
elif [[ $MACHTYPE == *x86_64* ]]; then
ARCH="x86_64"
else
echo "Unsupported platform '$MACHTYPE'"
exit 1
fi
LIB_DIR=".build/$ARCH-unknown-linux-gnu/$CONFIGURATION"
LIB_EXT=so
PLATFORM_DIR="linux-$ARCH"
elif [[ $MACHTYPE == *darwin* ]]; then
if [[ $MACHTYPE == *arm64* ]]; then
ARCH=arm64
else
echo "Unsupported platform '$MACHTYPE'"
fi
LIB_DIR=".build/$ARCH-apple-macosx/$CONFIGURATION"
LIB_EXT=dylib
PLATFORM_DIR="macos-$ARCH"
else
echo "Unsupported platform '$MACHTYPE'"
exit 1
fi
# rm -rf .build
swift build -c $CONFIGURATION
rm -rf $PLATFORM_DIR
mkdir -p $PLATFORM_DIR
for lib in FoundationPreview; do
./create_xcframework -library $LIB_DIR/lib$lib.$LIB_EXT -output $lib.xcframework
zip -r9 $lib.xcframework.zip $lib.xcframework
mv $lib.xcframework.zip $PLATFORM_DIR
rm -rf $lib.xcframework
done