forked from stps/mpv-ios-scripts
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathxcframework.sh
executable file
·37 lines (32 loc) · 1.63 KB
/
xcframework.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
#!/bin/sh -e
LIBRARIES="libuchardet libfribidi libfreetype libharfbuzz libass libmpv libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale libcrypto libssl"
PLATFORMS="ios tv"
ROOT="$(pwd)"
LIB="$ROOT/lib"
mkdir -p $LIB
for LIBRARY in $LIBRARIES; do
FRAMEWORKS=""
ENVIRONMENTS=""
for PLATFORM in $PLATFORMS; do
SCRATCH="$ROOT/scratch-$PLATFORM"
if [ -d "$SCRATCH/x86_64-development" ] && [ -d "$SCRATCH/arm64-development" ]; then
ENVIRONMENTS="$ENVIRONMENTS development"
mkdir -p $SCRATCH/development/$LIBRARY.framework
lipo -create $SCRATCH/x86_64-development/lib/$LIBRARY.a $SCRATCH/arm64-development/lib/$LIBRARY.a -o $SCRATCH/development/$LIBRARY.framework/$LIBRARY
fi
if [[ -d "$SCRATCH/arm64-distribution" ]]; then
ENVIRONMENTS="$ENVIRONMENTS distribution"
mkdir -p $SCRATCH/distribution/$LIBRARY.framework
cp $SCRATCH/arm64-distribution/lib/$LIBRARY.a $SCRATCH/distribution/$LIBRARY.framework/$LIBRARY
fi
for ENVIRONMENT in $ENVIRONMENTS; do
cp -a $ROOT/framework-meta/Info.plist $SCRATCH/$ENVIRONMENT/$LIBRARY.framework/Info.plist
sed -i "" "s/{NAME}/$LIBRARY/g" $SCRATCH/$ENVIRONMENT/$LIBRARY.framework/Info.plist
if [[ "$LIBRARY" = "libmpv" ]]; then
cp -a $ROOT/framework-meta/libmpv/. $SCRATCH/$ENVIRONMENT/$LIBRARY.framework/
fi
FRAMEWORKS="$FRAMEWORKS -framework $SCRATCH/$ENVIRONMENT/$LIBRARY.framework"
done
done
xcodebuild -create-xcframework $FRAMEWORKS -output $LIB/$LIBRARY.xcframework
done