-
Notifications
You must be signed in to change notification settings - Fork 3
/
tvos.sh
executable file
·147 lines (113 loc) · 2.82 KB
/
tvos.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/sh
set -e
set -o pipefail
source config.sh
config_for_tvos
CWD=$(pwd)
LOG="${CWD}/${BUILD_DIR}/${BUILD_EXT}/build.log"
FAT="${BUILD_DIR}/${BUILD_EXT}/lib"
DEPS=(
# aom
# zvbi
# freetype # Harfbuzz needs freetype.
# harfbuzz
# freetype # Build freetype again with harfbuzz support.
# fribidi
# libass
# openssl
ffmpeg
# mpv
)
ARCHS=(
# arm64
x86_64
# arm64-simulator
)
LIPO=y
XCFRAMEWORK=
echo "Starting Build $(date)" | tee ${LOG}
for DEP in ${DEPS[@]}
do
cd ${CWD}
SCRIPT_PATH="scripts/build-${DEP}.sh"
for ARCH in ${ARCHS[@]}
do
echo "Building library ${DEP} for ${ARCH}" | tee -a ${LOG}
config_for_tvos $ARCH
${SCRIPT_PATH} $ARCH 2>&1 | tee -a ${LOG}
[ "$?" != 0 ] && exit $?
done
done
# Lipo
if [ "$LIPO" ]
then
echo "Building fat libraries..." | tee -a ${LOG}
if [ ! -r $FAT ]
then
mkdir $FAT
fi
LIPO_ARCHS=(
arm64
x86_64
)
arch_0=${LIPO_ARCHS[0]}
for lib in $(ls ${BUILD_DIR}/${BUILD_EXT}/${arch_0}/lib/*.a)
do
lipo_arguments=""
lib_name=$(basename $lib)
for ARCH in ${LIPO_ARCHS[@]}
do
lipo_arguments="${lipo_arguments} ${BUILD_DIR}/${BUILD_EXT}/${ARCH}/lib/${lib_name}"
done
lipo -create \
$lipo_arguments \
-output "${FAT}/${lib_name}"
done
fi
# Build xcframework
if [ "$XCFRAMEWORK" ]
then
OUTPUT="${BUILD_DIR}/${BUILD_EXT}/xcframeworks"
if [ -r $OUTPUT ]
then
rm -r $OUTPUT
fi
mkdir $OUTPUT
LIPO_ARCHS=(
arm64-simulator
x86_64
)
arch_0=${LIPO_ARCHS[0]}
[ ! -d "${BUILD_DIR}/${BUILD_EXT}/simulator/" ] && mkdir "${BUILD_DIR}/${BUILD_EXT}/simulator/"
for lib in $(ls ${BUILD_DIR}/${BUILD_EXT}/${arch_0}/lib/*.a)
do
lipo_arguments=""
lib_name=$(basename $lib)
for ARCH in ${LIPO_ARCHS[@]}
do
lipo_arguments="${lipo_arguments} ${BUILD_DIR}/${BUILD_EXT}/${ARCH}/lib/${lib_name}"
done
lipo -create \
$lipo_arguments \
-output "${BUILD_DIR}/${BUILD_EXT}/simulator/lib/${lib_name}"
done
paltforms=(
simulator
arm64
)
for lib in $(ls ${BUILD_DIR}/${BUILD_EXT}/${paltforms[0]}/lib/*.a)
do
framework_arguments=""
filename=$(basename $lib)
lib_name="${filename%.*}"
for arch in ${paltforms[@]}
do
framework_arguments="$framework_arguments -library ${BUILD_DIR}/${BUILD_EXT}/${arch}/lib/${filename}"
done
echo "Creating xcframwork for ${lib}"
xcodebuild -create-xcframework \
$framework_arguments \
-output "${OUTPUT}/${lib_name}.xcframework"
done
fi
echo "Done"