2
2
set -e
3
3
# ################# SETUP BEGIN
4
4
THREAD_COUNT=$( sysctl hw.ncpu | awk ' {print $2}' )
5
- HOST_ARC=$( uname -m )
6
5
XCODE_ROOT=$( xcode-select -print-path )
7
- BOOST_VER=1.80 .0
6
+ BOOST_VER=1.81 .0
8
7
# ################# SETUP END
9
8
DEVSYSROOT=$XCODE_ROOT /Platforms/iPhoneOS.platform/Developer
10
9
SIMSYSROOT=$XCODE_ROOT /Platforms/iPhoneSimulator.platform/Developer
@@ -14,34 +13,28 @@ BOOST_NAME=boost_${BOOST_VER//./_}
14
13
BUILD_DIR=" $( cd " $( dirname " ./" ) " > /dev/null 2>&1 && pwd ) "
15
14
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
16
15
17
- if [ ! -f " $BUILD_DIR /frameworks.built" ]; then
16
+ if [[ ! -f " $BUILD_DIR /frameworks.built" ] ]; then
18
17
19
- if [[ $HOST_ARC == arm* ]]; then
20
- BOOST_ARC=arm
21
- elif [[ $HOST_ARC == x86* ]]; then
22
- BOOST_ARC=x86
23
- else
24
- BOOST_ARC=unknown
25
- fi
26
-
27
-
28
- if [ ! -f $BOOST_NAME .tar.bz2 ]; then
18
+ if [[ ! -f $BOOST_NAME .tar.bz2 ]]; then
29
19
curl -L https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VER /source/$BOOST_NAME .tar.bz2 -o $BOOST_NAME .tar.bz2
20
+ if [[ -d boost ]]; then
21
+ rm -rf boost
22
+ fi
30
23
fi
31
- if [ ! -d boost ]; then
24
+ if [[ ! -d boost ] ]; then
32
25
echo " extracting $BOOST_NAME .tar.bz2 ..."
33
26
tar -xf $BOOST_NAME .tar.bz2
34
27
mv $BOOST_NAME boost
35
28
fi
36
29
37
- if [ ! -f boost/b2 ]; then
30
+ if [[ ! -f boost/b2 ] ]; then
38
31
pushd boost
39
32
./bootstrap.sh
40
33
popd
41
34
fi
42
35
43
36
# ############## ICU
44
- if [ ! -d $SCRIPT_DIR /Pods/icu4c-iosx/product ]; then
37
+ if [[ ! -d $SCRIPT_DIR /Pods/icu4c-iosx/product ] ]; then
45
38
pushd $SCRIPT_DIR
46
39
pod repo update
47
40
pod install --verbose
@@ -69,70 +62,88 @@ echo patching boost...
69
62
# fi
70
63
# patch -p0 <$SCRIPT_DIR/0001-json-array-erase-relocate.patch
71
64
72
- if [ ! -f tools/build/src/tools/features/instruction-set-feature.jam.orig ]; then
65
+ if [[ ! -f tools/build/src/tools/features/instruction-set-feature.jam.orig ] ]; then
73
66
cp -f tools/build/src/tools/features/instruction-set-feature.jam tools/build/src/tools/features/instruction-set-feature.jam.orig
74
67
else
75
68
cp -f tools/build/src/tools/features/instruction-set-feature.jam.orig tools/build/src/tools/features/instruction-set-feature.jam
76
69
fi
77
70
patch tools/build/src/tools/features/instruction-set-feature.jam $SCRIPT_DIR /instruction-set-feature.jam.patch
78
71
79
72
80
-
81
- # LIBS_TO_BUILD="--with-regex"
82
- LIBS_TO_BUILD=" --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave"
73
+ LIBS_TO_BUILD=" --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave --with-url"
83
74
84
75
B2_BUILD_OPTIONS=" -j$THREAD_COUNT -sICU_PATH=\" $ICU_PATH \" address-model=64 release link=static runtime-link=shared define=BOOST_SPIRIT_THREADSAFE cxxflags=\" -std=c++20\" "
85
76
86
77
87
78
if true ; then
88
- if [ -d bin.v2 ]; then
79
+ if [[ -d bin.v2 ] ]; then
89
80
rm -rf bin.v2
90
81
fi
91
- if [ -d stage ]; then
82
+ if [[ -d stage ] ]; then
92
83
rm -rf stage
93
84
fi
94
85
fi
95
86
96
- if true ; then
87
+ function boost_arc()
88
+ {
89
+ if [[ $1 == arm* ]]; then
90
+ echo " arm"
91
+ elif [[ $1 == x86* ]]; then
92
+ echo " x86"
93
+ else
94
+ echo " unknown"
95
+ fi
96
+ }
97
+
98
+ function boost_abi()
99
+ {
100
+ if [[ $1 == arm64 ]]; then
101
+ echo " aapcs"
102
+ elif [[ $1 == x86_64 ]]; then
103
+ echo " sysv"
104
+ else
105
+ echo " unknown"
106
+ fi
107
+ }
108
+
109
+ build_macos_libs ()
110
+ {
97
111
if [[ -f tools/build/src/user-config.jam ]]; then
98
112
rm -f tools/build/src/user-config.jam
99
113
fi
100
- cp $ICU_PATH /frameworks/icudata.xcframework/macos-* $HOST_ARC * /libicudata.a $ICU_PATH /lib/
101
- cp $ICU_PATH /frameworks/icui18n.xcframework/macos-* $HOST_ARC * /libicui18n.a $ICU_PATH /lib/
102
- cp $ICU_PATH /frameworks/icuuc.xcframework/macos-* $HOST_ARC * /libicuuc.a $ICU_PATH /lib/
103
- ./b2 -j8 --stagedir=stage/macosx toolset=darwin architecture=$BOOST_ARC $B2_BUILD_OPTIONS $LIBS_TO_BUILD
114
+ cat >> tools/build/src/user-config.jam << EOF
115
+ using darwin : : clang++ -arch $1 -isysroot $MACSYSROOT /SDKs/MacOSX.sdk
116
+ : <striper> <root>$MACSYSROOT
117
+ : <architecture>$( boost_arc $1 )
118
+ ;
119
+ EOF
120
+ cp $ICU_PATH /frameworks/icudata.xcframework/macos-* /libicudata.a $ICU_PATH /lib/
121
+ cp $ICU_PATH /frameworks/icui18n.xcframework/macos-* /libicui18n.a $ICU_PATH /lib/
122
+ cp $ICU_PATH /frameworks/icuuc.xcframework/macos-* /libicuuc.a $ICU_PATH /lib/
123
+ ./b2 -j8 --stagedir=stage/macosx-$1 toolset=darwin architecture=$( boost_arc $1 ) abi=$( boost_abi $1 ) $B2_BUILD_OPTIONS $LIBS_TO_BUILD
104
124
rm -rf bin.v2
105
- fi
125
+ }
106
126
107
- # <binary-format>mach-o <threading>multi <abi>sysv
108
127
build_catalyst_libs ()
109
128
{
110
129
if [[ -f tools/build/src/user-config.jam ]]; then
111
130
rm -f tools/build/src/user-config.jam
112
131
fi
113
132
cat >> tools/build/src/user-config.jam << EOF
114
- using darwin : catalyst : clang++ -arch $1 --target=$2 -apple-ios13.4-macabi -isysroot $MACSYSROOT /SDKs/MacOSX.sdk -I$MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/usr/include/ -isystem $MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/usr/include -iframework $MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks
133
+ using darwin : catalyst : clang++ -arch $1 --target=$2 -isysroot $MACSYSROOT /SDKs/MacOSX.sdk -I$MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/usr/include/ -isystem $MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/usr/include -iframework $MACSYSROOT /SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks
115
134
: <striper> <root>$MACSYSROOT
116
- : <architecture>$3
135
+ : <architecture>$( boost_arc $1 )
117
136
;
118
137
EOF
119
138
cp $ICU_PATH /frameworks/icudata.xcframework/ios-* -maccatalyst/libicudata.a $ICU_PATH /lib/
120
139
cp $ICU_PATH /frameworks/icui18n.xcframework/ios-* -maccatalyst/libicui18n.a $ICU_PATH /lib/
121
140
cp $ICU_PATH /frameworks/icuuc.xcframework/ios-* -maccatalyst/libicuuc.a $ICU_PATH /lib/
122
- ./b2 --stagedir=stage/catalyst-$1 abi= $4 toolset=darwin-catalyst architecture=$3 $B2_BUILD_OPTIONS $LIBS_TO_BUILD
141
+ ./b2 --stagedir=stage/catalyst-$1 toolset=darwin-catalyst architecture=$( boost_arc $1 ) abi= $( boost_abi $1 ) $B2_BUILD_OPTIONS $LIBS_TO_BUILD
123
142
rm -rf bin.v2
124
143
}
125
144
126
- if true ; then
127
- if [ -d stage/catalyst/lib ]; then
128
- rm -rf stage/catalyst/lib
129
- fi
130
- mkdir -p stage/catalyst/lib
131
- build_catalyst_libs arm64 arm arm aapcs
132
- build_catalyst_libs x86_64 x86_64 x86 sysv
133
- fi
134
-
135
- if true ; then
145
+ build_ios_libs ()
146
+ {
136
147
if [[ -f tools/build/src/user-config.jam ]]; then
137
148
rm -f tools/build/src/user-config.jam
138
149
fi
@@ -147,7 +158,8 @@ cp $ICU_PATH/frameworks/icui18n.xcframework/ios-arm64/libicui18n.a $ICU_PATH/lib
147
158
cp $ICU_PATH /frameworks/icuuc.xcframework/ios-arm64/libicuuc.a $ICU_PATH /lib/
148
159
./b2 --stagedir=stage/ios toolset=darwin-ios instruction-set=arm64 architecture=arm binary-format=mach-o abi=aapcs target-os=iphone define=_LITTLE_ENDIAN define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
149
160
rm -rf bin.v2
150
- fi
161
+ }
162
+
151
163
152
164
build_sim_libs ()
153
165
{
157
169
cat >> tools/build/src/user-config.jam << EOF
158
170
using darwin : iossim : clang++ -arch $1 -fembed-bitcode-marker -isysroot $SIMSYSROOT /SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=13.4
159
171
: <striper> <root>$SIMSYSROOT
160
- : <architecture>$2 <target-os>iphone
172
+ : <architecture>$( boost_arc $1 ) <target-os>iphone
161
173
;
162
174
EOF
163
175
cp $ICU_PATH /frameworks/icudata.xcframework/ios-* -simulator/libicudata.a $ICU_PATH /lib/
164
176
cp $ICU_PATH /frameworks/icui18n.xcframework/ios-* -simulator/libicui18n.a $ICU_PATH /lib/
165
177
cp $ICU_PATH /frameworks/icuuc.xcframework/ios-* -simulator/libicuuc.a $ICU_PATH /lib/
166
- ./b2 --stagedir=stage/iossim-$1 toolset=darwin-iossim abi= $3 architecture= $2 target-os=iphone define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
178
+ ./b2 --stagedir=stage/iossim-$1 toolset=darwin-iossim architecture= $( boost_arc $1 ) abi= $( boost_abi $1 ) target-os=iphone define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
167
179
rm -rf bin.v2
168
180
}
169
181
170
182
if true ; then
171
- if [ -d stage/iossim/lib ]; then
183
+ if [ -d stage/macosx/lib ]; then
184
+ rm -rf stage/macosx/lib
185
+ fi
186
+
187
+ build_macos_libs x86_64
188
+ build_macos_libs arm64
189
+ mkdir -p stage/macosx/lib
190
+ fi
191
+
192
+ if true ; then
193
+ if [[ -d stage/catalyst/lib ]]; then
194
+ rm -rf stage/catalyst/lib
195
+ fi
196
+ build_catalyst_libs arm64 arm-apple-ios13.4-macabi
197
+ build_catalyst_libs x86_64 x86_64-apple-ios13.4-macabi
198
+ mkdir -p stage/catalyst/lib
199
+ fi
200
+
201
+ if true ; then
202
+ if [[ -d stage/iossim/lib ]]; then
172
203
rm -rf stage/iossim/lib
173
204
fi
205
+ build_sim_libs arm64
206
+ build_sim_libs x86_64
174
207
mkdir -p stage/iossim/lib
175
- build_sim_libs arm64 arm aapcs
176
- build_sim_libs x86_64 x86 sysv
177
208
fi
178
209
210
+ build_ios_libs
211
+
179
212
echo installing boost...
180
- if [ -d " $BUILD_DIR /frameworks" ]; then
213
+ if [[ -d " $BUILD_DIR /frameworks" ] ]; then
181
214
rm -rf " $BUILD_DIR /frameworks"
182
215
fi
183
216
184
217
mkdir " $BUILD_DIR /frameworks"
185
218
186
-
187
-
188
219
build_xcframework ()
189
220
{
221
+ lipo -create stage/macosx-arm64/lib/lib$1 .a stage/macosx-x86_64/lib/lib$1 .a -output stage/macosx/lib/lib$1 .a
190
222
lipo -create stage/catalyst-arm64/lib/lib$1 .a stage/catalyst-x86_64/lib/lib$1 .a -output stage/catalyst/lib/lib$1 .a
191
223
lipo -create stage/iossim-arm64/lib/lib$1 .a stage/iossim-x86_64/lib/lib$1 .a -output stage/iossim/lib/lib$1 .a
192
224
@@ -232,6 +264,7 @@ build_xcframework boost_unit_test_framework
232
264
build_xcframework boost_thread
233
265
build_xcframework boost_timer
234
266
build_xcframework boost_type_erasure
267
+ build_xcframework boost_url
235
268
build_xcframework boost_wave
236
269
237
270
mkdir " $BUILD_DIR /frameworks/Headers"
0 commit comments