-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-static-xcframework.sh
More file actions
executable file
·55 lines (44 loc) · 1.35 KB
/
create-static-xcframework.sh
File metadata and controls
executable file
·55 lines (44 loc) · 1.35 KB
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
#!/bin/sh
set -euo pipefail
if [ $# == 0 ]; then
echo "Usage: `basename $0` full|compact"
exit 1
fi
if [ ! -d build/bin ]; then
echo "Please run build-ldns.sh first!"
exit 1
fi
BUILD_TYPE=$1
FWNAME=ldns
FWROOT=build/frameworks
LIBNAME=ldns
ARGS=
if [ $BUILD_TYPE == "full" ]; then
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator" "XROS" "XRSimulator")
else
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "MacOSX")
fi
if [ -d $FWROOT ]; then
echo "Removing previous $FWNAME.xcframework and intermediate files"
rm -rf $FWROOT
fi
for SYS in ${ALL_SYSTEMS[@]}; do
echo "Creating universal static libraries for $SYS"
SYSDIR="$FWROOT/$SYS"
SYSDISTS=(build/bin/${SYS}*)
LIPO_LIBS=
mkdir -p $SYSDIR
for DIST in ${SYSDISTS[@]}; do
LIPO_LIBS+=" $DIST/lib/libldns.a"
ditto "$DIST/include" "$SYSDIR/include"
done
lipo ${LIPO_LIBS} -create -output $SYSDIR/libldns.a
ARGS+=" -library $SYSDIR/libldns.a -headers $SYSDIR/include/"
done
echo "Creating xcframework"
xcodebuild -create-xcframework $ARGS -output "$FWROOT/$FWNAME.xcframework"
echo "Packing …"
ditto -c -k --keepParent "$FWROOT/$FWNAME.xcframework" "$FWROOT/$FWNAME.xcframework.zip"
echo "Computing checksum …"
swift package compute-checksum $FWROOT/$FWNAME.xcframework.zip
echo "Done"