├── .circleci └── config.yml ├── .gitignore ├── README.md ├── boost.mapping ├── boost.sh └── patches ├── boost_1_68_0_provider_getrandom_android.patch ├── boost_1_69_0_no_epoll_create1_on_api19.patch ├── boost_1_71_0_no_epoll_create1_on_api19.patch ├── boost_1_71_0_undef_nil.patch ├── boost_1_72_0_fix_beast_partial_deflate_block.patch ├── boost_1_72_0_fix_coroutine.patch ├── boost_1_73_0_fix_beast_partial_deflate_block.patch └── xcode-11.4.patch /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | parameters: 4 | boost-libs: 5 | description: "List of boost libraries to build" 6 | type: string 7 | # We removed serialization as we need to be able to build for iOS 9 and there are code that is using iOS 10+ features 8 | default: "atomic context coroutine date_time exception iostreams program_options random regex system test thread" 9 | 10 | xcode-version: 11 | description: Xcode version for iOS and Darwin builds 12 | type: string 13 | default: "12.5.1" 14 | 15 | twilio-video-sdk-toolchain-image: 16 | description: twilio-video-sdk-toolchain docker image to use for linux and android 17 | type: string 18 | default: "twilio/twilio-video-sdk-toolchain:17" 19 | 20 | aliases: 21 | - &workspace 22 | ~/twilio-boost-build 23 | 24 | - ignore-master: &ignore-master 25 | filters: 26 | tags: 27 | only: /.*/ 28 | branches: 29 | ignore: /^master/ 30 | 31 | - only-release-tags: &only-release-tags 32 | filters: 33 | tags: 34 | only: /^release-.*/ 35 | branches: 36 | ignore: /.*/ 37 | 38 | executors: 39 | linux-executor: 40 | parameters: 41 | resource-class: 42 | type: enum 43 | enum: [small, medium, medium+, large, xlarge] 44 | default: medium+ 45 | docker: 46 | - image: << pipeline.parameters.twilio-video-sdk-toolchain-image >> 47 | auth: 48 | username: $DOCKER_HUB_USERNAME 49 | password: $DOCKER_HUB_PASSWORD 50 | resource_class: << parameters.resource-class >> 51 | working_directory: *workspace 52 | environment: 53 | CMAKE_BUILD_PARALLEL_LEVEL: 2 54 | 55 | mac-executor: 56 | macos: 57 | xcode: << pipeline.parameters.xcode-version >> 58 | resource_class: macos.x86.medium.gen2 59 | working_directory: *workspace 60 | 61 | commands: 62 | generate_build_settings: 63 | description: "Parse tag to determine boost version and twilio suffix" 64 | steps: 65 | - run: 66 | name: Parse build tag 67 | command: | 68 | if [ -z "$CIRCLE_TAG" ]; then 69 | echo "Must use release tag to build boost releases. Push \`release-1.71.0-twilio3\`-style tag to trigger." 70 | echo "Will attempt to build with the latest boost version." 71 | else 72 | BOOST_VERSION=$(echo $CIRCLE_TAG | cut -d - -f 2) 73 | if [[ "$BOOST_VERSION" == "" ]]; then 74 | echo "Failed to parse boost version from tag: $CIRCLE_TAG" 75 | echo "Expected format: \`release-1.71.0-twilio3\`" 76 | exit 1 77 | fi 78 | echo BOOST_VERSION=$BOOST_VERSION 79 | 80 | TWILIO_SUFFIX=$(echo $CIRCLE_TAG | cut -d - -f 3) 81 | echo TWILIO_SUFFIX=$TWILIO_SUFFIX 82 | 83 | echo "export BOOST_VERSION=$BOOST_VERSION" >> $BASH_ENV 84 | echo "export TWILIO_SUFFIX=$TWILIO_SUFFIX" >> $BASH_ENV 85 | fi 86 | 87 | install_mac_buildtools: 88 | description: "Prepare environment for MacOS and iOS builds" 89 | steps: 90 | - run: 91 | name: "Run brew install" 92 | command: | 93 | HOMEBREW_NO_AUTO_UPDATE=1 brew install maven boost-bcp rsync 94 | 95 | unpack: 96 | description: "Unpack boost tarball" 97 | steps: 98 | - checkout 99 | - generate_build_settings 100 | - run: 101 | name: Unpack tarball 102 | command: | 103 | echo BOOST_VERSION=$BOOST_VERSION 104 | echo TWILIO_SUFFIX=$TWILIO_SUFFIX 105 | 106 | ./boost.sh --unpack `test -n "${BOOST_VERSION:-}" && echo --boost-version $BOOST_VERSION` \ 107 | `test -n "${TWILIO_SUFFIX:-}" && echo --twilio-suffix -$TWILIO_SUFFIX` 108 | no_output_timeout: 120m 109 | - persist_to_workspace: 110 | root: . 111 | paths: 112 | - src/* 113 | 114 | build: 115 | description: "Build and Publish" 116 | parameters: 117 | platform: 118 | description: "Platform to build" 119 | type: enum 120 | enum: [ headers, android, linux, linux-cxx11-abi-disabled, ios, osx ] 121 | steps: 122 | - checkout 123 | - attach_workspace: 124 | at: *workspace 125 | - generate_build_settings 126 | - run: 127 | name: Build << parameters.platform >> 128 | command: | 129 | echo BOOST_VERSION=$BOOST_VERSION 130 | echo TWILIO_SUFFIX=$TWILIO_SUFFIX 131 | 132 | ./boost.sh -<< parameters.platform >> --no-clean --no-unpack --no-framework `test -n "${BOOST_VERSION:-}" && echo --boost-version $BOOST_VERSION` \ 133 | `test -n "${TWILIO_SUFFIX:-}" && echo --twilio-suffix -$TWILIO_SUFFIX` --boost-libs "<< pipeline.parameters.boost-libs >>" 134 | no_output_timeout: 120m 135 | - persist_to_workspace: 136 | root: . 137 | paths: 138 | - target/* 139 | - store_artifacts: 140 | path: target/distributions 141 | 142 | jobs: 143 | unpack-sources: 144 | executor: 145 | name: linux-executor 146 | resource-class: small 147 | steps: 148 | - run: 149 | name: apt install 150 | command: | 151 | apt-get -y update 152 | apt-get -y --no-install-recommends install libboost-tools-dev 153 | - unpack 154 | 155 | build-on-linux: 156 | parameters: 157 | platform: 158 | type: enum 159 | enum: [ headers, linux, linux-cxx11-abi-disabled, android ] 160 | executor: 161 | name: linux-executor 162 | resource-class: medium+ 163 | steps: 164 | - build: 165 | platform: << parameters.platform >> 166 | 167 | build-on-mac: 168 | parameters: 169 | platform: 170 | type: enum 171 | enum: [ osx, ios ] 172 | executor: mac-executor 173 | steps: 174 | - install_mac_buildtools 175 | - build: 176 | platform: << parameters.platform >> 177 | 178 | deploy-artifactory: 179 | description: "Deploy binaries to artifactory" 180 | executor: 181 | name: linux-executor 182 | resource-class: small 183 | steps: 184 | - checkout 185 | - attach_workspace: 186 | at: *workspace 187 | - generate_build_settings 188 | - run: #generate_maven_settings 189 | name: Generate Maven settings 190 | command: echo "$ARTIFACTORY_SETTINGS" | base64 --decode > artifactory-settings.xml 191 | - run: 192 | name: Deploy binaries to artifactory 193 | no_output_timeout: 120m 194 | command: | 195 | source $BASH_ENV 196 | ./boost.sh --no-clean --no-unpack --no-framework --deploy `test -n "${BOOST_VERSION:-}" && echo --boost-version $BOOST_VERSION` \ 197 | `test -n "${TWILIO_SUFFIX:-}" && echo --twilio-suffix -$TWILIO_SUFFIX` --boost-libs "<< pipeline.parameters.boost-libs >>" 198 | 199 | workflows: 200 | build-and-deploy: 201 | jobs: 202 | - unpack-sources: 203 | <<: *ignore-master 204 | name: unpack 205 | context: dockerhub-pulls 206 | 207 | - build-on-linux: 208 | <<: *ignore-master 209 | name: build-boost-<< matrix.platform >> 210 | context: dockerhub-pulls 211 | requires: 212 | - unpack 213 | matrix: 214 | parameters: 215 | platform: [ headers, linux, linux-cxx11-abi-disabled, android ] 216 | 217 | - build-on-mac: 218 | <<: *ignore-master 219 | name: build-boost-<< matrix.platform >> 220 | requires: 221 | - unpack 222 | matrix: 223 | parameters: 224 | platform: [ ios, osx ] 225 | 226 | - deploy-artifactory: 227 | <<: *only-release-tags 228 | name: deploy 229 | context: dockerhub-pulls 230 | requires: 231 | - build-on-linux 232 | - build-on-mac 233 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | target/ 4 | src/ 5 | .idea/ 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Boost-Build 2 | =========== 3 | 4 | Scripts to build boost for different platforms (macOS, iOS, tvOS, watchOS, Linux, Android) and package it as a Maven tarball and/or an Apple Framework. 5 | 6 | Libraries are packaged in Twilio style, grouped by variant (debug/release) and then by platform architecture beneath the variant. This makes debug/x86, debug/armv7 etc folders that are consumable by Twilio builds. 7 | 8 | Unpacking these tarballs into a single directory will create all necessary libraries underneath the abovementioned folders together with a top-level includes/boost directory for headers. 9 | 10 | To build packages use ./boost.sh with appropriate argument `-android`, `-ios`, `-osx`, `-linux` or `-linux-cxx11-abi-disabled`. 11 | If not specified, it will attempt to build all. It requires Maven to be installed for deployment - if you do not deploy to Maven-based repositories you can ignore it. 12 | 13 | To find the directories from cmake specify two cmake defines, e.g.: 14 | 15 | cmake -DBOOST_INCLUDEDIR=toplevel/include -DBOOST_LIBRARYDIR=toplevel/lib/release/armv7 16 | 17 | To put all consumed libraries into single directory so that cmake could find them use this maven 18 | plugin invocation: 19 | 20 | 21 | maven-antrun-plugin 22 | 23 | 24 | initialize 25 | 26 | run 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Attributions 46 | ============ 47 | 48 | Build script is based on https://github.com/faithfracture/Apple-Boost-BuildScript 49 | 50 | 51 | License 52 | ======= 53 | 54 | Boost Software License - Version 1.0 - August 17th, 2003 55 | 56 | Permission is hereby granted, free of charge, to any person or organization 57 | obtaining a copy of the software and accompanying documentation covered by 58 | this license (the "Software") to use, reproduce, display, distribute, 59 | execute, and transmit the Software, and to prepare derivative works of the 60 | Software, and to permit third-parties to whom the Software is furnished to 61 | do so, all subject to the following: 62 | 63 | The copyright notices in the Software and this entire statement, including 64 | the above license grant, this restriction and the following disclaimer, 65 | must be included in all copies of the Software, in whole or in part, and 66 | all derivative works of the Software, unless such copies or derivative 67 | works are solely in the form of machine-executable object code generated by 68 | a source language processor. 69 | 70 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 71 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 72 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 73 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 74 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 75 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 76 | DEALINGS IN THE SOFTWARE. 77 | -------------------------------------------------------------------------------- /boost.mapping: -------------------------------------------------------------------------------- 1 | # OSX i386 libs are fat and in x86_64 folder 2 | 3 | boost 4 | osx 5 | x86.32 -> x86_64 6 | x86.64 -> x86_64 7 | linux 8 | x86.32 -> x86 9 | x86.64 -> x86_64 10 | android 11 | x86.32 -> x86 12 | x86.64 -> x86_64 13 | arm.32 -> armeabi-v7a 14 | arm.64 -> arm64-v8a 15 | ios 16 | x86.32 -> fat-x86 17 | x86.64 -> fat-x86 18 | arm.32 -> fat-arm 19 | arm.64 -> fat-arm 20 | 21 | OSX 22 | x86_64 23 | x86_64 24 | Linux 25 | x86 26 | x86_64 27 | Android 28 | armeabi-v7a 29 | arm64-v8a 30 | x86 31 | x86_64 32 | iOS 33 | fat-arm 34 | fat-arm 35 | fat-x86 36 | fat-x86 37 | -------------------------------------------------------------------------------- /boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #=============================================================================== 3 | # Filename: boost.sh 4 | # Author: Pete Goodliffe 5 | # Copyright: (c) Copyright 2009 Pete Goodliffe 6 | # Licence: Please feel free to use this, with attribution 7 | # Modified version 8 | #=============================================================================== 9 | # 10 | # Builds a Boost framework for iOS, iOS Simulator, tvOS, tvOS Simulator, and OSX. 11 | # Creates a set of universal libraries that can be used on an iOS and in the 12 | # iOS simulator. Then creates a pseudo-framework to make using boost in Xcode 13 | # less painful. 14 | # 15 | # To configure the script, define: 16 | # BOOST_VERSION: Which version of Boost to build (e.g. 1.61.0) 17 | # BOOST_VERSION2: Same as BOOST_VERSION, but with _ instead of . (e.g. 1_61_0) 18 | # BOOST_LIBS: Which Boost libraries to build 19 | # IOS_SDK_VERSION: iOS SDK version (e.g. 9.0) 20 | # MIN_IOS_VERSION: Minimum iOS Target Version (e.g. 8.0) 21 | # OSX_SDK_VERSION: OSX SDK version (e.g. 10.11) 22 | # MIN_OSX_VERSION: Minimum OS X Target Version (e.g. 10.10) 23 | # 24 | # If a boost tarball (a file named “boost_$BOOST_VERSION2.tar.bz2”) does not 25 | # exist in the current directory, this script will attempt to download the 26 | # version specified by BOOST_VERSION2. You may also manually place a matching 27 | # tarball in the current directory and the script will use that. 28 | # 29 | #=============================================================================== 30 | set -x 31 | ALL_BOOST_LIBS="atomic chrono container context coroutine date_time exception filesystem graph graph_parallel iostreams locale log math mpi program_options python random regex serialization signals system test thread timer type_erasure wave" 32 | BOOST_LIBS="atomic container context coroutine date_time exception iostreams program_options random regex serialization system test thread" 33 | 34 | BUILD_ANDROID= 35 | BUILD_IOS= 36 | BUILD_TVOS= 37 | BUILD_OSX= 38 | BUILD_LINUX= 39 | BUILD_HEADERS= 40 | UNPACK= 41 | CLEAN= 42 | NO_CLEAN= 43 | NO_FRAMEWORK= 44 | USE_CXX11_ABI= 45 | NO_UNPACK= 46 | DEPLOY= 47 | 48 | ASYNC_COMMIT=94fe4433287df569ce1aa384b248793552980711 49 | 50 | TWILIO_SUFFIX= 51 | 52 | REPO_URL="https://twilio.jfrog.io/artifactory/releases/" 53 | REPO_ID=artifactory 54 | 55 | MIN_IOS_VERSION=9.0 56 | 57 | MIN_TVOS_VERSION=9.2 58 | 59 | MIN_OSX_VERSION=10.10 60 | 61 | OSX_ARCHS="x86_64 i386" 62 | OSX_ARCH_COUNT=0 63 | OSX_ARCH_FLAGS="" 64 | for ARCH in $OSX_ARCHS; do 65 | OSX_ARCH_FLAGS="$OSX_ARCH_FLAGS -arch $ARCH" 66 | ((OSX_ARCH_COUNT++)) 67 | done 68 | 69 | # Applied to all platforms 70 | CXX_FLAGS="" 71 | 72 | XCODE_VERSION=$(xcrun xcodebuild -version | head -n1 | tr -Cd '[:digit:].') 73 | XCODE_ROOT=`xcode-select -print-path` 74 | COMPILER="$XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" 75 | 76 | THREADS="-j$(getconf _NPROCESSORS_ONLN)" 77 | 78 | CURRENT_DIR=`pwd` 79 | SRCDIR="$CURRENT_DIR/src" 80 | ASYNC_DIR="$SRCDIR/asynchronous" 81 | 82 | IOS_DEV_CMD="xcrun --sdk iphoneos" 83 | IOS_SIM_DEV_CMD="xcrun --sdk iphonesimulator" 84 | TVOS_DEV_CMD="xcrun --sdk appletvos" 85 | TVOS_SIM_DEV_CMD="xcrun --sdk appletvsimulator" 86 | OSX_DEV_CMD="xcrun --sdk macosx" 87 | 88 | #=============================================================================== 89 | # Functions 90 | #=============================================================================== 91 | 92 | sdkVersion() 93 | { 94 | FULL_VERSION=$(xcrun --sdk "$1" --show-sdk-version) 95 | read -ra VERSION <<< "${FULL_VERSION//./ }" 96 | echo "${VERSION[0]}.${VERSION[1]}" 97 | } 98 | 99 | IOS_SDK_VERSION=$(sdkVersion iphoneos) 100 | TVOS_SDK_VERSION=$(sdkVersion appletvos) 101 | OSX_SDK_VERSION=$(sdkVersion macosx) 102 | 103 | sdkPath() 104 | { 105 | xcrun --sdk "$1" --show-sdk-path 106 | } 107 | 108 | IOS_SDK_PATH=$(sdkPath iphoneos) 109 | IOSSIM_SDK_PATH=$(sdkPath iphonesimulator) 110 | 111 | usage() 112 | { 113 | cat << EOF 114 | usage: $0 [{-android,-ios,-tvos,-osx,-linux,-linux-cxx11-abi-disabled} ...] options 115 | Build Boost for Android, iOS, iOS Simulator, tvOS, tvOS Simulator, OS X, and Linux 116 | The -ios, -tvos, and -osx options may be specified together. 117 | 118 | Examples: 119 | ./boost.sh -ios -tvos --boost-version 1.56.0 120 | ./boost.sh -osx --no-framework 121 | 122 | OPTIONS: 123 | -h | --help 124 | Display these options and exit. 125 | 126 | * Platform selection is mutually exclusive - you can build only one platform at a time. 127 | 128 | -android 129 | Build for the Android platform. 130 | 131 | -ios 132 | Build for the iOS platform. 133 | 134 | -osx 135 | Build for the OS X platform. 136 | 137 | -tvos 138 | Build for the tvOS platform. 139 | 140 | -linux 141 | Build for the Linux platform. 142 | 143 | -linux-cxx11-abi-disabled 144 | Build for the Linux platform without the modern C++11-conforming ABI introduced in GCC 5. 145 | 146 | -headers 147 | Package headers. 148 | 149 | * Common options. 150 | 151 | --unpack 152 | Only unpack sources, dont build. 153 | 154 | --no-unpack 155 | Do not download or unpack anything. Use local unpacked copy. 156 | 157 | --deploy 158 | Only send request to artifactory to mark packages published. Do nothing else. 159 | 160 | --boost-version [num] 161 | Specify which version of Boost to build. Defaults to $BOOST_VERSION. 162 | 163 | --twilio-suffix [sfx] 164 | Set suffix for the maven package. Defaults to no suffix. 165 | 166 | --boost-libs [libs] 167 | Specify which libraries to build. Space-separate list. 168 | Defaults to: 169 | $BOOST_LIBS 170 | Boost libraries requiring separate building are: 171 | - ${ALL_BOOST_LIBS// / 172 | - } 173 | 174 | --ios-sdk [num] 175 | Specify the iOS SDK version to build with. Defaults to $IOS_SDK_VERSION. 176 | 177 | --min-ios-version [num] 178 | Specify the minimum iOS version to target. Defaults to $MIN_IOS_VERSION. 179 | 180 | --tvos-sdk [num] 181 | Specify the tvOS SDK version to build with. Defaults to $TVOS_SDK_VERSION. 182 | 183 | --min-tvos_version [num] 184 | Specify the minimum tvOS version to target. Defaults to $MIN_TVOS_VERSION. 185 | 186 | --osx-sdk [num] 187 | Specify the OS X SDK version to build with. Defaults to $OSX_SDK_VERSION. 188 | 189 | --min-osx-version [num] 190 | Specify the minimum OS X version to target. Defaults to $MIN_OSX_VERSION. 191 | 192 | --no-framework 193 | Do not create the framework. 194 | 195 | --no-clean 196 | Do not clean up existing build artifacts before building. 197 | 198 | EOF 199 | } 200 | 201 | #=============================================================================== 202 | 203 | parseArgs() 204 | { 205 | while [ "$1" != "" ]; do 206 | case $1 in 207 | -h | --help) 208 | usage 209 | exit 210 | ;; 211 | 212 | -android) 213 | BUILD_ANDROID=1 214 | BOOST_PLATFORM=android 215 | BOOST_PLATFORM_NAME=Android 216 | ;; 217 | 218 | -ios) 219 | BUILD_IOS=1 220 | BOOST_PLATFORM=ios 221 | BOOST_PLATFORM_NAME=iOS 222 | ;; 223 | 224 | -tvos) 225 | BUILD_TVOS=1 226 | BOOST_PLATFORM=tvos 227 | BOOST_PLATFORM_NAME=tvOS 228 | ;; 229 | 230 | -osx) 231 | BUILD_OSX=1 232 | BOOST_PLATFORM=osx 233 | BOOST_PLATFORM_NAME=OSX 234 | ;; 235 | 236 | -linux) 237 | BUILD_LINUX=1 238 | BOOST_PLATFORM=linux 239 | BOOST_PLATFORM_NAME=Linux 240 | ;; 241 | 242 | -linux-cxx11-abi-disabled) 243 | BUILD_LINUX=1 244 | USE_CXX11_ABI=0 245 | BOOST_PLATFORM=linux-cxx11-abi-disabled 246 | BOOST_PLATFORM_NAME=Linux-CXX11-ABI-Disabled 247 | ;; 248 | 249 | -headers) 250 | BUILD_HEADERS=1 251 | BOOST_PLATFORM=all 252 | BOOST_PLATFORM_NAME=All 253 | ;; 254 | 255 | --boost-version) 256 | if [ -n $2 ]; then 257 | BOOST_VERSION=$2 258 | BOOST_VERSION2="${BOOST_VERSION/beta./b}" 259 | BOOST_VERSION2="${BOOST_VERSION2//./_}" 260 | BOOST_TARBALL="$CURRENT_DIR/src/boost_$BOOST_VERSION2.tar.bz2" 261 | BOOST_SRC="$SRCDIR/boost/${BOOST_VERSION}" 262 | shift 263 | else 264 | missingParameter $1 265 | fi 266 | ;; 267 | 268 | --twilio-suffix) 269 | if [ -n $2 ]; then 270 | TWILIO_SUFFIX="$2" 271 | shift 272 | else 273 | missingParameter $1 274 | fi 275 | ;; 276 | 277 | --boost-libs) 278 | if [ -n "$2" ]; then 279 | BOOST_LIBS="$2" 280 | shift 281 | else 282 | missingParameter $1 283 | fi 284 | if [ "$BOOST_LIBS" == "all" ]; then 285 | BOOST_LIBS="$ALL_BOOST_LIBS" 286 | fi 287 | ;; 288 | 289 | --ios-sdk) 290 | if [ -n $2 ]; then 291 | IOS_SDK_VERSION=$2 292 | shift 293 | else 294 | missingParameter $1 295 | fi 296 | ;; 297 | 298 | --min-ios-version) 299 | if [ -n $2 ]; then 300 | MIN_IOS_VERSION=$2 301 | shift 302 | else 303 | missingParameter $1 304 | fi 305 | ;; 306 | 307 | --tvos-sdk) 308 | if [ -n $2]; then 309 | TVOS_SDK_VERSION=$2 310 | shift 311 | else 312 | missingParameter $1 313 | fi 314 | ;; 315 | 316 | --min-tvos-version) 317 | if [ -n $2]; then 318 | MIN_TVOS_VERSION=$2 319 | shift 320 | else 321 | missingParameter $1 322 | fi 323 | ;; 324 | 325 | --osx-sdk) 326 | if [ -n $2 ]; then 327 | OSX_SDK_VERSION=$2 328 | shift 329 | else 330 | missingParameter $1 331 | fi 332 | ;; 333 | 334 | --min-osx-version) 335 | if [ -n $2 ]; then 336 | MIN_OSX_VERSION=$2 337 | shift 338 | else 339 | missingParameter $1 340 | fi 341 | ;; 342 | 343 | --no-clean) 344 | NO_CLEAN=1 345 | ;; 346 | 347 | --unpack) 348 | UNPACK=1 349 | NO_CLEAN=1 350 | NO_FRAMEWORK=1 351 | ;; 352 | 353 | --no-framework) 354 | NO_FRAMEWORK=1 355 | ;; 356 | 357 | --no-unpack) 358 | NO_UNPACK=1 359 | ;; 360 | 361 | --deploy) 362 | DEPLOY=1 363 | ;; 364 | 365 | *) 366 | unknownParameter $1 367 | ;; 368 | esac 369 | 370 | shift 371 | done 372 | } 373 | 374 | #=============================================================================== 375 | 376 | abort() 377 | { 378 | echo 379 | echo "Aborted: $@" 380 | exit 1 381 | } 382 | 383 | #=============================================================================== 384 | 385 | die() 386 | { 387 | usage 388 | exit 1 389 | } 390 | 391 | #=============================================================================== 392 | 393 | missingParameter() 394 | { 395 | echo $1 requires a parameter 396 | die 397 | } 398 | 399 | #=============================================================================== 400 | 401 | unknownParameter() 402 | { 403 | if [[ -n $2 && $2 != "" ]]; then 404 | echo Unknown argument \"$2\" for parameter $1. 405 | else 406 | echo Unknown argument $1 407 | fi 408 | die 409 | } 410 | 411 | #=============================================================================== 412 | 413 | doneSection() 414 | { 415 | echo 416 | echo "Done" 417 | echo "=================================================================" 418 | echo 419 | } 420 | 421 | #=============================================================================== 422 | 423 | cleanup() 424 | { 425 | echo Cleaning everything 426 | 427 | if [[ -n $BUILD_IOS ]]; then 428 | rm -rf "$BOOST_SRC/iphone-build" 429 | rm -rf "$BOOST_SRC/iphonesim-build" 430 | rm -rf "$OUTPUT_DIR" 431 | fi 432 | if [[ -n $BUILD_TVOS ]]; then 433 | rm -rf "$BOOST_SRC/appletv-build" 434 | rm -rf "$BOOST_SRC/appletvsim-build" 435 | rm -rf "$OUTPUT_DIR" 436 | fi 437 | if [[ -n $BUILD_OSX ]]; then 438 | rm -rf "$BOOST_SRC/osx-build" 439 | rm -rf "$OUTPUT_DIR" 440 | fi 441 | 442 | doneSection 443 | } 444 | 445 | #=============================================================================== 446 | 447 | downloadBoost() 448 | { 449 | mkdir -p "$(dirname $BOOST_TARBALL)" 450 | 451 | if [ ! -s $BOOST_TARBALL ]; then 452 | URL=https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION2}.tar.bz2 453 | echo "Downloading boost ${BOOST_VERSION} from $URL" 454 | curl -L -o "$BOOST_TARBALL" $URL 455 | doneSection 456 | fi 457 | } 458 | 459 | #=============================================================================== 460 | 461 | changeNamespace() 462 | { 463 | local NAMESPACE="boost_${BOOST_VERSION2}" 464 | echo Changing boost namespace to "$NAMESPACE"... 465 | cd $BOOST_SRC 466 | mkdir -p bcp 467 | bcp --namespace=$NAMESPACE --namespace-alias `find boost -maxdepth 1 | sed 's/^boost\///' | xargs` bcp >/dev/null 468 | rsync -a bcp/* . 469 | cd - 470 | } 471 | 472 | applyPatches() 473 | { 474 | echo Applying patches, if any... 475 | (cd $BOOST_SRC; cat ${CURRENT_DIR}/patches/boost_${BOOST_VERSION2}*.patch | patch -p2) || echo "Patching failed" 476 | } 477 | 478 | # version() from https://stackoverflow.com/a/37939589/3938401 479 | version() { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } 480 | 481 | patchForXcode() 482 | { 483 | if [ "$(version "$BOOST_VERSION")" -le "$(version "1.73.0")" ] && 484 | [ "$(version "$XCODE_VERSION")" -ge "$(version "11.4")" ] 485 | then 486 | echo "Patching boost in $BOOST_SRC" 487 | 488 | # https://github.com/boostorg/build/pull/560 489 | (cd "$BOOST_SRC" && patch --forward -p1 -d "$BOOST_SRC/tools/build" < "$CURRENT_DIR/patches/xcode-11.4.patch") 490 | 491 | doneSection 492 | fi 493 | } 494 | 495 | unpackBoost() 496 | { 497 | [ -f "$BOOST_TARBALL" ] || abort "Source tarball missing." 498 | 499 | echo Unpacking boost into "$SRCDIR"... 500 | 501 | [ -d $SRCDIR ] || mkdir -p "$SRCDIR" 502 | [ -d $BOOST_SRC ] || ( mkdir -p "$BOOST_SRC"; tar xfj "$BOOST_TARBALL" --strip-components 1 -C "$BOOST_SRC") || exit 1 503 | echo " ...unpacked as $BOOST_SRC" 504 | 505 | changeNamespace 506 | 507 | applyPatches 508 | 509 | doneSection 510 | } 511 | 512 | unpackAsynchronous() 513 | { 514 | [ -d "$ASYNC_DIR" ] && return 515 | 516 | echo Cloning Async into "$ASYNC_DIR"... 517 | 518 | git clone https://github.com/henry-ch/asynchronous.git "$ASYNC_DIR" 519 | (cd "$ASYNC_DIR"; git checkout $ASYNC_COMMIT) 520 | 521 | doneSection 522 | } 523 | 524 | #=============================================================================== 525 | 526 | inventMissingHeaders() 527 | { 528 | # These files are missing in the ARM iPhoneOS SDK, but they are in the simulator. 529 | # They are supported on the device, so we copy them from x86 SDK to a staging area 530 | # to use them on ARM, too. 531 | echo Invent missing headers 532 | 533 | cp "$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk/usr/include/"{crt_externs,bzlib}.h "$BOOST_SRC" 534 | } 535 | 536 | #=============================================================================== 537 | 538 | generateIosUserConfig() 539 | { 540 | cat > "$BOOST_SRC/tools/build/src/user-config.jam" < $XCODE_ROOT/Platforms/iPhoneOS.platform/Developer 544 | : arm iphone 32 545 | ; 546 | using darwin : ${IOS_SDK_VERSION}~iphone 547 | : $COMPILER -arch arm64 $EXTRA_IOS_FLAGS 548 | : $XCODE_ROOT/Platforms/iPhoneOS.platform/Developer 549 | : arm iphone 64 550 | ; 551 | using darwin : ${IOS_SDK_VERSION}~iphonesim 552 | : $COMPILER -arch i386 $EXTRA_IOS_SIM_FLAGS 553 | : $XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer 554 | : x86 iphone 32 555 | ; 556 | using darwin : ${IOS_SDK_VERSION}~iphonesim 557 | : $COMPILER -arch x86_64 $EXTRA_IOS_SIM_FLAGS 558 | : $XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer 559 | : x86 iphone 64 560 | ; 561 | EOF 562 | } 563 | 564 | generateTvosUserConfig() 565 | { 566 | cat > "$BOOST_SRC/tools/build/src/user-config.jam" < $XCODE_ROOT/Platforms/AppleTVOS.platform/Developer 570 | : arm iphone 571 | ; 572 | using darwin : ${TVOS_SDK_VERSION}~appletvsim 573 | : $COMPILER -arch x86_64 $EXTRA_TVOS_FLAGS -I${XCODE_ROOT}/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator${TVOS_SDK_VERSION}.sdk/usr/include 574 | : $XCODE_ROOT/Platforms/AppleTVSimulator.platform/Developer 575 | : x86 iphone 576 | ; 577 | EOF 578 | } 579 | 580 | generateOsxUserConfig() 581 | { 582 | cat > "$BOOST_SRC/tools/build/src/user-config.jam" < $XCODE_ROOT/Platforms/MacOSX.platform/Developer 586 | : x86 darwin 587 | ; 588 | EOF 589 | } 590 | 591 | generateAndroidUserConfig() 592 | { 593 | HOSTOS="$(uname | awk '{ print $1}' | tr [:upper:] [:lower:])-" # darwin or linux 594 | OSARCH="$(uname -m)" 595 | 596 | # Boost doesn't build with -Werror 597 | # Reported to boost-users@lists.boost.org 598 | 599 | cat > "$BOOST_SRC/tools/build/src/user-config.jam" <x86 android 604 | --target=i686-none-linux-android 605 | --gcc-toolchain=$ANDROID_NDK_ROOT/toolchains/x86-4.9/prebuilt/$HOSTOS$OSARCH 606 | --sysroot=$ANDROID_NDK_ROOT/sysroot 607 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include 608 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include 609 | -isystem $ANDROID_NDK_ROOT/sources/android/support/include 610 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include 611 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include/i686-linux-android 612 | -DANDROID 613 | -D__ANDROID_API__=19 614 | -ffunction-sections 615 | -funwind-tables 616 | -fstack-protector-strong 617 | -fno-limit-debug-info 618 | -fPIC 619 | -no-canonical-prefixes 620 | -mstackrealign 621 | -Wa,--noexecstack 622 | -Wformat 623 | -Werror=format-security 624 | -Wall 625 | -Wshadow 626 | ; 627 | using clang : 5.0~x86_64 628 | : $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$HOSTOS$OSARCH/bin/clang++ $EXTRA_ANDROID_FLAGS 629 | : 630 | x86 android 631 | --target=x86_64-none-linux-android 632 | --gcc-toolchain=$ANDROID_NDK_ROOT/toolchains/x86_64-4.9/prebuilt/$HOSTOS$OSARCH 633 | --sysroot=$ANDROID_NDK_ROOT/sysroot 634 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include 635 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include 636 | -isystem $ANDROID_NDK_ROOT/sources/android/support/include 637 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include 638 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include/x86_64-linux-android 639 | -DANDROID 640 | -D__ANDROID_API__=21 641 | -ffunction-sections 642 | -funwind-tables 643 | -fstack-protector-strong 644 | -fno-limit-debug-info 645 | -fPIC 646 | -no-canonical-prefixes 647 | -mstackrealign 648 | -Wa,--noexecstack 649 | -Wformat 650 | -Werror=format-security 651 | -Wall 652 | -Wshadow 653 | ; 654 | using clang : 5.0~arm 655 | : $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$HOSTOS$OSARCH/bin/clang++ $EXTRA_ANDROID_FLAGS 656 | : 657 | arm android 658 | --target=armv7-none-linux-androideabi 659 | --gcc-toolchain=$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/$HOSTOS$OSARCH 660 | --sysroot=$ANDROID_NDK_ROOT/sysroot 661 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include 662 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include 663 | -isystem $ANDROID_NDK_ROOT/sources/android/support/include 664 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include 665 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include/arm-linux-androideabi 666 | -DANDROID 667 | -D__ANDROID_API__=19 668 | -ffunction-sections 669 | -funwind-tables 670 | -fstack-protector-strong 671 | -fno-limit-debug-info 672 | -fPIC 673 | -fno-integrated-as 674 | -no-canonical-prefixes 675 | -Wa,--noexecstack 676 | -Wformat 677 | -Werror=format-security 678 | -Wall 679 | -Wshadow 680 | -march=armv7-a 681 | -mfloat-abi=softfp 682 | -mfpu=vfpv3-d16 683 | -mthumb 684 | ; 685 | using clang : 5.0~arm64 686 | : $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$HOSTOS$OSARCH/bin/clang++ $EXTRA_ANDROID_FLAGS 687 | : 688 | arm android 689 | --target=aarch64-none-linux-android 690 | --gcc-toolchain=$ANDROID_NDK_ROOT/toolchains/aarch64-linux-android-4.9/prebuilt/$HOSTOS$OSARCH 691 | --sysroot=$ANDROID_NDK_ROOT/sysroot 692 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include 693 | -isystem $ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include 694 | -isystem $ANDROID_NDK_ROOT/sources/android/support/include 695 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include 696 | -isystem $ANDROID_NDK_ROOT/sysroot/usr/include/aarch64-linux-android 697 | -DANDROID 698 | -D__ANDROID_API__=21 699 | -ffunction-sections 700 | -funwind-tables 701 | -fstack-protector-strong 702 | -fno-limit-debug-info 703 | -fPIC 704 | -no-canonical-prefixes 705 | -Wa,--noexecstack 706 | -Wformat 707 | -Werror=format-security 708 | -Wall 709 | -Wshadow 710 | ; 711 | EOF 712 | } 713 | 714 | generateLinuxUserConfig() 715 | { 716 | cat > "$BOOST_SRC/tools/build/src/user-config.jam" <x86 linux 720 | -ffunction-sections 721 | -fPIC 722 | -Wformat 723 | -Werror=format-security 724 | -Wall 725 | -Wshadow 726 | ; 727 | EOF 728 | } 729 | 730 | updateBoost() 731 | { 732 | echo Updating boost into $BOOST_SRC... 733 | 734 | if [[ "$1" == "iOS" ]]; then 735 | generateIosUserConfig 736 | fi 737 | 738 | if [[ "$1" == "tvOS" ]]; then 739 | generateTvosUserConfig 740 | fi 741 | 742 | if [[ "$1" == "OSX" ]]; then 743 | generateOsxUserConfig 744 | fi 745 | 746 | if [[ "$1" == "Android" ]]; then 747 | generateAndroidUserConfig 748 | fi 749 | 750 | if [[ "$1" == "Linux" || "$1" == "Linux-CXX11-ABI-Disabled" ]]; then 751 | generateLinuxUserConfig 752 | fi 753 | 754 | doneSection 755 | } 756 | 757 | #=============================================================================== 758 | 759 | bootstrapBoost() 760 | { 761 | cd $BOOST_SRC 762 | BOOTSTRAP_LIBS=$BOOST_LIBS 763 | if [[ "$1" == "tvOS" ]]; then 764 | # Boost Test makes a call that is not available on tvOS (as of 1.61.0) 765 | # If we're bootstraping for tvOS, just remove the test library 766 | BOOTSTRAP_LIBS=$(echo $BOOTSTRAP_LIBS | sed -e "s/test//g") 767 | fi 768 | 769 | BOOST_LIBS_COMMA=$(echo $BOOTSTRAP_LIBS | sed -e "s/ /,/g") 770 | echo "Bootstrapping for $1 (with libs $BOOST_LIBS_COMMA)" 771 | ./bootstrap.sh --with-libraries=$BOOST_LIBS_COMMA 772 | 773 | doneSection 774 | } 775 | 776 | #=============================================================================== 777 | 778 | buildBoost_Android() 779 | { 780 | cd "$BOOST_SRC" 781 | mkdir -p $OUTPUT_DIR 782 | echo > ${OUTPUT_DIR}/android-build.log 783 | 784 | if [[ -z "$ANDROID_NDK_ROOT" ]]; then 785 | echo "Must specify ANDROID_NDK_ROOT" 786 | exit 1 787 | fi 788 | 789 | export NO_BZIP2=1 790 | 791 | # build libicu if locale requested but not provided 792 | # if echo $LIBRARIES | grep locale; then 793 | # if [ -e libiconv-libicu-android ]; then 794 | # echo "ICONV and ICU already compiled" 795 | # else 796 | # echo "boost_locale selected - compiling ICONV and ICU" 797 | # git clone https://github.com/pelya/libiconv-libicu-android.git 798 | # cd libiconv-libicu-android 799 | # ./build.sh || exit 1 800 | # cd .. 801 | # fi 802 | # fi 803 | 804 | for VARIANT in debug release; do 805 | echo Building $VARIANT x86 Boost for Android Emulator 806 | 807 | ./b2 $THREADS --build-dir=android-build --stagedir=android-build/stage \ 808 | --prefix="$OUTPUT_DIR" \ 809 | --libdir="$OUTPUT_DIR/lib/$VARIANT/x86" toolset=clang-5.0~x86 \ 810 | architecture=x86 target-os=android define=_LITTLE_ENDIAN \ 811 | optimization=speed \ 812 | address-model=32 variant=$VARIANT cxxflags="${CPPSTD}" \ 813 | link=static threading=multi install >> "${OUTPUT_DIR}/android-build.log" 2>&1 814 | if [ $? != 0 ]; then echo "Error staging Android. Check ${OUTPUT_DIR}/android-build.log"; exit 1; fi 815 | done 816 | 817 | doneSection 818 | 819 | for VARIANT in debug release; do 820 | echo Building $VARIANT x86_64 Boost for Android Emulator 821 | 822 | ./b2 $THREADS --build-dir=android-build --stagedir=android-build/stage \ 823 | --prefix="$OUTPUT_DIR" \ 824 | --libdir="$OUTPUT_DIR/lib/$VARIANT/x86_64" toolset=clang-5.0~x86_64 \ 825 | architecture=x86 target-os=android define=_LITTLE_ENDIAN \ 826 | optimization=speed \ 827 | address-model=64 variant=$VARIANT cxxflags="${CPPSTD}" \ 828 | link=static threading=multi install >> "${OUTPUT_DIR}/android-build.log" 2>&1 829 | if [ $? != 0 ]; then echo "Error staging Android. Check ${OUTPUT_DIR}/android-build.log"; exit 1; fi 830 | done 831 | 832 | doneSection 833 | 834 | for VARIANT in debug release; do 835 | echo Building $VARIANT armv7 Boost for Android 836 | 837 | ./b2 $THREADS --build-dir=android-build --stagedir=android-build/stage \ 838 | --prefix="$OUTPUT_DIR" \ 839 | --libdir="$OUTPUT_DIR/lib/$VARIANT/armeabi-v7a" toolset=clang-5.0~arm \ 840 | abi=aapcs architecture=arm address-model=32 binary-format=elf threading=multi \ 841 | optimization=space \ 842 | target-os=android variant=$VARIANT cxxflags="${CPPSTD}" \ 843 | link=static install >> "${OUTPUT_DIR}/android-build.log" 2>&1 844 | if [ $? != 0 ]; then echo "Error installing Android. Check ${OUTPUT_DIR}/android-build.log"; exit 1; fi 845 | done 846 | 847 | doneSection 848 | 849 | for VARIANT in debug release; do 850 | echo Building $VARIANT arm64 Boost for Android 851 | 852 | ./b2 $THREADS --build-dir=android-build --stagedir=android-build/stage \ 853 | --prefix="$OUTPUT_DIR" \ 854 | --libdir="$OUTPUT_DIR/lib/$VARIANT/arm64-v8a" toolset=clang-5.0~arm64 \ 855 | abi=aapcs architecture=arm address-model=64 binary-format=elf threading=multi \ 856 | optimization=space \ 857 | target-os=android variant=$VARIANT cxxflags="${CPPSTD}" \ 858 | link=static install >> "${OUTPUT_DIR}/android-build.log" 2>&1 859 | if [ $? != 0 ]; then echo "Error installing Android. Check ${OUTPUT_DIR}/android-build.log"; exit 1; fi 860 | done 861 | 862 | doneSection 863 | } 864 | 865 | #=============================================================================== 866 | 867 | buildBoost_iOS() 868 | { 869 | patchForXcode 870 | 871 | cd "$BOOST_SRC" 872 | mkdir -p $OUTPUT_DIR 873 | echo > ${OUTPUT_DIR}/iphone-armv7-build.log 874 | echo > ${OUTPUT_DIR}/iphone-armv64-build.log 875 | echo > ${OUTPUT_DIR}/iphonesimulator-i386-build.log 876 | echo > ${OUTPUT_DIR}/iphonesimulator-x86_64-build.log 877 | echo > ${OUTPUT_DIR}/iphonesimulator-arm64-build.log 878 | 879 | IOS_SHARED_FLAGS="target-os=iphone threading=multi \ 880 | abi=aapcs binary-format=mach-o \ 881 | link=static define=_LITTLE_ENDIAN" 882 | 883 | for VARIANT in debug release; do 884 | echo Building $VARIANT 32-bit Boost for iPhone 885 | 886 | ./b2 $THREADS --build-dir=iphone-build --stagedir=iphone-build/stage \ 887 | --prefix="$OUTPUT_DIR" \ 888 | --libdir="$OUTPUT_DIR/lib/$VARIANT/iphoneos/armv7" \ 889 | toolset=darwin-${IOS_SDK_VERSION}~iphone \ 890 | variant=$VARIANT address-model=32 architecture=arm optimization=space \ 891 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ -isysroot ${IOS_SDK_PATH} -mios-version-min=$MIN_IOS_VERSION" \ 892 | linkflags="-stdlib=libc++" \ 893 | macosx-version=iphone-${IOS_SDK_VERSION} \ 894 | $IOS_SHARED_FLAGS install >> "${OUTPUT_DIR}/iphone-armv7-build.log" 2>&1 895 | if [ $? != 0 ]; then 896 | cat "${OUTPUT_DIR}/iphone-armv7-build.log" 897 | echo "Error staging ${VARIANT} iPhone armv7. Check ${OUTPUT_DIR}/iphone-armv7-build.log" 898 | exit 1 899 | fi 900 | done 901 | 902 | for VARIANT in debug release; do 903 | echo Building $VARIANT 64-bit Boost for iPhone 904 | 905 | ./b2 $THREADS --build-dir=iphone-build --stagedir=iphone-build/stage \ 906 | --prefix="$OUTPUT_DIR" \ 907 | --libdir="$OUTPUT_DIR/lib/$VARIANT/iphoneos/arm64" \ 908 | toolset=darwin-${IOS_SDK_VERSION}~iphone \ 909 | variant=$VARIANT address-model=64 architecture=arm optimization=space \ 910 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ -isysroot ${IOS_SDK_PATH} -mios-version-min=$MIN_IOS_VERSION" \ 911 | linkflags="-stdlib=libc++" \ 912 | macosx-version=iphone-${IOS_SDK_VERSION} \ 913 | $IOS_SHARED_FLAGS install >> "${OUTPUT_DIR}/iphone-armv64-build.log" 2>&1 914 | if [ $? != 0 ]; then 915 | cat "${OUTPUT_DIR}/iphone-armv64-build.log" 916 | echo "Error staging ${VARIANT} iPhone arm64. Check ${OUTPUT_DIR}/iphone-armv64-build.log" 917 | exit 1 918 | fi 919 | done 920 | 921 | doneSection 922 | 923 | for VARIANT in debug release; do 924 | echo Building $VARIANT 32-bit Boost for i386 iPhoneSimulators 925 | 926 | ./b2 $THREADS --build-dir=iphonesim-build --stagedir=iphonesim-build/stage \ 927 | --prefix="$OUTPUT_DIR" \ 928 | --libdir="$OUTPUT_DIR/lib/$VARIANT/iphonesimulator/i386" \ 929 | toolset=darwin-${IOS_SDK_VERSION}~iphonesim \ 930 | variant=$VARIANT abi=sysv address-model=32 architecture=x86 binary-format=mach-o \ 931 | target-os=iphone threading=multi optimization=speed link=static \ 932 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ -arch i386 -isysroot ${IOSSIM_SDK_PATH} -mios-simulator-version-min=$MIN_IOS_VERSION" \ 933 | linkflags="-stdlib=libc++" \ 934 | macosx-version=iphonesim-${IOS_SDK_VERSION} \ 935 | install >> "${OUTPUT_DIR}/iphonesimulator-i386-build.log" 2>&1 936 | if [ $? != 0 ]; then 937 | cat "${OUTPUT_DIR}/iphonesimulator-i386-build.log" 938 | echo "Error staging ${VARIANT} i386 iPhoneSimulator. Check ${OUTPUT_DIR}/iphonesimulator-i386-build.log" 939 | exit 1 940 | fi 941 | done 942 | 943 | for VARIANT in debug release; do 944 | echo Building $VARIANT 64-bit Boost for x86_64 iPhoneSimulators 945 | 946 | ./b2 $THREADS --build-dir=iphonesim-build --stagedir=iphonesim-build/stage \ 947 | --prefix="$OUTPUT_DIR" \ 948 | --libdir="$OUTPUT_DIR/lib/$VARIANT/iphonesimulator/x86_64" \ 949 | toolset=darwin-${IOS_SDK_VERSION}~iphonesim \ 950 | variant=$VARIANT abi=sysv address-model=64 architecture=x86 binary-format=mach-o \ 951 | target-os=iphone threading=multi optimization=speed link=static \ 952 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ -arch x86_64 -isysroot ${IOSSIM_SDK_PATH} -mios-simulator-version-min=$MIN_IOS_VERSION" \ 953 | linkflags="-stdlib=libc++" \ 954 | macosx-version=iphonesim-${IOS_SDK_VERSION} \ 955 | install >> "${OUTPUT_DIR}/iphonesimulator-x86_64-build.log" 2>&1 956 | if [ $? != 0 ]; then 957 | cat "${OUTPUT_DIR}/iphonesimulator-x86_64-build.log" 958 | echo "Error staging ${VARIANT} x86_64 iPhoneSimulator. Check ${OUTPUT_DIR}/iphonesimulator-x86_64-build.log" 959 | exit 1 960 | fi 961 | done 962 | 963 | for VARIANT in debug release; do 964 | echo Building $VARIANT Boost for arm64 iPhoneSimulators 965 | 966 | ./b2 $THREADS --build-dir=iphonesim-build --stagedir=iphonesim-build/stage \ 967 | --prefix="$OUTPUT_DIR" \ 968 | --libdir="$OUTPUT_DIR/lib/$VARIANT/iphonesimulator/arm64" \ 969 | toolset=darwin-${IOS_SDK_VERSION}~iphonesim \ 970 | variant=$VARIANT abi=aapcs address-model=64 architecture=arm binary-format=mach-o \ 971 | target-os=iphone threading=multi optimization=speed link=static \ 972 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ -arch arm64 -isysroot ${IOSSIM_SDK_PATH} -mios-simulator-version-min=$MIN_IOS_VERSION" \ 973 | cflags="-arch arm64 -isysroot ${IOSSIM_SDK_PATH} -mios-simulator-version-min=$MIN_IOS_VERSION" \ 974 | linkflags="-stdlib=libc++" \ 975 | macosx-version=iphonesim-${IOS_SDK_VERSION} \ 976 | install >> "${OUTPUT_DIR}/iphonesimulator-arm64-build.log" 2>&1 977 | if [ $? != 0 ]; then 978 | cat "${OUTPUT_DIR}/iphonesimulator-arm64-build.log" 979 | echo "Error staging ${VARIANT} arm64 iPhoneSimulator. Check ${OUTPUT_DIR}/iphonesimulator-arm64-build.log" 980 | exit 1 981 | fi 982 | done 983 | 984 | doneSection 985 | } 986 | 987 | #=============================================================================== 988 | 989 | buildBoost_tvOS() 990 | { 991 | patchForXcode 992 | 993 | cd "$BOOST_SRC" 994 | mkdir -p $OUTPUT_DIR 995 | echo > ${OUTPUT_DIR}/tvos-build.log 996 | 997 | for VARIANT in debug release; do 998 | echo Building $VARIANT fat Boost for AppleTV 999 | ./b2 $THREADS --build-dir=appletv-build --stagedir=appletv-build/stage \ 1000 | --prefix="$OUTPUT_DIR" \ 1001 | --libdir="$OUTPUT_DIR/lib/$VARIANT/fat-arm" \ 1002 | address-model=32_64 variant=$VARIANT toolset=darwin-${TVOS_SDK_VERSION}~appletv \ 1003 | optimization=space \ 1004 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++" linkflags="-stdlib=libc++" \ 1005 | architecture=arm target-os=iphone define=_LITTLE_ENDIAN \ 1006 | link=static threading=multi install >> "${OUTPUT_DIR}/tvos-build.log" 2>&1 1007 | if [ $? != 0 ]; then echo "Error staging AppleTV. Check ${OUTPUT_DIR}/tvos-build.log"; exit 1; fi 1008 | done 1009 | 1010 | doneSection 1011 | 1012 | for VARIANT in debug release; do 1013 | echo Building $VARIANT fat Boost for AppleTVSimulator 1014 | ./b2 $THREADS --build-dir=appletv-build --stagedir=appletvsim-build/stage \ 1015 | --prefix="$OUTPUT_DIR" \ 1016 | --libdir="$OUTPUT_DIR/lib/$VARIANT/fat-x86" \ 1017 | abi=sysv address-model=32_64 architecture=x86 binary-format=mach-o threading=multi \ 1018 | optimization=speed \ 1019 | variant=$VARIANT \ 1020 | toolset=darwin-${TVOS_SDK_VERSION}~appletvsim \ 1021 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++" linkflags="-stdlib=libc++" target-os=iphone \ 1022 | link=static install >> "${OUTPUT_DIR}/tvos-build.log" 2>&1 1023 | if [ $? != 0 ]; then echo "Error staging AppleTVSimulator. Check ${OUTPUT_DIR}/tvos-build.log"; exit 1; fi 1024 | done 1025 | 1026 | doneSection 1027 | } 1028 | 1029 | #=============================================================================== 1030 | 1031 | buildBoost_OSX() 1032 | { 1033 | patchForXcode 1034 | 1035 | cd "$BOOST_SRC" 1036 | mkdir -p $OUTPUT_DIR 1037 | echo > ${OUTPUT_DIR}/osx-build.log 1038 | 1039 | for VARIANT in debug release; do 1040 | echo Building $VARIANT 64-bit Boost for OSX 1041 | ./b2 $THREADS --build-dir=osx-build --stagedir=osx-build/stage toolset=clang \ 1042 | --prefix="$OUTPUT_DIR" \ 1043 | --libdir="$OUTPUT_DIR/lib/$VARIANT/x86_64" \ 1044 | address-model=64 variant=$VARIANT \ 1045 | optimization=speed \ 1046 | cxxflags="${CXX_FLAGS} ${CPPSTD} -stdlib=libc++ ${OSX_ARCH_FLAGS}" \ 1047 | linkflags="-stdlib=libc++" link=static threading=multi \ 1048 | macosx-version=${OSX_SDK_VERSION} install >> "${OUTPUT_DIR}/osx-build.log" 2>&1 1049 | if [ $? != 0 ]; then echo "Error staging OSX. Check ${OUTPUT_DIR}/osx-build.log"; exit 1; fi 1050 | done 1051 | 1052 | doneSection 1053 | } 1054 | 1055 | #=============================================================================== 1056 | 1057 | buildBoost_Linux() 1058 | { 1059 | cd "$BOOST_SRC" 1060 | mkdir -p $OUTPUT_DIR 1061 | echo > ${OUTPUT_DIR}/linux-build.log 1062 | 1063 | # intel 1064 | BITS=64 1065 | for VARIANT in debug release; do 1066 | echo Building $VARIANT intel $BITS-bit Boost for Linux 1067 | 1068 | LIBDIR_SUFFIX=x86_64 1069 | 1070 | ./b2 $THREADS --build-dir=linux-build --stagedir=linux-build/stage toolset=gcc \ 1071 | --prefix="$OUTPUT_DIR" \ 1072 | --libdir="$OUTPUT_DIR/lib/$VARIANT/$LIBDIR_SUFFIX" \ 1073 | address-model=$BITS variant=$VARIANT \ 1074 | optimization=speed \ 1075 | cxxflags="${CXX_FLAGS} ${CPPSTD}" \ 1076 | link=static threading=multi \ 1077 | install >> "${OUTPUT_DIR}/linux-build.log" 2>&1 1078 | if [ $? != 0 ]; then echo "Error staging Linux ${BITS}-bit. Check ${OUTPUT_DIR}/linux-build.log"; exit 1; fi 1079 | done 1080 | 1081 | doneSection 1082 | } 1083 | 1084 | #=============================================================================== 1085 | 1086 | packageHeaders() 1087 | { 1088 | BUILDDIR="$CURRENT_DIR/target/distributions" 1089 | mkdir -p "${BUILDDIR}" 1090 | mkdir -p "${OUTPUT_DIR}/include/boost/" 1091 | 1092 | echo Packaging Boost and Asynchronous headers together 1093 | 1094 | cp -rf $SRCDIR/boost/$BOOST_VERSION/boost/* $OUTPUT_DIR/include/boost/ || exit 1 1095 | cp -rf $ASYNC_DIR/boost/* $OUTPUT_DIR/include/boost/ || exit 1 1096 | 1097 | (cd $OUTPUT_DIR; tar cvjf "$BUILDDIR/boost-headers-${BOOST_VERSION}${TWILIO_SUFFIX}-all.tar.bz2" include/boost/*) 1098 | } 1099 | 1100 | #=============================================================================== 1101 | 1102 | renameArchives() 1103 | { 1104 | echo Renaming boost archives... 1105 | 1106 | { 1107 | cd $OUTPUT_DIR; 1108 | find lib -type f -name libboost_${BOOST_VERSION2}*.a | while read archive; do 1109 | mv -v $archive ${archive/${BOOST_VERSION2}_/}; 1110 | done; 1111 | } 1112 | } 1113 | 1114 | #=============================================================================== 1115 | 1116 | packageLibEntry() 1117 | { 1118 | BUILDDIR="$CURRENT_DIR/target/distributions" 1119 | mkdir -p "${BUILDDIR}" 1120 | 1121 | NAME="$1" 1122 | 1123 | echo Packaging boost-$NAME... 1124 | 1125 | if [[ -z "$2" ]]; then 1126 | PATTERN="-name libboost_${NAME}*.a" 1127 | else 1128 | PATTERN="-name NOTMATCHED" 1129 | for PAT in $2; do 1130 | PATTERN="$PATTERN -o -name libboost_${PAT}*.a" 1131 | done 1132 | fi 1133 | 1134 | (cd $OUTPUT_DIR; find lib -type f $PATTERN | tar cvjf "${BUILDDIR}/boost-${NAME}-${BOOST_VERSION}${TWILIO_SUFFIX}-${BOOST_PLATFORM}.tar.bz2" -T -) 1135 | } 1136 | 1137 | packageLibSet() 1138 | { 1139 | echo Packaging Boost libraries... 1140 | for lib in $BOOST_LIBS; do 1141 | if [ "$lib" == "serialization" ]; then 1142 | packageLibEntry serialization "serialization wserialization" 1143 | elif [ "$lib" == "test" ]; then 1144 | packageLibEntry test "prg_exec_monitor test_exec_monitor unit_test_framework" 1145 | else 1146 | packageLibEntry $lib 1147 | fi 1148 | done 1149 | } 1150 | 1151 | #=============================================================================== 1152 | 1153 | # Uses maven, but see 1154 | # http://stackoverflow.com/questions/4029532/upload-artifacts-to-nexus-without-maven 1155 | # for how to do it using plain curl... 1156 | # 1157 | deployFile() 1158 | { 1159 | ARTIFACT=$1 1160 | FILE=$2 1161 | CLASSIFIER=$3 1162 | VERSION=$4 1163 | 1164 | mvn deploy:deploy-file \ 1165 | $SETTINGS_FILE \ 1166 | -Durl="$REPO_URL" \ 1167 | -DrepositoryId=$REPO_ID \ 1168 | -DgroupId=org.boost \ 1169 | -DartifactId=$ARTIFACT \ 1170 | -Dclassifier=$CLASSIFIER \ 1171 | -Dversion=$VERSION \ 1172 | -DgeneratePom=true \ 1173 | -Dpackaging=tar.bz2 \ 1174 | -Dfile=$FILE || exit 1 1175 | } 1176 | 1177 | deployPlat() 1178 | { 1179 | PLAT=$1 1180 | BUILDDIR=$2 1181 | 1182 | for lib in $BOOST_LIBS; do 1183 | deployFile boost-${lib} "${BUILDDIR}/boost-${lib}-${BOOST_VERSION}${TWILIO_SUFFIX}-${PLAT}.tar.bz2" ${PLAT} ${BOOST_VERSION}${TWILIO_SUFFIX} 1184 | done 1185 | } 1186 | 1187 | deployToArtifactory() 1188 | { 1189 | if [[ -z "$REPO_ID" ]]; then 1190 | abort "Specify REPO_ID to deploy" 1191 | fi 1192 | 1193 | BUILDDIR="$CURRENT_DIR/target/distributions" 1194 | SETTINGS_FILE="-s $CURRENT_DIR/artifactory-settings.xml" 1195 | deployFile boost-headers "${BUILDDIR}/boost-headers-${BOOST_VERSION}${TWILIO_SUFFIX}-all.tar.bz2" all ${BOOST_VERSION}${TWILIO_SUFFIX} 1196 | deployPlat "android" "$BUILDDIR" 1197 | deployPlat "ios" "$BUILDDIR" 1198 | deployPlat "osx" "$BUILDDIR" 1199 | deployPlat "linux-cxx11-abi-disabled" "$BUILDDIR" 1200 | deployPlat "linux" "$BUILDDIR" 1201 | } 1202 | 1203 | #=============================================================================== 1204 | 1205 | unpackArchive() 1206 | { 1207 | BUILDDIR="$1" 1208 | LIBNAME="$2" 1209 | 1210 | echo "Unpacking $BUILDDIR/$LIBNAME" 1211 | 1212 | if [[ -d "$BUILDDIR/$LIBNAME" ]]; then 1213 | cd "$BUILDDIR/$LIBNAME" 1214 | rm *.o 1215 | rm *.SYMDEF* 1216 | else 1217 | mkdir -p "$BUILDDIR/$LIBNAME" 1218 | fi 1219 | 1220 | ( 1221 | cd "$BUILDDIR/$NAME"; ar -x "../../libboost_${BOOST_VERSION2}_$NAME.a"; 1222 | for FILE in *.o; do 1223 | NEW_FILE="${NAME}_${FILE}" 1224 | mv "$FILE" "$NEW_FILE" 1225 | done 1226 | ) 1227 | } 1228 | 1229 | #=============================================================================== 1230 | 1231 | scrunchAllLibsTogetherInOneLibPerPlatform() 1232 | { 1233 | echo "Framework builds are not supported - need to fix all the paths" 1234 | exit 1 1235 | 1236 | cd "$BOOST_SRC" 1237 | 1238 | if [[ -n $BUILD_IOS ]]; then 1239 | # iOS Device 1240 | mkdir -p "$BUILD_DIR/armv7/obj" 1241 | mkdir -p "$BUILD_DIR/arm64/obj" 1242 | 1243 | # iOS Simulator 1244 | mkdir -p "$BUILD_DIR/i386/obj" 1245 | mkdir -p "$BUILD_DIR/x86_64/obj" 1246 | fi 1247 | 1248 | if [[ -n $BUILD_TVOS ]]; then 1249 | # tvOS Device 1250 | mkdir -p "$BUILD_DIR/arm64/obj" 1251 | 1252 | # tvOS Simulator 1253 | mkdir -p "$BUILD_DIR/x86_64/obj" 1254 | fi 1255 | 1256 | if [[ -n $BUILD_OSX ]]; then 1257 | # OSX 1258 | for ARCH in $OSX_ARCHS; do 1259 | mkdir -p "$BUILD_DIR/$ARCH/obj" 1260 | done 1261 | fi 1262 | 1263 | ALL_LIBS="" 1264 | 1265 | echo Splitting all existing fat binaries... 1266 | 1267 | for NAME in $BOOST_LIBS; do 1268 | if [ "$NAME" == "test" ]; then 1269 | NAME="unit_test_framework" 1270 | fi 1271 | 1272 | ALL_LIBS="$ALL_LIBS libboost_${BOOST_VERSION2}_$NAME.a" 1273 | 1274 | if [[ -n $BUILD_IOS ]]; then 1275 | $IOS_DEV_CMD lipo "iphone-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1276 | -thin armv7 -o "$BUILD_DIR/armv7/libboost_${BOOST_VERSION2}_$NAME.a" 1277 | $IOS_DEV_CMD lipo "iphone-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1278 | -thin arm64 -o "$BUILD_DIR/arm64/libboost_${BOOST_VERSION2}_$NAME.a" 1279 | 1280 | $IOS_SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1281 | -thin i386 -o "$BUILD_DIR/i386/libboost_${BOOST_VERSION2}_$NAME.a" 1282 | $IOS_SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1283 | -thin x86_64 -o "$BUILD_DIR/x86_64/libboost_${BOOST_VERSION2}_$NAME.a" 1284 | fi 1285 | 1286 | if [[ -n $BUILD_TVOS ]]; then 1287 | $TVOS_DEV_CMD lipo "appletv-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1288 | -thin arm64 -o "$BUILD_DIR/arm64/libboost_${BOOST_VERSION2}_$NAME.a" 1289 | 1290 | $TVOS_SIM_DEV_CMD lipo "appletvsim-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1291 | -thin x86_64 -o "$BUILD_DIR/x86_64/libboost_${BOOST_VERSION2}_$NAME.a" 1292 | fi 1293 | 1294 | if [[ -n $BUILD_OSX ]]; then 1295 | if (( $OSX_ARCH_COUNT == 1 )); then 1296 | cp "osx-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1297 | "$BUILD_DIR/$ARCH/libboost_${BOOST_VERSION2}_$NAME.a" 1298 | else 1299 | for ARCH in $OSX_ARCHS; do 1300 | $OSX_DEV_CMD lipo "osx-build/stage/lib/libboost_${BOOST_VERSION2}_$NAME.a" \ 1301 | -thin $ARCH -o "$BUILD_DIR/$ARCH/libboost_${BOOST_VERSION2}_$NAME.a" 1302 | done 1303 | fi 1304 | fi 1305 | done 1306 | 1307 | echo "Decomposing each architecture's .a files" 1308 | 1309 | for NAME in $BOOST_LIBS; do 1310 | if [ "$NAME" == "test" ]; then 1311 | NAME="unit_test_framework" 1312 | fi 1313 | 1314 | echo "Decomposing libboost_${BOOST_VERSION2}_${NAME}.a" 1315 | if [[ -n $BUILD_IOS ]]; then 1316 | unpackArchive "$BUILD_DIR/armv7/obj" $NAME 1317 | unpackArchive "$BUILD_DIR/arm64/obj" $NAME 1318 | unpackArchive "$BUILD_DIR/i386/obj" $NAME 1319 | unpackArchive "$BUILD_DIR/x86_64/obj" $NAME 1320 | fi 1321 | 1322 | if [[ -n $BUILD_TVOS ]]; then 1323 | unpackArchive "$BUILD_DIR/arm64/obj" $NAME 1324 | unpackArchive "$BUILD_DIR/x86_64/obj" $NAME 1325 | fi 1326 | 1327 | if [[ -n $BUILD_OSX ]]; then 1328 | for ARCH in $OSX_ARCHS; do 1329 | unpackArchive "$BUILD_DIR/$ARCH/obj" $NAME 1330 | done 1331 | fi 1332 | done 1333 | 1334 | echo "Linking each architecture into an uberlib ($ALL_LIBS => libboost_${BOOST_VERSION2}.a )" 1335 | if [[ -n $BUILD_IOS ]]; then 1336 | cd "$BUILD_DIR" 1337 | rm */libboost_${BOOST_VERSION2}.a 1338 | fi 1339 | if [[ -n $BUILD_TVOS ]]; then 1340 | cd "$BUILD_DIR" 1341 | rm */libboost_${BOOST_VERSION2}.a 1342 | fi 1343 | if [[ -n $BUILD_OSX ]]; then 1344 | for ARCH in $OSX_ARCHS; do 1345 | rm "$BUILD_DIR/$ARCH/libboost_${BOOST_VERSION2}.a" 1346 | done 1347 | fi 1348 | 1349 | for NAME in $BOOST_LIBS; do 1350 | if [ "$NAME" == "test" ]; then 1351 | NAME="unit_test_framework" 1352 | fi 1353 | 1354 | echo "Archiving $NAME" 1355 | 1356 | # The obj/$NAME/*.o below should all be quoted, but I couldn't figure out how to do that elegantly. 1357 | # Boost lib names probably won't contain non-word characters any time soon, though. ;) - Jan 1358 | 1359 | if [[ -n $BUILD_IOS ]]; then 1360 | echo ...armv7 1361 | (cd "$BUILD_DIR/armv7"; $IOS_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1362 | echo ...arm64 1363 | (cd "$BUILD_DIR/arm64"; $IOS_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1364 | 1365 | echo ...i386 1366 | (cd "$BUILD_DIR/i386"; $IOS_SIM_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1367 | echo ...x86_64 1368 | (cd "$BUILD_DIR/x86_64"; $IOS_SIM_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1369 | fi 1370 | 1371 | if [[ -n $BUILD_TVOS ]]; then 1372 | echo ...tvOS-arm64 1373 | (cd "$BUILD_DIR/arm64"; $TVOS_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1374 | echo ...tvOS-x86_64 1375 | (cd "$BUILD_DIR/x86_64"; $TVOS_SIM_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1376 | fi 1377 | 1378 | if [[ -n $BUILD_OSX ]]; then 1379 | for ARCH in $OSX_ARCHS; do 1380 | echo ...osx-$ARCH 1381 | (cd "$BUILD_DIR/$ARCH"; $OSX_DEV_CMD ar crus libboost_${BOOST_VERSION2}.a obj/$NAME/*.o; ) 1382 | done 1383 | fi 1384 | done 1385 | } 1386 | 1387 | #=============================================================================== 1388 | 1389 | buildFramework() 1390 | { 1391 | : ${1:?} 1392 | FRAMEWORKDIR="$1" 1393 | BUILDDIR="$2/build" 1394 | PREFIXDIR="$2/prefix" 1395 | 1396 | VERSION_TYPE=Alpha 1397 | FRAMEWORK_NAME=boost 1398 | FRAMEWORK_VERSION=A 1399 | 1400 | FRAMEWORK_CURRENT_VERSION="$BOOST_VERSION" 1401 | FRAMEWORK_COMPATIBILITY_VERSION="$BOOST_VERSION" 1402 | 1403 | FRAMEWORK_BUNDLE="$FRAMEWORKDIR/$FRAMEWORK_NAME.framework" 1404 | echo "Framework: Building $FRAMEWORK_BUNDLE from $BUILDDIR..." 1405 | 1406 | rm -rf "$FRAMEWORK_BUNDLE" 1407 | 1408 | echo "Framework: Setting up directories..." 1409 | mkdir -p "$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Resources" 1410 | mkdir -p "$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Headers" 1411 | mkdir -p "$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Documentation" 1412 | 1413 | echo "Framework: Creating symlinks..." 1414 | ln -s "$FRAMEWORK_VERSION" "$FRAMEWORK_BUNDLE/Versions/Current" 1415 | ln -s "Versions/Current/Headers" "$FRAMEWORK_BUNDLE/Headers" 1416 | ln -s "Versions/Current/Resources" "$FRAMEWORK_BUNDLE/Resources" 1417 | ln -s "Versions/Current/Documentation" "$FRAMEWORK_BUNDLE/Documentation" 1418 | ln -s "Versions/Current/$FRAMEWORK_NAME" "$FRAMEWORK_BUNDLE/$FRAMEWORK_NAME" 1419 | 1420 | FRAMEWORK_INSTALL_NAME="$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/$FRAMEWORK_NAME" 1421 | 1422 | echo "Lipoing library into $FRAMEWORK_INSTALL_NAME..." 1423 | cd "$BUILDDIR" 1424 | if [[ -n $BUILD_IOS ]]; then 1425 | $IOS_DEV_CMD lipo -create */libboost_${BOOST_VERSION2}.a -o "$FRAMEWORK_INSTALL_NAME" || abort "Lipo $1 failed" 1426 | fi 1427 | if [[ -n $BUILD_TVOS ]]; then 1428 | $TVOS_DEV_CMD lipo -create */libboost_${BOOST_VERSION2}.a -o "$FRAMEWORK_INSTALL_NAME" || abort "Lipo $1 failed" 1429 | fi 1430 | if [[ -n $BUILD_OSX ]]; then 1431 | $OSX_DEV_CMD lipo -create */libboost_${BOOST_VERSION2}.a -o "$FRAMEWORK_INSTALL_NAME" || abort "Lipo $1 failed" 1432 | fi 1433 | 1434 | echo "Framework: Copying includes..." 1435 | cd "$PREFIXDIR/include/boost" 1436 | cp -r * "$FRAMEWORK_BUNDLE/Headers/" 1437 | 1438 | echo "Framework: Creating plist..." 1439 | cat > "$FRAMEWORK_BUNDLE/Resources/Info.plist" < 1441 | 1442 | 1443 | 1444 | CFBundleExecutable 1445 | ${FRAMEWORK_NAME} 1446 | CFBundleIdentifier 1447 | org.boost 1448 | CFBundleInfoDictionaryVersion 1449 | 6.0 1450 | CFBundlePackageType 1451 | FMWK 1452 | CFBundleSignature 1453 | ???? 1454 | CFBundleVersion 1455 | ${FRAMEWORK_CURRENT_VERSION} 1456 | 1457 | 1458 | EOF 1459 | 1460 | doneSection 1461 | } 1462 | 1463 | #=============================================================================== 1464 | # Execution starts here 1465 | #=============================================================================== 1466 | 1467 | parseArgs "$@" 1468 | 1469 | if [[ -z $BOOST_VERSION ]]; then 1470 | BOOST_VERSION=`curl -s 'https://github.com/boostorg/boost/tags' | grep -o "boost-\([0-9]\+\.[0-9]\+\.[0-9]\+\)\"" | cut -d"-" -f2 | cut -d"\"" -f1 | head -1` 1471 | if [[ "$BOOST_VERSION" == "" ]]; then 1472 | echo "Failed to determine latest boost version from https://github.com/boostorg/boost/tags" 1473 | exit 1 1474 | fi 1475 | echo "Detected the latest boost version from https://github.com/boostorg/boost/tags to be version $BOOST_VERSION" 1476 | BOOST_VERSION2="${BOOST_VERSION//./_}" 1477 | BOOST_TARBALL="$CURRENT_DIR/src/boost_$BOOST_VERSION2.tar.bz2" 1478 | BOOST_SRC="$SRCDIR/boost/${BOOST_VERSION}" 1479 | fi 1480 | 1481 | if [[ -n "$UNPACK" || -n "$DEPLOY" ]]; then 1482 | BUILD_ANDROID= 1483 | BUILD_IOS= 1484 | BUILD_TVOS= 1485 | BUILD_OSX= 1486 | BUILD_LINUX= 1487 | BUILD_HEADERS= 1488 | elif [[ -z $BUILD_IOS && -z $BUILD_TVOS && -z $BUILD_OSX && -z $BUILD_ANDROID && -z $BUILD_LINUX && -z $BUILD_HEADERS ]]; then 1489 | BUILD_ANDROID=1 1490 | BUILD_IOS=1 1491 | BUILD_TVOS=1 1492 | BUILD_OSX=1 1493 | BUILD_LINUX=1 1494 | BUILD_HEADERS=1 1495 | fi 1496 | 1497 | # The EXTRA_FLAGS definition works around a thread race issue in 1498 | # shared_ptr. I encountered this historically and have not verified that 1499 | # the fix is no longer required. Without using the posix thread primitives 1500 | # an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the 1501 | # shared_ptr use count causing nasty and subtle bugs. 1502 | # 1503 | # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS 1504 | 1505 | # Todo: perhaps add these 1506 | # -DBOOST_SP_USE_SPINLOCK 1507 | # -stdlib=libc++ 1508 | 1509 | CPPSTD="-std=c++1z" 1510 | 1511 | # Must set these after parseArgs to fill in overriden values 1512 | # Todo: -g -DNDEBUG are for debug builds only... 1513 | # Boost.test defines are needed to build correct instrumentable boost_unit_test_framework static lib 1514 | # it does not affect the functionality of single-header usage. 1515 | # See http://www.boost.org/doc/libs/1_66_0/libs/test/doc/html/boost_test/adv_scenarios/static_lib_customizations/entry_point.html 1516 | EXTRA_FLAGS="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS \ 1517 | -DBOOST_TEST_NO_MAIN -DBOOST_TEST_ALTERNATIVE_INIT_API \ 1518 | -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-local-typedef" 1519 | EXTRA_IOS_FLAGS="$EXTRA_FLAGS -fembed-bitcode -mios-version-min=$MIN_IOS_VERSION" 1520 | EXTRA_IOS_SIM_FLAGS="$EXTRA_FLAGS -mios-simulator-version-min=$MIN_IOS_VERSION" 1521 | EXTRA_TVOS_FLAGS="$EXTRA_FLAGS -fembed-bitcode -mtvos-version-min=$MIN_TVOS_VERSION" 1522 | EXTRA_OSX_FLAGS="$EXTRA_FLAGS -mmacosx-version-min=$MIN_OSX_VERSION" 1523 | EXTRA_ANDROID_FLAGS="$EXTRA_FLAGS" 1524 | 1525 | if [[ -n "$USE_CXX11_ABI" ]]; then 1526 | EXTRA_LINUX_FLAGS="$EXTRA_FLAGS -D_GLIBCXX_USE_CXX11_ABI=$USE_CXX11_ABI" 1527 | else 1528 | EXTRA_LINUX_FLAGS="$EXTRA_FLAGS" 1529 | fi 1530 | 1531 | BOOST_TARBALL="$CURRENT_DIR/src/boost_$BOOST_VERSION2.tar.bz2" 1532 | BOOST_SRC="$SRCDIR/boost/${BOOST_VERSION}" 1533 | OUTPUT_DIR="$CURRENT_DIR/target/outputs/boost/$BOOST_VERSION/$BOOST_PLATFORM" 1534 | BUILD_DIR="$OUTPUT_DIR/build" 1535 | FRAMEWORK_DIR="$OUTPUT_DIR/framework" 1536 | 1537 | format="%-20s %s\n" 1538 | format2="%-20s %s (%u)\n" 1539 | 1540 | printf "$format" "BOOST_VERSION:" "$BOOST_VERSION" 1541 | printf "$format" "BOOST_LIBS:" "$BOOST_LIBS" 1542 | printf "$format" "BOOST_SRC:" "$BOOST_SRC" 1543 | printf "$format" "C++:" "$CPPSTD" 1544 | printf "$format" "BUILD_ANDROID:" $( [[ -n $BUILD_ANDROID ]] && echo "YES" || echo "NO") 1545 | printf "$format" "BUILD_IOS:" $( [[ -n $BUILD_IOS ]] && echo "YES" || echo "NO") 1546 | printf "$format" "BUILD_TVOS:" $( [[ -n $BUILD_TVOS ]] && echo "YES" || echo "NO") 1547 | printf "$format" "BUILD_OSX:" $( [[ -n $BUILD_OSX ]] && echo "YES" || echo "NO") 1548 | printf "$format" "BUILD_LINUX:" $( [[ -n $BUILD_LINUX ]] && echo "YES" || echo "NO") 1549 | printf "$format" " LINUX_USE_CXX11_ABI:" $( [[ "$USE_CXX11_ABI" == "0" ]] && echo "NO" || echo "YES") 1550 | printf "$format" " EXTRA_LINUX_FLAGS:" "$EXTRA_LINUX_FLAGS" 1551 | printf "$format" "xOS SDK builds:" 1552 | printf "$format" " IOS_SDK_VERSION:" "$IOS_SDK_VERSION" 1553 | printf "$format" " MIN_IOS_VERSION:" "$MIN_IOS_VERSION" 1554 | printf "$format" " TVOS_SDK_VERSION:" "$TVOS_SDK_VERSION" 1555 | printf "$format" " MIN_TVOS_VERSION:" "$MIN_TVOS_VERSION" 1556 | printf "$format" " OSX_SDK_VERSION:" "$OSX_SDK_VERSION" 1557 | printf "$format" " MIN_OSX_VERSION:" "$MIN_OSX_VERSION" 1558 | printf "$format2" "OSX_ARCHS:" "$OSX_ARCHS" $OSX_ARCH_COUNT 1559 | printf "$format" "Paths:" 1560 | printf "$format" " ANDROID_NDK_ROOT:" "$ANDROID_NDK_ROOT" 1561 | printf "$format" " BUILD_DIR:" "$BUILD_DIR" 1562 | printf "$format" " FRAMEWORK_DIR:" "$FRAMEWORK_DIR" 1563 | printf "$format" " XCODE_ROOT:" "$XCODE_ROOT" 1564 | echo 1565 | 1566 | if [ -z "$NO_CLEAN" ]; then 1567 | cleanup 1568 | fi 1569 | 1570 | if [ -z "$NO_UNPACK" ]; then 1571 | downloadBoost 1572 | unpackBoost 1573 | unpackAsynchronous 1574 | inventMissingHeaders 1575 | fi 1576 | 1577 | if [ -n "$UNPACK" ]; then 1578 | exit 1579 | elif [[ -n $BUILD_IOS || -n $BUILD_TVOS || -n $BUILD_OSX || -n $BUILD_ANDROID || -n $BUILD_LINUX ]]; then 1580 | updateBoost "$BOOST_PLATFORM_NAME" 1581 | bootstrapBoost "$BOOST_PLATFORM_NAME" 1582 | fi 1583 | 1584 | if [[ -n $BUILD_ANDROID ]]; then 1585 | buildBoost_Android 1586 | fi 1587 | if [[ -n $BUILD_IOS ]]; then 1588 | buildBoost_iOS 1589 | fi 1590 | if [[ -n $BUILD_TVOS ]]; then 1591 | buildBoost_tvOS 1592 | fi 1593 | if [[ -n $BUILD_OSX ]]; then 1594 | buildBoost_OSX 1595 | fi 1596 | if [[ -n $BUILD_LINUX ]]; then 1597 | buildBoost_Linux 1598 | fi 1599 | 1600 | if [ -z $NO_FRAMEWORK ]; then 1601 | 1602 | scrunchAllLibsTogetherInOneLibPerPlatform 1603 | 1604 | if [[ -n $BUILD_IOS ]]; then 1605 | buildFramework "$FRAMEWORK_DIR" "$OUTPUT_DIR" 1606 | fi 1607 | 1608 | if [[ -n $BUILD_TVOS ]]; then 1609 | buildFramework "$FRAMEWORK_DIR" "$OUTPUT_DIR" 1610 | fi 1611 | 1612 | if [[ -n $BUILD_OSX ]]; then 1613 | buildFramework "$FRAMEWORK_DIR" "$OUTPUT_DIR" 1614 | fi 1615 | fi 1616 | 1617 | if [[ -n "$BUILD_HEADERS" ]]; then 1618 | packageHeaders 1619 | fi 1620 | 1621 | if [[ -n $BUILD_IOS || -n $BUILD_TVOS || -n $BUILD_OSX || -n $BUILD_ANDROID \ 1622 | || -n $BUILD_LINUX || -n $BUILD_HEADERS ]]; then 1623 | renameArchives 1624 | packageLibSet 1625 | fi 1626 | 1627 | if [[ -n "$DEPLOY" ]]; then 1628 | deployToArtifactory 1629 | fi 1630 | 1631 | echo "Completed successfully" 1632 | -------------------------------------------------------------------------------- /patches/boost_1_68_0_provider_getrandom_android.patch: -------------------------------------------------------------------------------- 1 | commit 2c142e311adae28cf4c489a029f92200cd3e9015 2 | Author: Andrey Semashev 3 | Date: Thu Aug 16 00:12:32 2018 +0300 4 | 5 | Disabled getrandom provider on Android prior to API version 28. 6 | 7 | Android supports getrandom and getentropy functions only since API version 28. 8 | 9 | As part of the fix converted Linux/Android platform detection from Boost.Predef 10 | to direct checks of platform-specific macros. This is to work around 11 | Boost.Predef problem described in [1] - depending on header inclusion order 12 | Boost.Predef may indicate Linux or Android. When that problem is fixed we 13 | may change back to Boost.Predef. 14 | 15 | Fixes https://github.com/boostorg/uuid/issues/76. 16 | 17 | [1]: https://github.com/boostorg/predef/issues/81#issuecomment-413329061 18 | 19 | diff --git a/include/boost/uuid/detail/random_provider_detect_platform.hpp b/include/boost/uuid/detail/random_provider_detect_platform.hpp 20 | index f24b06f..b3b2655 100644 21 | --- a/include/boost/uuid/detail/random_provider_detect_platform.hpp 22 | +++ b/include/boost/uuid/detail/random_provider_detect_platform.hpp 23 | @@ -14,10 +14,15 @@ 24 | #include 25 | #include 26 | #include 27 | -#include 28 | #include 29 | -#if BOOST_OS_LINUX 30 | + 31 | +// Note: Don't use Boost.Predef to detect Linux and Android as it may give different results depending on header inclusion order. 32 | +// https://github.com/boostorg/predef/issues/81#issuecomment-413329061 33 | +#if (defined(__linux__) || defined(__linux) || defined(linux)) && (!defined(__ANDROID__) || __ANDROID_API__ >= 28) 34 | #include 35 | +#if defined(SYS_getrandom) 36 | +#define BOOST_UUID_RANDOM_PROVIDER_HAS_GETRANDOM 37 | +#endif // defined(SYS_getrandom) 38 | #endif 39 | 40 | // 41 | @@ -45,7 +50,7 @@ 42 | # error Unable to find a suitable windows entropy provider 43 | # endif 44 | 45 | -#elif BOOST_OS_LINUX && defined(SYS_getrandom) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) && !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM) 46 | +#elif defined(BOOST_UUID_RANDOM_PROVIDER_HAS_GETRANDOM) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) && !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM) 47 | # define BOOST_UUID_RANDOM_PROVIDER_GETRANDOM 48 | # define BOOST_UUID_RANDOM_PROVIDER_NAME getrandom 49 | 50 | -------------------------------------------------------------------------------- /patches/boost_1_69_0_no_epoll_create1_on_api19.patch: -------------------------------------------------------------------------------- 1 | From acc075deed54b1178db6d215a2764230b59c11be Mon Sep 17 00:00:00 2001 2 | From: Dmitry Kalita 3 | Date: Mon, 14 Oct 2019 16:34:22 +0300 4 | Subject: [PATCH] Don't use epoll_create1() on android preAPI21 5 | 6 | See: 7 | https://svn.boost.org/trac10/ticket/12863 8 | https://github.com/android/ndk/issues/395 9 | --- 10 | 1.69.0/boost/asio/detail/impl/epoll_reactor.ipp | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/1.69.0/boost/asio/detail/impl/epoll_reactor.ipp b/1.69.0/boost/asio/detail/impl/epoll_reactor.ipp 14 | index b1e1b39d0..e896ff48e 100644 15 | --- a/1.69.0/boost/asio/detail/impl/epoll_reactor.ipp 16 | +++ b/1.69.0/boost/asio/detail/impl/epoll_reactor.ipp 17 | @@ -575,7 +575,7 @@ void epoll_reactor::interrupt() 18 | 19 | int epoll_reactor::do_epoll_create() 20 | { 21 | -#if defined(EPOLL_CLOEXEC) 22 | +#if defined(EPOLL_CLOEXEC) && (!defined(__ANDROID_API__ ) || __ANDROID_API__ >= 21) 23 | int fd = epoll_create1(EPOLL_CLOEXEC); 24 | #else // defined(EPOLL_CLOEXEC) 25 | int fd = -1; 26 | -- 27 | 2.21.0 (Apple Git-122) 28 | 29 | -------------------------------------------------------------------------------- /patches/boost_1_71_0_no_epoll_create1_on_api19.patch: -------------------------------------------------------------------------------- 1 | From acc075deed54b1178db6d215a2764230b59c11be Mon Sep 17 00:00:00 2001 2 | From: Dmitry Kalita 3 | Date: Mon, 14 Oct 2019 16:34:22 +0300 4 | Subject: [PATCH] Don't use epoll_create1() on android preAPI21 5 | 6 | See: 7 | https://svn.boost.org/trac10/ticket/12863 8 | https://github.com/android/ndk/issues/395 9 | --- 10 | 1.71.0/boost/asio/detail/impl/epoll_reactor.ipp | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/1.71.0/boost/asio/detail/impl/epoll_reactor.ipp b/1.71.0/boost/asio/detail/impl/epoll_reactor.ipp 14 | index b1e1b39d0..e896ff48e 100644 15 | --- a/1.71.0/boost/asio/detail/impl/epoll_reactor.ipp 16 | +++ b/1.71.0/boost/asio/detail/impl/epoll_reactor.ipp 17 | @@ -575,7 +575,7 @@ void epoll_reactor::interrupt() 18 | 19 | int epoll_reactor::do_epoll_create() 20 | { 21 | -#if defined(EPOLL_CLOEXEC) 22 | +#if defined(EPOLL_CLOEXEC) && (!defined(__ANDROID_API__ ) || __ANDROID_API__ >= 21) 23 | int fd = epoll_create1(EPOLL_CLOEXEC); 24 | #else // defined(EPOLL_CLOEXEC) 25 | int fd = -1; 26 | -- 27 | 2.21.0 (Apple Git-122) 28 | 29 | -------------------------------------------------------------------------------- /patches/boost_1_71_0_undef_nil.patch: -------------------------------------------------------------------------------- 1 | From: Berkus Karchebnyy 2 | Date: Wed, 11 Dec 2019 19:49:11 +0300 3 | Subject: [PATCH] #undef nil for boost.msm 4 | 5 | See: 6 | https://github.com/boostorg/msm/commit/6adfc03233fec380da38a56963454ca76dc75150 7 | 8 | diff --git a/1.71.0/boost/msm/back/state_machine.hpp b/1.71.0/boost/msm/back/state_machine.hpp 9 | --- a/1.71.0/boost/msm/back/state_machine.hpp 10 | +++ b/1.71.0/boost/msm/back/state_machine.hpp 11 | @@ -1576,7 +1576,7 @@ 12 | void set_states(Expr const& expr) 13 | { 14 | ::boost::fusion::for_each( 15 | - ::boost::fusion::as_vector(FoldToList()(expr, boost::fusion::nil())),update_state(this->m_substate_list)); 16 | + ::boost::fusion::as_vector(FoldToList()(expr, boost::fusion::nil_())),update_state(this->m_substate_list)); 17 | } 18 | 19 | // Construct with the default initial states 20 | -------------------------------------------------------------------------------- /patches/boost_1_72_0_fix_beast_partial_deflate_block.patch: -------------------------------------------------------------------------------- 1 | Backporting fixes for when a received deflate block spans multiple multi_byte character arrays when inflated. 2 | Reference: https://github.com/boostorg/beast/pull/2191 3 | 4 | --- a/1.73.0/boost/beast/websocket/impl/read.hpp 2021-03-17 15:42:22.000000000 -0700 5 | +++ b/1.73.0/boost/beast/websocket/impl/read.hpp 2021-03-18 14:31:12.000000000 -0700 6 | @@ -471,6 +471,7 @@ 7 | zs.avail_out = out.size(); 8 | BOOST_ASSERT(zs.avail_out > 0); 9 | } 10 | + bool fin = false; 11 | if(impl.rd_remain > 0) 12 | { 13 | if(impl.rd_buf.size() > 0) 14 | @@ -490,22 +491,11 @@ 15 | else if(impl.rd_fh.fin) 16 | { 17 | // append the empty block codes 18 | - std::uint8_t constexpr 19 | + static std::uint8_t constexpr 20 | empty_block[4] = { 0x00, 0x00, 0xff, 0xff }; 21 | zs.next_in = empty_block; 22 | zs.avail_in = sizeof(empty_block); 23 | - impl.inflate(zs, zlib::Flush::sync, ec); 24 | - if(! ec) 25 | - { 26 | - // https://github.com/madler/zlib/issues/280 27 | - if(zs.total_out > 0) 28 | - ec = error::partial_deflate_block; 29 | - } 30 | - if(impl.check_stop_now(ec)) 31 | - goto upcall; 32 | - impl.do_context_takeover_read(impl.role); 33 | - impl.rd_done = true; 34 | - break; 35 | + fin = true; 36 | } 37 | else 38 | { 39 | @@ -514,6 +504,13 @@ 40 | impl.inflate(zs, zlib::Flush::sync, ec); 41 | if(impl.check_stop_now(ec)) 42 | goto upcall; 43 | + if(fin) 44 | + if(zs.total_out == 0) 45 | + { 46 | + impl.do_context_takeover_read(impl.role); 47 | + impl.rd_done = true; 48 | + break; 49 | + } 50 | if(impl.rd_msg_max && beast::detail::sum_exceeds( 51 | impl.rd_size, zs.total_out, impl.rd_msg_max)) 52 | { 53 | @@ -524,8 +521,11 @@ 54 | } 55 | cb_.consume(zs.total_out); 56 | impl.rd_size += zs.total_out; 57 | - impl.rd_remain -= zs.total_in; 58 | - impl.rd_buf.consume(zs.total_in); 59 | + if(! fin) 60 | + { 61 | + impl.rd_remain -= zs.total_in; 62 | + impl.rd_buf.consume(zs.total_in); 63 | + } 64 | bytes_written_ += zs.total_out; 65 | } 66 | if(impl.rd_op == detail::opcode::text) 67 | @@ -1165,6 +1165,7 @@ 68 | zs.avail_out = out.size(); 69 | BOOST_ASSERT(zs.avail_out > 0); 70 | } 71 | + bool fin = false; 72 | if(impl.rd_remain > 0) 73 | { 74 | if(impl.rd_buf.size() > 0) 75 | @@ -1208,22 +1209,10 @@ 76 | { 77 | // append the empty block codes 78 | static std::uint8_t constexpr 79 | - empty_block[4] = { 80 | - 0x00, 0x00, 0xff, 0xff }; 81 | + empty_block[4] = { 0x00, 0x00, 0xff, 0xff }; 82 | zs.next_in = empty_block; 83 | zs.avail_in = sizeof(empty_block); 84 | - impl.inflate(zs, zlib::Flush::sync, ec); 85 | - if(! ec) 86 | - { 87 | - // https://github.com/madler/zlib/issues/280 88 | - if(zs.total_out > 0) 89 | - ec = error::partial_deflate_block; 90 | - } 91 | - if(impl.check_stop_now(ec)) 92 | - return bytes_written; 93 | - impl.do_context_takeover_read(impl.role); 94 | - impl.rd_done = true; 95 | - break; 96 | + fin = true; 97 | } 98 | else 99 | { 100 | @@ -1232,6 +1221,13 @@ 101 | impl.inflate(zs, zlib::Flush::sync, ec); 102 | if(impl.check_stop_now(ec)) 103 | return bytes_written; 104 | + if(fin) 105 | + if(zs.total_out == 0) 106 | + { 107 | + impl.do_context_takeover_read(impl.role); 108 | + impl.rd_done = true; 109 | + break; 110 | + } 111 | if(impl.rd_msg_max && beast::detail::sum_exceeds( 112 | impl.rd_size, zs.total_out, impl.rd_msg_max)) 113 | { 114 | @@ -1241,8 +1237,11 @@ 115 | } 116 | cb.consume(zs.total_out); 117 | impl.rd_size += zs.total_out; 118 | - impl.rd_remain -= zs.total_in; 119 | - impl.rd_buf.consume(zs.total_in); 120 | + if(! fin) 121 | + { 122 | + impl.rd_remain -= zs.total_in; 123 | + impl.rd_buf.consume(zs.total_in); 124 | + } 125 | bytes_written += zs.total_out; 126 | } 127 | if(impl.rd_op == detail::opcode::text) 128 | -------------------------------------------------------------------------------- /patches/boost_1_72_0_fix_coroutine.patch: -------------------------------------------------------------------------------- 1 | From 436e1dbe6fcd31523d261d18ad011392f1d6fbbc Mon Sep 17 00:00:00 2001 2 | From: Oliver Kowalke 3 | Date: Sun, 1 Dec 2019 20:40:28 +0100 4 | Subject: [PATCH] Revert "Cease dependence on Range" 5 | 6 | This reverts commit 0c556bb59241e682bbcd3f572815149c5a9b17db. 7 | 8 | see #44 (One test fails to compile after boostorg/coroutine submodule updated) 9 | --- 10 | boost/coroutine/asymmetric_coroutine.hpp | 12 +++--------- 11 | 1 file changed, 3 insertions(+), 9 deletions(-) 12 | 13 | diff --git a/1.72.0/boost/coroutine/asymmetric_coroutine.hpp b/1.72.0/boost/coroutine/asymmetric_coroutine.hpp 14 | index ea96981..640896f 100644 15 | --- a/1.72.0/boost/coroutine/asymmetric_coroutine.hpp 16 | +++ b/1.72.0/boost/coroutine/asymmetric_coroutine.hpp 17 | @@ -14,6 +14,7 @@ 18 | #include 19 | #include 20 | #include 21 | +#include 22 | #include 23 | #include 24 | 25 | @@ -2354,19 +2355,12 @@ end( push_coroutine< R > & c) 26 | 27 | } 28 | 29 | -// forward declaration of Boost.Range traits to break dependency on it 30 | -template 31 | -struct range_mutable_iterator; 32 | - 33 | -template 34 | -struct range_const_iterator; 35 | - 36 | template< typename Arg > 37 | -struct range_mutable_iterator< coroutines::push_coroutine< Arg >, void > 38 | +struct range_mutable_iterator< coroutines::push_coroutine< Arg > > 39 | { typedef typename coroutines::push_coroutine< Arg >::iterator type; }; 40 | 41 | template< typename R > 42 | -struct range_mutable_iterator< coroutines::pull_coroutine< R >, void > 43 | +struct range_mutable_iterator< coroutines::pull_coroutine< R > > 44 | { typedef typename coroutines::pull_coroutine< R >::iterator type; }; 45 | 46 | } 47 | -- 48 | 2.24.1 49 | 50 | -------------------------------------------------------------------------------- /patches/boost_1_73_0_fix_beast_partial_deflate_block.patch: -------------------------------------------------------------------------------- 1 | Backporting fixes for when a received deflate block spans multiple multi_byte character arrays when inflated. 2 | Reference: https://github.com/boostorg/beast/pull/2191 3 | 4 | --- a/1.73.0/boost/beast/websocket/impl/read.hpp 2021-03-17 15:42:22.000000000 -0700 5 | +++ b/1.73.0/boost/beast/websocket/impl/read.hpp 2021-03-18 14:31:12.000000000 -0700 6 | @@ -471,6 +471,7 @@ 7 | zs.avail_out = out.size(); 8 | BOOST_ASSERT(zs.avail_out > 0); 9 | } 10 | + bool fin = false; 11 | if(impl.rd_remain > 0) 12 | { 13 | if(impl.rd_buf.size() > 0) 14 | @@ -490,22 +491,11 @@ 15 | else if(impl.rd_fh.fin) 16 | { 17 | // append the empty block codes 18 | - std::uint8_t constexpr 19 | + static std::uint8_t constexpr 20 | empty_block[4] = { 0x00, 0x00, 0xff, 0xff }; 21 | zs.next_in = empty_block; 22 | zs.avail_in = sizeof(empty_block); 23 | - impl.inflate(zs, zlib::Flush::sync, ec); 24 | - if(! ec) 25 | - { 26 | - // https://github.com/madler/zlib/issues/280 27 | - if(zs.total_out > 0) 28 | - ec = error::partial_deflate_block; 29 | - } 30 | - if(impl.check_stop_now(ec)) 31 | - goto upcall; 32 | - impl.do_context_takeover_read(impl.role); 33 | - impl.rd_done = true; 34 | - break; 35 | + fin = true; 36 | } 37 | else 38 | { 39 | @@ -514,6 +504,13 @@ 40 | impl.inflate(zs, zlib::Flush::sync, ec); 41 | if(impl.check_stop_now(ec)) 42 | goto upcall; 43 | + if(fin) 44 | + if(zs.total_out == 0) 45 | + { 46 | + impl.do_context_takeover_read(impl.role); 47 | + impl.rd_done = true; 48 | + break; 49 | + } 50 | if(impl.rd_msg_max && beast::detail::sum_exceeds( 51 | impl.rd_size, zs.total_out, impl.rd_msg_max)) 52 | { 53 | @@ -524,8 +521,11 @@ 54 | } 55 | cb_.consume(zs.total_out); 56 | impl.rd_size += zs.total_out; 57 | - impl.rd_remain -= zs.total_in; 58 | - impl.rd_buf.consume(zs.total_in); 59 | + if(! fin) 60 | + { 61 | + impl.rd_remain -= zs.total_in; 62 | + impl.rd_buf.consume(zs.total_in); 63 | + } 64 | bytes_written_ += zs.total_out; 65 | } 66 | if(impl.rd_op == detail::opcode::text) 67 | @@ -1165,6 +1165,7 @@ 68 | zs.avail_out = out.size(); 69 | BOOST_ASSERT(zs.avail_out > 0); 70 | } 71 | + bool fin = false; 72 | if(impl.rd_remain > 0) 73 | { 74 | if(impl.rd_buf.size() > 0) 75 | @@ -1208,22 +1209,10 @@ 76 | { 77 | // append the empty block codes 78 | static std::uint8_t constexpr 79 | - empty_block[4] = { 80 | - 0x00, 0x00, 0xff, 0xff }; 81 | + empty_block[4] = { 0x00, 0x00, 0xff, 0xff }; 82 | zs.next_in = empty_block; 83 | zs.avail_in = sizeof(empty_block); 84 | - impl.inflate(zs, zlib::Flush::sync, ec); 85 | - if(! ec) 86 | - { 87 | - // https://github.com/madler/zlib/issues/280 88 | - if(zs.total_out > 0) 89 | - ec = error::partial_deflate_block; 90 | - } 91 | - if(impl.check_stop_now(ec)) 92 | - return bytes_written; 93 | - impl.do_context_takeover_read(impl.role); 94 | - impl.rd_done = true; 95 | - break; 96 | + fin = true; 97 | } 98 | else 99 | { 100 | @@ -1232,6 +1221,13 @@ 101 | impl.inflate(zs, zlib::Flush::sync, ec); 102 | if(impl.check_stop_now(ec)) 103 | return bytes_written; 104 | + if(fin) 105 | + if(zs.total_out == 0) 106 | + { 107 | + impl.do_context_takeover_read(impl.role); 108 | + impl.rd_done = true; 109 | + break; 110 | + } 111 | if(impl.rd_msg_max && beast::detail::sum_exceeds( 112 | impl.rd_size, zs.total_out, impl.rd_msg_max)) 113 | { 114 | @@ -1241,8 +1237,11 @@ 115 | } 116 | cb.consume(zs.total_out); 117 | impl.rd_size += zs.total_out; 118 | - impl.rd_remain -= zs.total_in; 119 | - impl.rd_buf.consume(zs.total_in); 120 | + if(! fin) 121 | + { 122 | + impl.rd_remain -= zs.total_in; 123 | + impl.rd_buf.consume(zs.total_in); 124 | + } 125 | bytes_written += zs.total_out; 126 | } 127 | if(impl.rd_op == detail::opcode::text) 128 | -------------------------------------------------------------------------------- /patches/xcode-11.4.patch: -------------------------------------------------------------------------------- 1 | From 40960b23338da0a359d6aa83585ace09ad8804d2 Mon Sep 17 00:00:00 2001 2 | From: Bo Anderson 3 | Date: Sun, 29 Mar 2020 14:55:08 +0100 4 | Subject: [PATCH] Fix compiler version check on macOS 5 | 6 | Fixes #440. 7 | --- 8 | src/tools/darwin.jam | 5 +++-- 9 | 1 file changed, 3 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/src/tools/darwin.jam b/src/tools/darwin.jam 12 | index 8d477410b0..97e7ecb851 100644 13 | --- a/src/tools/darwin.jam 14 | +++ b/src/tools/darwin.jam 15 | @@ -137,13 +137,14 @@ rule init ( version ? : command * : options * : requirement * ) 16 | # - Set the toolset generic common options. 17 | common.handle-options darwin : $(condition) : $(command) : $(options) ; 18 | 19 | + real-version = [ regex.split $(real-version) \\. ] ; 20 | # - GCC 4.0 and higher in Darwin does not have -fcoalesce-templates. 21 | - if $(real-version) < "4.0.0" 22 | + if [ version.version-less $(real-version) : 4 0 ] 23 | { 24 | flags darwin.compile.c++ OPTIONS $(condition) : -fcoalesce-templates ; 25 | } 26 | # - GCC 4.2 and higher in Darwin does not have -Wno-long-double. 27 | - if $(real-version) < "4.2.0" 28 | + if [ version.version-less $(real-version) : 4 2 ] 29 | { 30 | flags darwin.compile OPTIONS $(condition) : -Wno-long-double ; 31 | } 32 | --------------------------------------------------------------------------------