Skip to content

Commit e4b6702

Browse files
committed
version 1.84.0
1 parent 1d1badd commit e4b6702

File tree

4 files changed

+75
-51
lines changed

4 files changed

+75
-51
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v3
1515
- name: Build
1616
run: |
17-
export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/76.1.4
17+
export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/77.1.0
1818
scripts/build.sh -p=macosx-both,ios,iossim-both,catalyst-both,xros,xrossim-both,watchos,watchossim-both,tvos,tvossim-both
1919
for i in frameworks/*.xcframework/; do cd frameworks && zip -9 -r "$(basename -- $i).zip" $(basename -- $i) & done; wait
2020
cd frameworks

README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,48 @@ Supported version: 1.84.0 (use the appropriate tag to select the version)
44

55
This repo provides a universal script for building static Boost C++ libraries for use in iOS, watchOS, tvOS, visionOS, and macOS & Catalyst applications.
66

7-
Since the Boost distribution URLs are often broken and change, the script tries to download it from the links specified in the LOCATIONS file in the master branch. Only after the SHA256 hash of the downloaded archive is verified, the libraries are unpacked and compiled.
7+
Since Boost distribution URLs are often unreliable and subject to change, the script attempts to download Boost from the links specified in the `LOCATIONS` file on the master branch. Only after verifying the SHA256 hash of the downloaded archive are the libraries unpacked and compiled.
88

9-
## Building libraries
9+
## Built Libraries
1010
atomic, chrono, cobalt (requires apple clang-15.0.0 or later), container, context, contract, coroutine, date_time, exception, fiber, filesystem, graph, iostreams, json, locale, log, math, nowide, program_options, random, regex, serialization, stacktrace, system, test, thread, timer, type_erasure, url, wave
1111

12-
## Not building libraries
12+
## Excluded Libraries
1313
graph_parallel, mpi, python
1414

1515
## Prerequisites
16-
1) Xcode must be installed because xcodebuild is used to create xcframeworks
17-
2) ```xcode-select -p``` must point to Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to CommandLineTools directory you should execute:
18-
```sudo xcode-select --reset``` or ```sudo xcode-select -s /Applications/Xcode.app/Contents/Developer```
19-
3) You should not have your own user-config.jam file in your home directory!
20-
4) Building for tvOS, watchOS, visionOS and their simulators requires the appropriate SDKs to be installed in the folder /Applications/Xcode.app/Contents/Developer/Platforms
2116

22-
## Building notes
23-
1) The 'locale' and 'regex' libraries are built using the ICU backend. There are two ways to get it. The first (default) is when the ICU libraries are automatically built before Boost is built using the build script from https://github.com/apotocki/icu4c-iosx . The second is by specifying the ICU4C_RELEASE_LINK environment variable where prebuit binaries can be downloaded from.
24-
2) The 'test' library is built for iOS and visionOS with the BOOST_TEST_NO_MAIN flag.
25-
3) The 'test' library is built for watchOS and tvOS with the BOOST_TEST_NO_MAIN and BOOST_TEST_DISABLE_ALT_STACK flags.
17+
1. **Install Xcode**: Ensure Xcode is installed, as `xcodebuild` is required to create `xcframeworks`.
18+
19+
2. **Verify Xcode Developer Directory**:
20+
- The `xcode-select -p` command must point to the Xcode app's developer directory (e.g., `/Applications/Xcode.app/Contents/Developer`).
21+
- If it points to the CommandLineTools directory, reset it using one of the following commands:
22+
```bash
23+
sudo xcode-select --reset
24+
```
25+
or
26+
```bash
27+
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
28+
```
29+
30+
3. **Remove User-Specific Configurations**: Ensure you do not have a `user-config.jam` file in your home directory, as it may interfere with the build process.
31+
32+
4. **Install Required SDKs**: To build for tvOS, watchOS, visionOS, and their simulators, make sure the corresponding SDKs are installed in the folder:
33+
```
34+
/Applications/Xcode.app/Contents/Developer/Platforms
35+
```
36+
## Building Notes
37+
38+
1. **ICU Backend for `locale` and `regex` Libraries**:
39+
- These libraries are built using the ICU backend. There are two ways to obtain the ICU libraries:
40+
1. **Default Method**: The ICU libraries are automatically built before Boost using the build script available at:
41+
[https://github.com/apotocki/icu4c-iosx](https://github.com/apotocki/icu4c-iosx).
42+
2. **Prebuilt Binaries**: Specify the `ICU4C_RELEASE_LINK` environment variable to download prebuilt binaries.
43+
44+
2. **`test` Library for iOS and visionOS**:
45+
- The `test` library is built with the `BOOST_TEST_NO_MAIN` flag.
46+
47+
3. **`test` Library for watchOS and tvOS**:
48+
- The `test` library is built with the `BOOST_TEST_NO_MAIN` and `BOOST_TEST_DISABLE_ALT_STACK` flags.
2649

2750
# Build Manually
2851
```
@@ -34,7 +57,7 @@ graph_parallel, mpi, python
3457
scripts/build.sh
3558
3659
# However, if you wish, you can skip building the ICU libraries during the boost build and use pre-built binaries from my ICU repository:
37-
# ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/76.1.4 scripts/build.sh
60+
# ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/77.1.0 scripts/build.sh
3861
3962
# have fun, the result artifacts will be located in 'frameworks' folder.
4063
# Then you can add desirable xcframeworks in your XCode project. The process is described, e.g., at https://www.simpleswiftguide.com/how-to-add-xcframework-to-xcode-project/
@@ -48,7 +71,7 @@ scripts/build.sh -p=ios,iossim-x86_64
4871
```
4972
Here is a list of all possible values for '-p' option:
5073
```
51-
macosx,macosx-arm64,macosx-x86_64,macosx-both,ios,iossim,iossim-arm64,iossim-x86_64,iossim-both,catalyst,catalyst-arm64,catalyst-x86_64,catalyst-both,xros,xrossim,xrossim-arm64,xrossim-x86_64,xrossim-both,tvos,tvossim,tvossim-both,tvossim-arm64,tvossim-x86_64,watchos,watchossim,watchossim-both,watchossim-arm64,watchossim-x86_64
74+
macosx,macosx-arm64,macosx-x86_64,macosx-both,ios,iossim,iossim-arm64,iossim-x86_64,iossim-both,catalyst,catalyst-arm64,catalyst-x86_64,catalyst-both,xros,xrossim,xrossim-arm64,xrossim-x86_64,xrossim-both,tvos,tvossim,tvossim-arm64,tvossim-x86_64,tvossim-both,watchos,watchossim,watchossim-arm64,watchossim-x86_64,watchossim-both
5275
```
5376
Suffix '-both' means that xcframeworks will be built for both arm64 and x86_64 architectures.
5477
The platform names for macosx and simulators without an architecture suffix (e.g. macosx, iossim, tvossim) mean that xcframeworks are only built for the current host architecture.
@@ -77,7 +100,7 @@ Add the following lines into your project's Podfile:
77100
use_frameworks!
78101
pod 'boost-iosx', '~> 1.84.0'
79102
# or optionally more precisely e.g.:
80-
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.84.0.7'
103+
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.84.0.8'
81104
```
82105
If you want to use specific boost libraries, specify them as in the following example for log and program_options libraries:
83106
```

boost-iosx.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "boost-iosx"
3-
s.version = "1.84.0.7"
3+
s.version = "1.84.0.8"
44
s.summary = "Boost C++ libraries for macOS, iOS, watchOS, tvOS, and visionOS, including builds for Mac Catalyst, iOS Simulator, watchOS Simulator, tvOS Simulator, and visionOS Simulator."
55
s.homepage = "https://github.com/apotocki/boost-iosx"
66
s.license = "Boost Software License"

scripts/build.sh

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33
################## SETUP BEGIN
44
THREAD_COUNT=$(sysctl hw.ncpu | awk '{print $2}')
55
HOST_ARC=$( uname -m )
@@ -16,7 +16,7 @@ TVOS_SIM_VERSION=13.0
1616
WATCHOS_VERSION=11.0
1717
WATCHOS_SIM_VERSION=11.0
1818
################## SETUP END
19-
LOCATIONS_FILE_URL="https://raw.githubusercontent.com/apotocki/boost-iosx/master/LOCATIONS"
19+
LOCATIONS_FILE_URL="https://github.com/apotocki/boost-iosx/raw/refs/heads/master/LOCATIONS"
2020
IOSSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
2121
IOSSIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
2222
MACSYSROOT=$XCODE_ROOT/Platforms/MacOSX.platform/Developer
@@ -48,26 +48,24 @@ BUILD_PLATFORMS="macosx,ios,iossim,catalyst"
4848
[[ -d $WATCHOSSYSROOT/SDKs/WatchOS.sdk ]] && BUILD_PLATFORMS="$BUILD_PLATFORMS,watchos"
4949
[[ -d $WATCHOSSIMSYSROOT/SDKs/WatchSimulator.sdk ]] && BUILD_PLATFORMS="$BUILD_PLATFORMS,watchossim-both"
5050

51-
boost_arc()
52-
{
53-
if [[ $1 == arm* ]]; then
54-
echo "arm"
55-
elif [[ $1 == x86* ]]; then
56-
echo "x86"
57-
else
58-
echo "unknown"
59-
fi
51+
REBUILD=false
52+
53+
# Function to determine architecture
54+
boost_arc() {
55+
case $1 in
56+
arm*) echo "arm" ;;
57+
x86*) echo "x86" ;;
58+
*) echo "unknown" ;;
59+
esac
6060
}
6161

62-
boost_abi()
63-
{
64-
if [[ $1 == arm64 ]]; then
65-
echo "aapcs"
66-
elif [[ $1 == x86_64 ]]; then
67-
echo "sysv"
68-
else
69-
echo "unknown"
70-
fi
62+
# Function to determine ABI
63+
boost_abi() {
64+
case $1 in
65+
arm64) echo "aapcs" ;;
66+
x86_64) echo "sysv" ;;
67+
*) echo "unknown" ;;
68+
esac
7169
}
7270

7371
is_subset() {
@@ -84,26 +82,26 @@ is_subset() {
8482
echo "true"
8583
}
8684

87-
# parse command line
85+
# Parse command line arguments
8886
for i in "$@"; do
8987
case $i in
9088
-l=*|--libs=*)
9189
LIBS_TO_BUILD="${i#*=}"
92-
shift # past argument=value
90+
shift
9391
;;
9492
-p=*|--platforms=*)
9593
BUILD_PLATFORMS="${i#*=},"
96-
shift # past argument=value
94+
shift
9795
;;
9896
--rebuild)
9997
REBUILD=true
10098
[[ -f "$BUILD_DIR/frameworks.built.platforms" ]] && rm "$BUILD_DIR/frameworks.built.platforms"
10199
[[ -f "$BUILD_DIR/frameworks.built.libs" ]] && rm "$BUILD_DIR/frameworks.built.libs"
102-
shift # past argument with no value
100+
shift
103101
;;
104102
--rebuildicu)
105103
[[ -d $SCRIPT_DIR/Pods/icu4c-iosx ]] && rm -rf $SCRIPT_DIR/Pods/icu4c-iosx
106-
shift # past argument with no value
104+
shift
107105
;;
108106
-*|--*)
109107
echo "Unknown option $i"
@@ -201,17 +199,17 @@ fi
201199

202200
if [[ ! -f $BOOST_ARCHIVE_FILE ]]; then
203201
TEMP_LOCATIONS_FILE=$(mktemp)
204-
curl -s -o "$TEMP_LOCATIONS_FILE" "$LOCATIONS_FILE_URL"
202+
curl -s -o "$TEMP_LOCATIONS_FILE" -L "$LOCATIONS_FILE_URL"
205203
if [[ $? -ne 0 ]]; then
206204
echo "Failed to download the LOCATIONS file."
207205
exit 1
208206
fi
209207
while IFS= read -r linktemplate; do
210208
linktemplate=${linktemplate/DOTVERSION/"$BOOST_VER"}
211209
link=${linktemplate/FILENAME/"$BOOST_ARCHIVE_FILE"}
212-
echo "downloading from $link ..."
210+
echo "downloading from \"$link\" ..."
213211

214-
curl -o "$BOOST_ARCHIVE_FILE" "$link"
212+
curl -o "$BOOST_ARCHIVE_FILE" -L "$link"
215213

216214
# Check if the download was successful
217215
if [ $? -eq 0 ]; then
@@ -221,6 +219,9 @@ if [[ ! -f $BOOST_ARCHIVE_FILE ]]; then
221219
break
222220
else
223221
echo "Wrong archive hash $FILE_HASH, expected $EXPECTED_HASH. Trying next link to reload the archive."
222+
echo "File content: "
223+
head -c 1024 $BOOST_ARCHIVE_FILE
224+
echo ""
224225
rm $BOOST_ARCHIVE_FILE
225226
fi
226227
fi
@@ -249,7 +250,7 @@ fi
249250
if true; then
250251
#export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/76.1.4
251252
if [[ ! -f $SCRIPT_DIR/Pods/icu4c-iosx/build.success ]] || [[ $(is_subset $SCRIPT_DIR/Pods/icu4c-iosx/build.success "${BUILD_PLATFORMS_ARRAY[@]}") == "false" ]]; then
252-
if [[ ! -z "${ICU4C_RELEASE_LINK}" ]]; then
253+
if [[ ! -z "${ICU4C_RELEASE_LINK:-}" ]]; then
253254
[[ -d $SCRIPT_DIR/Pods/icu4c-iosx ]] && rm -rf $SCRIPT_DIR/Pods/icu4c-iosx
254255
mkdir -p $SCRIPT_DIR/Pods/icu4c-iosx/product
255256
pushd $SCRIPT_DIR/Pods/icu4c-iosx/product
@@ -327,7 +328,7 @@ patch tools/build/src/tools/features/instruction-set-feature.jam $SCRIPT_DIR/ins
327328

328329
B2_BUILD_OPTIONS="-j$THREAD_COUNT address-model=64 release link=static runtime-link=shared define=BOOST_SPIRIT_THREADSAFE cxxflags=\"-std=c++20\""
329330

330-
[[ ! -z "${ICU_PATH}" ]] && B2_BUILD_OPTIONS="$B2_BUILD_OPTIONS -sICU_PATH=\"$ICU_PATH\""
331+
[[ ! -z "${ICU_PATH:-}" ]] && B2_BUILD_OPTIONS="$B2_BUILD_OPTIONS -sICU_PATH=\"$ICU_PATH\""
331332

332333
for i in $LIBS_TO_BUILD; do :;
333334
B2_BUILD_OPTIONS="$B2_BUILD_OPTIONS --with-$i"
@@ -348,15 +349,15 @@ if [[ $REBUILD == true ]] || [[ ! -f $1-$2-build.success ]] || [[ $(is_subset $1
348349
cat >> tools/build/src/user-config.jam <<EOF
349350
using darwin : $1 : clang++ -arch $2 $3
350351
: <striper> <root>$4
351-
: <architecture>$(boost_arc $2) $6
352+
: <architecture>$(boost_arc $2) ${6:-}
352353
;
353354
EOF
354-
if [[ ! -z "${ICU_PATH}" ]]; then
355+
if [[ ! -z "${ICU_PATH:-}" ]]; then
355356
cp $ICU_PATH/frameworks/icudata.xcframework/$5/libicudata.a $ICU_PATH/lib/
356357
cp $ICU_PATH/frameworks/icui18n.xcframework/$5/libicui18n.a $ICU_PATH/lib/
357358
cp $ICU_PATH/frameworks/icuuc.xcframework/$5/libicuuc.a $ICU_PATH/lib/
358359
fi
359-
./b2 -j8 --stagedir=stage/$1-$2 toolset=darwin-$1 architecture=$(boost_arc $2) abi=$(boost_abi $2) $7 $B2_BUILD_OPTIONS
360+
./b2 -j8 --stagedir=stage/$1-$2 toolset=darwin-$1 architecture=$(boost_arc $2) abi=$(boost_abi $2) ${7:-} $B2_BUILD_OPTIONS
360361
rm -rf bin.v2
361362
printf "$LIBS_TO_BUILD_SORTED" > $1-$2-build.success
362363
fi
@@ -399,7 +400,7 @@ build_sim_libs()
399400

400401
build_xrossim_libs()
401402
{
402-
build_generic_libs xrossim $1 "$2 -isysroot $XROSSIMSYSROOT/SDKs/XRSimulator.sdk" $XROSSIMSYSROOT "xros-*-simulator" "<target-os>iphone" "target-os=iphone define=BOOST_TEST_NO_MAIN"
403+
build_generic_libs xrossim $1 "-isysroot $XROSSIMSYSROOT/SDKs/XRSimulator.sdk" $XROSSIMSYSROOT "xros-*-simulator" "<target-os>iphone" "target-os=iphone define=BOOST_TEST_NO_MAIN"
403404
}
404405

405406
build_tvossim_libs()

0 commit comments

Comments
 (0)