forked from arthenica/ffmpeg-kit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·94 lines (78 loc) · 2.97 KB
/
build.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
set -e
./ios.sh -s -x \
--target=17.0 \
--disable-armv7 \
--disable-armv7s \
--disable-arm64-mac-catalyst \
--disable-arm64e \
--disable-i386 \
--disable-x86-64-mac-catalyst \
--enable-opus \
--enable-libvpx \
--enable-ios-audiotoolbox \
--enable-ios-videotoolbox \
--enable-ios-avfoundation \
--enable-ios-zlib \
--enable-ios-bzip2 \
--enable-ios-libiconv \
--no-bitcode
FRAMEWORK_NAMES=(ffmpegkit libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale)
XROS_SIM_PLATFORM=xrossim
XROS_PLATFORM=xros
XROS_MINOS=1.0
XROS_SDK=1.0
PATCHED_FRAMEWORKS=prebuilt/patched-frameworks
PATCHED_XCFRAMEWORKS=prebuilt/patched-xcframeworks
rm -rf ${PATCHED_FRAMEWORKS} ${PATCHED_XCFRAMEWORKS}
mkdir -p ${PATCHED_FRAMEWORKS}
for FRAMEWORK in "${FRAMEWORK_NAMES[@]}"; do
echo Processing $FRAMEWORK.framework
IOS_ORIGINAL_FRAMEWORK="prebuilt/bundle-apple-xcframework-ios/${FRAMEWORK}.xcframework/ios-arm64/${FRAMEWORK}.framework"
OUTPUT_FRAMEWORK=${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros/${FRAMEWORK}.framework
rm -rf ${PATCHED_FRAMEWORKS}/${FRAMEWORK}
# VisionOS
OUTPUT_FRAMEWORK=${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros/${FRAMEWORK}.framework
mkdir -p ${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros
cp -r ${IOS_ORIGINAL_FRAMEWORK} ${OUTPUT_FRAMEWORK}
rm ${OUTPUT_FRAMEWORK}/${FRAMEWORK}
vtool \
-set-build-version ${XROS_PLATFORM} ${XROS_MINOS} ${XROS_SDK} \
-replace \
-output ${OUTPUT_FRAMEWORK}/${FRAMEWORK} \
${IOS_ORIGINAL_FRAMEWORK}/${FRAMEWORK}
# VisionOS Simulator
OUTPUT_FRAMEWORK=${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros-sim/${FRAMEWORK}.framework
mkdir -p ${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros-sim
cp -r ${IOS_ORIGINAL_FRAMEWORK} ${OUTPUT_FRAMEWORK}
rm ${OUTPUT_FRAMEWORK}/${FRAMEWORK}
vtool \
-set-build-version ${XROS_SIM_PLATFORM} ${XROS_MINOS} ${XROS_SDK} \
-replace \
-output ${OUTPUT_FRAMEWORK}/${FRAMEWORK} \
${IOS_ORIGINAL_FRAMEWORK}/${FRAMEWORK}
done
rm -rf prebuilt/patched-xcframeworks
mkdir -p prebuilt/patched-xcframeworks
LIST=()
for FRAMEWORK in "${FRAMEWORK_NAMES[@]}"; do
XCFRAMEWORK="prebuilt/bundle-apple-xcframework-ios/${FRAMEWORK}.xcframework"
xcodebuild -create-xcframework \
-framework ${XCFRAMEWORK}/ios-arm64/${FRAMEWORK}.framework \
-framework ${XCFRAMEWORK}/ios-arm64_x86_64-simulator/${FRAMEWORK}.framework \
-framework ${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros/${FRAMEWORK}.framework \
-framework ${PATCHED_FRAMEWORKS}/${FRAMEWORK}/xros-sim/${FRAMEWORK}.framework \
-output prebuilt/patched-xcframeworks/${FRAMEWORK}.xcframework
pushd prebuilt/patched-xcframeworks > /dev/null
rm -rf ${FRAMEWORK}.xcframework.zip
zip -q -r ${FRAMEWORK}.xcframework.zip ${FRAMEWORK}.xcframework
HASH=$(sha256sum ${FRAMEWORK}.xcframework.zip | awk '{print $1}')
LIST+=("\"${FRAMEWORK}\": \"${HASH}\",")
popd > /dev/null
done
rm -rf prebuilt/patched-xcframeworks/*.xcframework
echo "["
for ITEM in "${LIST[@]}"; do
echo " ${ITEM}"
done
echo "]"