├── .gitignore ├── Makefile ├── README.md ├── boost.sh ├── boost_153.sh └── boost_154.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # git ignore 2 | src/ 3 | *.tar.bz2 4 | *.zip 5 | build/ 6 | ios/ 7 | osx/ 8 | bak/ 9 | dist/ 10 | *.log 11 | release/ 12 | *.sublime-project 13 | *.sublime-workspace 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | # make boost framework, utilizing boost.sh 3 | 4 | # --- 5 | # Commands 6 | ECHO = echo 7 | 8 | # --- 9 | # Help 10 | help: 11 | @$(ECHO) "--> This is just a stub, not yet implemented. <--" 12 | @$(ECHO) "Targets:" 13 | @$(ECHO) "TODO:\t\t\t- " 14 | @$(ECHO) "help\t\t\t- display this message" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Build Boost Framework for iOS & OSX 2 | ===== 3 | ###### Using Xcode5 (armv7, armv7s, arm64, i386, x86_64) 4 | 5 | > For a better way to build the framework using `Makefile` checkout [makefile](https://github.com/mgrebenets/boost-xcode5-iosx/tree/makefile) branch of this repository. 6 | 7 | ### Boost Source 8 | Script will download source code tarball if it isn't available in the root directory. 9 | 10 | * [boost downloads](http://www.boost.org/users/download/) 11 | * [1.53.0](https://sourceforge.net/projects/boost/files/boost/1.53.0/) 12 | * [1.54.0](https://sourceforge.net/projects/boost/files/boost/1.54.0/) 13 | * [1.55.0](https://sourceforge.net/projects/boost/files/boost/1.55.0/) - untested! 14 | 15 | You may get the sources manually as well. The script is expecting `bz2` tarball. Put the tarball in the same folder with `boost.sh`. 16 | 17 | Make sure you keep the tarball name unchanged, so it is like `boost_1_53_0.tar.bz2`. 18 | 19 | ### Build 20 | Use `boost.sh` to build boost framework. 21 | Run `boost.sh -h` to get help message. 22 | 23 | Set `BOOST_LIBS` environment variable with list of libraries that you need. 24 | By default the script will build `serialization`, `thread`, `system` and `locale` for demo project. 25 | 26 | Examples: 27 | 28 | # clean build version 1.53.0 for ios and osx with c++11 29 | # libraries: thread, system and locale 30 | BOOST_LIBS="thread system locale" ./boost.sh clean --with-c++11 -v 1.53.0 31 | 32 | # build version 1.54.0 for ios and osx without c++11, no clean 33 | # libraries: system only 34 | BOOST_LIBS="system" ./boost.sh --version 1.54.0 35 | 36 | ## Troubleshooting 37 | ### Undefined symbols link error 38 | If you use libraries like `serialization` you might see link errors in Xcode 5 especially when the framework was built using `--with-c++11` flag. 39 | 40 | Undefined symbols for architecture i386: 41 | "std::__1::__vector_base_common::__throw_length_error() const", referenced from: 42 | void std::__1::vector >::__push_back_slow_path(boost::archive::detail::basic_iarchive_impl::cobject_id&&) in boost(libboost_serialization_basic_iarchive.o) 43 | 44 | You have to change your project or target build settings. 45 | 46 | Under *Apple LLVM 5.0 - Language - C++* make the following changes 47 | 48 | * *C++ Language Dialect* set to *C++11 [-std=c++11]* 49 | * *C++ Standard Library* set to *libc++ (LLVM C++ standard library with C++11 support)* 50 | 51 | ### Parse errors when including `boost/type_traits.hpp` 52 | If you happen to include `` header file, you may see compile errors like this 53 | 54 | Unexpected member name of ';' after declaration specifiers 55 | 56 | To fix this problem, include the following line in your porject `***-Prefix.pch` file. 57 | 58 | #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 59 | 60 | ## Header-Only Libraries 61 | Most of the boost libraries are header-only, meaning you only need to include header files to make them work. 62 | However, there is a [list of libraries](http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html#header-only-libraries) that need to be built for your target platform. 63 | Check the link above and modify `BOOST_LIBS` in `boost.sh` to include or exclude the libraries for your project. 64 | 65 | ## Notes and Changes 66 | ### `ar` for Simulator Dev Tools 67 | In Xcode 5 there's no `ar` excutable in `SIM_DEV_DIR` so using `/usr/bin/ar` instead. 68 | 69 | ## Demo 70 | Check out [this demo project](https://github.com/mgrebenets/boost-xcode5-demo) for some examples. 71 | 72 | ## Why not Using Cocoapods? 73 | I tried to use [cocoapods spec for boost](https://github.com/CocoaPods/Specs/tree/master/boost). 74 | However, there's a number of things that made me to switch to using framework instead. 75 | * It doesn't include all the subspecs you might need for development 76 | * It takes really long time to update every time you run `pod update` or `pod install` (given that you have modified `Podfile`) 77 | * The tarball is downloaded (50+ mb) 78 | * The tarball is unpacked 79 | * There's podspec for 1.51.0 only 80 | * You can't use the Pod if you need libraries like `serialization` 81 | * `serialization` has to be linked as a library, it doesn't work like the rest of the boost libraries by just including hpp headers inline. It needs to be compiled for your target platform. 82 | 83 | ## References and Attribution 84 | This repo is practially a fork of https://github.com/wuhao5/boost. 85 | Only this one does not contain boost source code, thus is more lightweight. 86 | 87 | The script mentioned above in it's turn is based on great work by Pete Goodliffe 88 | 89 | * https://gitorious.org/boostoniphone 90 | * http://goodliffe.blogspot.com.au/2010/09/building-boost-framework-for-ios-iphone.html 91 | * http://goodliffe.blogspot.com.au/2009/12/boost-on-iphone.html 92 | 93 | And lots of contributions by other people. 94 | -------------------------------------------------------------------------------- /boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #=============================================================================== 4 | # Filename: boost.sh 5 | # Author: Pete Goodliffe 6 | # Copyright: (c) Copyright 2009 Pete Goodliffe 7 | # Licence: Please feel free to use this, with attribution 8 | # Modified version 9 | #=============================================================================== 10 | # 11 | # Builds a Boost framework for the iPhone. 12 | # Creates a set of universal libraries that can be used on an iPhone and in the 13 | # iPhone simulator. Then creates a pseudo-framework to make using boost in Xcode 14 | # less painful. 15 | # 16 | # To configure the script, define: 17 | # BOOST_LIBS: which libraries to build 18 | # IPHONE_SDKVERSION: iPhone SDK version (e.g. 5.1) 19 | # 20 | # Then go get the source tar.bz of the boost you want to build, shove it in the 21 | # same directory as this script, and run "./boost.sh". Grab a cuppa. And voila. 22 | #=============================================================================== 23 | 24 | # Arguments 25 | # download - not yet implemented 26 | # clean 27 | # --with-c++11 - Compile using Clang, std=c++11 and stdlib=libc++ 28 | # not yet implemented - build ios or osx only 29 | 30 | DOWNLOAD=0 31 | CLEAN=0 32 | CXX_FLAGS="" 33 | CXX_LINK_FLAGS="" 34 | VERSION="" 35 | BUILD_IOS=1 36 | BUILD_OSX=1 37 | 38 | usage () { 39 | echo "Usage: $(basename $0) [clean] [download] [-h|--help] [--with-c++11] -v|--version VERSION" 1>&2 40 | echo "Options:" 1>&2 41 | echo -e "\t-h, --help\t\t\tPrint complete usage." 1>&2 42 | echo -e "\tclean\t\t\t\tPerform clean build." 1>&2 43 | echo -e "\tdownload\t\t\tDownload tarball (if doesn't exist)." 1>&2 44 | echo -e "\t--with-c++11\t\t\tCompile using Clang, std=c++11 and stdlib=libc++." 1>&2 45 | echo -e "\t-v, --version VERSION\t\tVersion to build. Make sure you have boost_.tar.bz2 downloaded and ready." 1>&2 46 | exit 2 47 | } 48 | 49 | while [ "$1" != "" ]; do 50 | case $1 in 51 | --with-c++11 ) CXX_FLAGS="-std=c++11 -stdlib=libc++" 52 | CXX_LINK_FLAGS="-stdlib=libc++" 53 | ;; 54 | clean ) CLEAN=1 55 | ;; 56 | download ) DOWNLOAD=1 57 | ;; 58 | -v | --version ) shift 59 | VERSION=$1 60 | ;; 61 | -h | --help ) usage 62 | exit 63 | ;; 64 | * ) usage 65 | exit 1 66 | esac 67 | # next arg 68 | shift 69 | done 70 | 71 | # Version is mandatory 72 | [ -z $VERSION ] && usage 73 | 74 | echo "BOOST_LIBS: $BOOST_LIBS" 75 | 76 | # these libraries must be built for target platform 77 | # : ${BOOST_LIBS:="chrono context filesystem graph_parallel iostreams locale mpi program_options python regex serialization signals system thread timer wave"} 78 | # try to pick up BOOST_LIBS from environment variable first 79 | # if it's empty, then build with serialization thread system for a demo 80 | [[ -z "$BOOST_LIBS" ]] && BOOST_LIBS="serialization thread system" 81 | 82 | # : ${BOOST_LIBS:="serialization"} 83 | # : ${BOOST_LIBS:="atomic chrono date_time exception filesystem graph graph_parallel iostreams locale mpi program_options python random regex serialization signals system test thread timer wave"} 84 | #atomic chrono 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 wave 85 | : ${IPHONE_SDKVERSION:=$(xcodebuild -showsdks | grep iphoneos | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1)} 86 | : ${OSX_SDKVERSION:=$(xcodebuild -showsdks | grep macosx | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1)} 87 | : ${XCODE_ROOT:=$(xcode-select -print-path)} 88 | : ${XCODE_TOOLCHAIN_BIN:="$XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin"} 89 | : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS $CXX_FLAGS"} 90 | 91 | # The EXTRA_CPPFLAGS definition works around a thread race issue in 92 | # shared_ptr. I encountered this historically and have not verified that 93 | # the fix is no longer required. Without using the posix thread primitives 94 | # an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the 95 | # shared_ptr use count causing nasty and subtle bugs. 96 | # 97 | # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS 98 | 99 | : ${TARBALLDIR:=$(pwd)} 100 | : ${SRCDIR:=$(pwd)/src} 101 | : ${IOSBUILDDIR:=$(pwd)/ios/build} 102 | : ${OSXBUILDDIR:=$(pwd)/osx/build} 103 | : ${PREFIXDIR:=$(pwd)/ios/prefix} 104 | : ${IOSFRAMEWORKDIR:=$(pwd)/ios/framework} 105 | : ${OSXFRAMEWORKDIR:=$(pwd)/osx/framework} 106 | : ${COMPILER:="clang++"} 107 | 108 | BOOST_SRC=$SRCDIR/boost 109 | : ${BOOST_VERSION:=$VERSION} 110 | BOOST_VERSION_SFX=${BOOST_VERSION//./_} 111 | 112 | BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION_SFX.tar.bz2 113 | BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION_SFX} 114 | 115 | #=============================================================================== 116 | 117 | IPHONE_OS_PLATFORM_PATH=$(xcrun --sdk iphoneos --show-sdk-platform-path) 118 | ARM_DEV_DIR=$IPHONE_OS_PLATFORM_PATH/Developer/usr/bin 119 | IPHONE_OS_SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-path) 120 | 121 | IPHONE_SIMULATOR_PLATFORM_PATH=$(xcrun --sdk iphonesimulator --show-sdk-platform-path) 122 | SIM_DEV_DIR=$IPHONE_SIMULATOR_PLATFORM_PATH/Developer/usr/bin 123 | IPHONE_SIMULATOR_SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path) 124 | 125 | ARM_COMBINED_LIB=$IOSBUILDDIR/lib_boost_arm.a 126 | SIM_COMBINED_LIB=$IOSBUILDDIR/lib_boost_x86.a 127 | 128 | #=============================================================================== 129 | 130 | 131 | #=============================================================================== 132 | # Functions 133 | #=============================================================================== 134 | 135 | abort() 136 | { 137 | echo 138 | echo "Aborted: $@" 139 | exit 1 140 | } 141 | 142 | doneSection() 143 | { 144 | echo 145 | echo " =================================================================" 146 | echo " Done" 147 | echo 148 | } 149 | 150 | #=============================================================================== 151 | 152 | cleanEverythingReadyToStart() 153 | { 154 | echo Cleaning everything before we start to build... 155 | rm -rf iphone-build iphonesim-build osx-build 156 | rm -rf $BOOST_SRC 157 | rm -rf $IOSBUILDDIR 158 | rm -rf $OSXBUILDDIR 159 | rm -rf $PREFIXDIR 160 | rm -rf $IOSFRAMEWORKDIR/$FRAMEWORK_NAME.framework 161 | rm -rf $OSXFRAMEWORKDIR/$FRAMEWORK_NAME.framework 162 | doneSection 163 | } 164 | 165 | #=============================================================================== 166 | downloadBoost() 167 | { 168 | if [ ! -s $BOOST_TARBALL ]; then 169 | echo Downloading boost $BOOST_TARBALL... 170 | curl -L -o $BOOST_TARBALL http://sourceforge.net/projects/boost/files/boost/$VERSION/$BOOST_TARBALL/download 171 | fi 172 | doneSection 173 | } 174 | 175 | #=============================================================================== 176 | unpackBoost() 177 | { 178 | echo Unpacking boost into $SRCDIR... 179 | [ -e $BOOST_TARBALL ] || ( echo "No such file: $BOOST_TARBALL"; abort ) 180 | [ -d $SRCDIR ] || mkdir -p $SRCDIR 181 | [ -d $BOOST_SRC ] || ( cd $SRCDIR; tar xfj $BOOST_TARBALL ) 182 | [ -d $BOOST_SRC ] && echo " ...unpacked as $BOOST_SRC" 183 | doneSection 184 | } 185 | 186 | #=============================================================================== 187 | restoreBoost() 188 | { 189 | cp $BOOST_SRC/tools/build/v2/user-config.jam-bk $SRCDIR/tools/build/v2/user-config.jam 190 | } 191 | 192 | writeBjamUserConfig() 193 | { 194 | echo Updating boost into $BOOST_SRC... 195 | 196 | # armv6 version 197 | # using darwin : ${IPHONE_SDKVERSION}~iphone 198 | # : $XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/$COMPILER -arch armv6 -arch armv7 -arch armv7s -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS 199 | # : $XCODE_ROOT/Platforms/iPhoneOS.platform/Developer 200 | # : arm iphone 201 | # ; 202 | 203 | # use sed to cut stuff if it's already there to avoid duplicated entries 204 | sed -i.bak '/# BOOST/,$d' $BOOST_SRC/tools/build/v2/user-config.jam 205 | 206 | cp $BOOST_SRC/tools/build/v2/user-config.jam $BOOST_SRC/tools/build/v2/user-config.jam-bk 207 | cat >> $BOOST_SRC/tools/build/v2/user-config.jam < $IPHONE_OS_PLATFORM_PATH/Developer 212 | : arm iphone 213 | ; 214 | using darwin : ${IPHONE_SDKVERSION}~iphonesim 215 | : $XCODE_TOOLCHAIN_BIN/$COMPILER -arch i386 -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS 216 | : $IPHONE_SIMULATOR_PLATFORM_PATH/Developer 217 | : x86 iphone 218 | ; 219 | EOF 220 | 221 | doneSection 222 | } 223 | 224 | #=============================================================================== 225 | 226 | inventMissingHeaders() 227 | { 228 | # These files are missing in the ARM iPhoneOS SDK, but they are in the simulator. 229 | # They are supported on the device, so we copy them from x86 SDK to a staging area 230 | # to use them on ARM, too. 231 | echo "Invent missing headers" 232 | cp $IPHONE_SIMULATOR_SDK_PATH/usr/include/{crt_externs,bzlib,iconv}.h $BOOST_SRC 233 | } 234 | 235 | #=============================================================================== 236 | 237 | bootstrapBoost() 238 | { 239 | cd $BOOST_SRC 240 | BOOST_LIBS_COMMA=$(echo $BOOST_LIBS | sed -e "s/ /,/g") 241 | echo "Bootstrapping (with libs $BOOST_LIBS_COMMA)" 242 | ./bootstrap.sh --with-libraries=$BOOST_LIBS_COMMA 243 | doneSection 244 | } 245 | 246 | #=============================================================================== 247 | 248 | buildBoost() 249 | { 250 | cd $BOOST_SRC 251 | 252 | # Install this one so we can copy the includes for the frameworks... 253 | # Build for iOS Device 254 | ./bjam -j16 --build-dir=iphone-build --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin architecture=arm target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static stage 255 | ./bjam -j16 --build-dir=iphone-build --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin architecture=arm target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static install 256 | 257 | # ./bjam -j16 --build-dir=iphone-build --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin-${IPHONE_SDKVERSION}~iphonesim architecture=arm target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static stage 258 | # ./bjam -j16 --build-dir=iphone-build --stagedir=iphone-build/stage --prefix=$PREFIXDIR toolset=darwin-${IPHONE_SDKVERSION}~iphonesim architecture=arm target-os=iphone macosx-version=iphone-${IPHONE_SDKVERSION} define=_LITTLE_ENDIAN link=static install 259 | doneSection 260 | 261 | # Build for iOS Simulator 262 | ./bjam -j16 --build-dir=iphonesim-build --stagedir=iphonesim-build/stage --toolset=darwin-${IPHONE_SDKVERSION}~iphonesim architecture=x86 target-os=iphone macosx-version=iphonesim-${IPHONE_SDKVERSION} link=static stage 263 | doneSection 264 | 265 | # Build for OSX 266 | LINK_FLAGS_ARG="" 267 | [[ -n "$CXX_LINK_FLAGS" ]] && LINK_FLAGS_ARG="linkflags=$CXX_LINK_FLAGS" 268 | ./b2 -j16 --build-dir=osx-build --stagedir=osx-build/stage toolset=clang cxxflags="-arch i386 -arch x86_64 $CXX_FLAGS" $LINK_FLAGS_ARG link=static threading=multi stage 269 | doneSection 270 | } 271 | 272 | #=============================================================================== 273 | unpackArchive() 274 | { 275 | BUILDDIR=$1 276 | ARCH=$2 277 | NAME=$3 278 | 279 | echo "Unpacking $NAME from $BUILDDIR" 280 | 281 | mkdir -p $BUILDDIR/$ARCH/obj/$NAME 282 | #remove all trash in folder if exists 283 | rm $BUILDDIR/$ARCH/obj/$NAME/*.o 284 | rm $BUILDDIR/$ARCH/obj/$NAME/*.SYMDEF* 285 | 286 | ( 287 | cd $BUILDDIR/$ARCH/obj/$NAME; ar -x ../../$NAME.a; 288 | for FILE in *.o; do 289 | NEW_FILE="${NAME}_${FILE}" 290 | mv $FILE $NEW_FILE 291 | done 292 | ); 293 | } 294 | 295 | #=============================================================================== 296 | 297 | scrunchAllLibsTogetherInOneLibPerPlatform() 298 | { 299 | cd $BOOST_SRC 300 | 301 | # mkdir -p $IOSBUILDDIR/armv6/obj 302 | mkdir -p $IOSBUILDDIR/armv7/obj 303 | mkdir -p $IOSBUILDDIR/armv7s/obj 304 | mkdir -p $IOSBUILDDIR/arm64/obj 305 | mkdir -p $IOSBUILDDIR/i386/obj 306 | mkdir -p $IOSBUILDDIR/x86_64/obj 307 | 308 | mkdir -p $OSXBUILDDIR/i386/obj 309 | mkdir -p $OSXBUILDDIR/x86_64/obj 310 | 311 | ALL_LIBS="" 312 | 313 | echo Splitting all existing fat binaries... 314 | for NAME in $BOOST_LIBS; do 315 | LIB=libboost_$NAME 316 | ALL_LIBS="$ALL_LIBS $LIB" 317 | LIB_A=$LIB.a 318 | 319 | # $ARM_DEV_DIR/lipo "iphone-build/stage/lib/$LIB_A" -thin armv6 -o $IOSBUILDDIR/armv6/$LIB_A 320 | $ARM_DEV_DIR/lipo "iphone-build/stage/lib/$LIB_A" -thin armv7 -o $IOSBUILDDIR/armv7/$LIB_A 321 | $ARM_DEV_DIR/lipo "iphone-build/stage/lib/$LIB_A" -thin armv7s -o $IOSBUILDDIR/armv7s/$LIB_A 322 | $ARM_DEV_DIR/lipo "iphone-build/stage/lib/$LIB_A" -thin arm64 -o $IOSBUILDDIR/arm64/$LIB_A 323 | 324 | 325 | $ARM_DEV_DIR/lipo "osx-build/stage/lib/$LIB_A" -thin i386 -o $IOSBUILDDIR/i386/$LIB_A 326 | $ARM_DEV_DIR/lipo "osx-build/stage/lib/$LIB_A" -thin x86_64 -o $IOSBUILDDIR/x86_64/$LIB_A 327 | 328 | # cp "iphonesim-build/stage/lib/$LIB_A" $IOSBUILDDIR/i386/ 329 | # cp "iphonesim-build/stage/lib/$LIB_A" $IOSBUILDDIR/x86_64/ 330 | 331 | $ARM_DEV_DIR/lipo "osx-build/stage/lib/$LIB_A" -thin i386 -o $OSXBUILDDIR/i386/$LIB_A 332 | $ARM_DEV_DIR/lipo "osx-build/stage/lib/$LIB_A" -thin x86_64 -o $OSXBUILDDIR/x86_64/$LIB_A 333 | done 334 | 335 | echo "Decomposing each architecture's .a files" 336 | for NAME in $ALL_LIBS; do 337 | echo "Decomposing ${NAME}.a..." 338 | unpackArchive $IOSBUILDDIR armv7 $NAME 339 | unpackArchive $IOSBUILDDIR armv7s $NAME 340 | unpackArchive $IOSBUILDDIR arm64 $NAME 341 | unpackArchive $IOSBUILDDIR i386 $NAME 342 | unpackArchive $IOSBUILDDIR x86_64 $NAME 343 | 344 | unpackArchive $OSXBUILDDIR i386 $NAME 345 | unpackArchive $OSXBUILDDIR x86_64 $NAME 346 | done 347 | 348 | echo "Linking each architecture into an uberlib ($ALL_LIBS => libboost.a )" 349 | ls $IOSBUILDDIR/* 350 | rm $IOSBUILDDIR/*/libboost.a 351 | ls $OSXBUILDDIR/* 352 | rm $OSXBUILDDIR/*/libboost.a 353 | for NAME in $ALL_LIBS; do 354 | # echo ...armv6 355 | # (cd $IOSBUILDDIR/armv6; $ARM_DEV_DIR/ar crus libboost.a obj/$NAME/*.o; ) 356 | echo ...armv7 357 | (cd $IOSBUILDDIR/armv7; $ARM_DEV_DIR/ar crus libboost.a obj/$NAME/*.o; ) 358 | echo ...armv7s 359 | (cd $IOSBUILDDIR/armv7s; $ARM_DEV_DIR/ar crus libboost.a obj/$NAME/*.o; ) 360 | echo ...arm64 361 | (cd $IOSBUILDDIR/arm64; $ARM_DEV_DIR/ar crus libboost.a obj/$NAME/*.o; ) 362 | echo ...i386 363 | (cd $IOSBUILDDIR/i386; ar crus libboost.a obj/$NAME/*.o; ) 364 | echo ...x86_64 365 | (cd $IOSBUILDDIR/x86_64; ar crus libboost.a obj/$NAME/*.o; ) 366 | 367 | echo ...osx-i386 368 | (cd $OSXBUILDDIR/i386; ar crus libboost.a obj/$NAME/*.o; ) 369 | echo ...osx-x86_64 370 | (cd $OSXBUILDDIR/x86_64; ar crus libboost.a obj/$NAME/*.o; ) 371 | done 372 | } 373 | 374 | #=============================================================================== 375 | 376 | # $1: Name of a boost library to lipoficate (technical term) 377 | lipoficate() 378 | { 379 | : ${1:?} 380 | NAME=$1 381 | echo lipoficate: $1 382 | 383 | mkdir -p $PREFIXDIR/lib 384 | $ARM_DEV_DIR/lipo -create $IOSBUILDDIR/*/libboost.a -o "$PREFIXDIR/lib/libboost_$NAME.a" || abort "Lipo $1 failed" 385 | } 386 | 387 | # This creates universal versions of each individual boost library 388 | lipoAllBoostLibraries() 389 | { 390 | for i in $BOOST_LIBS; do lipoficate $i; done; 391 | doneSection 392 | } 393 | 394 | #=============================================================================== 395 | buildFramework() 396 | { 397 | : ${1:?} 398 | FRAMEWORKDIR=$1 399 | BUILDDIR=$2 400 | 401 | VERSION_TYPE=Alpha 402 | FRAMEWORK_NAME=boost 403 | FRAMEWORK_VERSION=A 404 | 405 | FRAMEWORK_CURRENT_VERSION=$BOOST_VERSION 406 | FRAMEWORK_COMPATIBILITY_VERSION=$BOOST_VERSION 407 | 408 | FRAMEWORK_BUNDLE=$FRAMEWORKDIR/$FRAMEWORK_NAME.framework 409 | echo "Framework: Building $FRAMEWORK_BUNDLE from $BUILDDIR..." 410 | 411 | rm -rf $FRAMEWORK_BUNDLE 412 | 413 | echo "Framework: Setting up directories..." 414 | mkdir -p $FRAMEWORK_BUNDLE 415 | mkdir -p $FRAMEWORK_BUNDLE/Versions 416 | mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION 417 | mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Resources 418 | mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Headers 419 | mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Documentation 420 | 421 | echo "Framework: Creating symlinks..." 422 | ln -s $FRAMEWORK_VERSION $FRAMEWORK_BUNDLE/Versions/Current 423 | ln -s Versions/Current/Headers $FRAMEWORK_BUNDLE/Headers 424 | ln -s Versions/Current/Resources $FRAMEWORK_BUNDLE/Resources 425 | ln -s Versions/Current/Documentation $FRAMEWORK_BUNDLE/Documentation 426 | ln -s Versions/Current/$FRAMEWORK_NAME $FRAMEWORK_BUNDLE/$FRAMEWORK_NAME 427 | 428 | FRAMEWORK_INSTALL_NAME=$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/$FRAMEWORK_NAME 429 | 430 | echo "Lipoing library into $FRAMEWORK_INSTALL_NAME..." 431 | $ARM_DEV_DIR/lipo -create $BUILDDIR/*/libboost.a -o "$FRAMEWORK_INSTALL_NAME" || abort "Lipo $1 failed" 432 | 433 | echo "Framework: Copying includes..." 434 | cp -r $PREFIXDIR/include/boost/* $FRAMEWORK_BUNDLE/Headers/ 435 | 436 | echo "Framework: Creating plist..." 437 | cat > $FRAMEWORK_BUNDLE/Resources/Info.plist < 439 | 440 | 441 | 442 | CFBundleDevelopmentRegion 443 | English 444 | CFBundleExecutable 445 | ${FRAMEWORK_NAME} 446 | CFBundleIdentifier 447 | org.boost 448 | CFBundleInfoDictionaryVersion 449 | 6.0 450 | CFBundlePackageType 451 | FMWK 452 | CFBundleSignature 453 | ???? 454 | CFBundleVersion 455 | ${FRAMEWORK_CURRENT_VERSION} 456 | 457 | 458 | EOF 459 | doneSection 460 | } 461 | 462 | #=============================================================================== 463 | # Execution starts here 464 | #=============================================================================== 465 | 466 | #BOOST_VERSION=`svn info $BOOST_SRC | grep URL | sed -e 's/^.*\/Boost_\([^\/]*\)/\1/'` 467 | echo "BOOST_VERSION: $BOOST_VERSION" 468 | echo "BOOST_VERSION_SFX: $BOOST_VERSION_SFX" 469 | echo "BOOST_LIBS: $BOOST_LIBS" 470 | echo "SRCDIR: $SRCDIR" 471 | echo "BOOST_SRC: $BOOST_SRC" 472 | echo "IOSBUILDDIR: $IOSBUILDDIR" 473 | echo "OSXBUILDDIR: $OSXBUILDDIR" 474 | echo "PREFIXDIR: $PREFIXDIR" 475 | echo "IOSFRAMEWORKDIR: $IOSFRAMEWORKDIR" 476 | echo "OSXFRAMEWORKDIR: $OSXFRAMEWORKDIR" 477 | echo "IPHONE_SDKVERSION: $IPHONE_SDKVERSION" 478 | echo "XCODE_ROOT: $XCODE_ROOT" 479 | echo "COMPILER: $COMPILER" 480 | echo "CXX_FLAGS: $CXX_FLAGS" 481 | echo "CXX_LINK_FLAGS: $CXX_LINK_FLAGS" 482 | echo "CLEAN: $CLEAN" 483 | echo "BUILD_IOS: $BUILD_IOS" 484 | echo "BUILD_OSX: $BUILD_OSX" 485 | echo 486 | 487 | [[ $DOWNLOAD -eq 1 ]] && downloadBoost 488 | [[ $CLEAN -eq 1 ]] && cleanEverythingReadyToStart 489 | unpackBoost 490 | inventMissingHeaders 491 | bootstrapBoost 492 | writeBjamUserConfig 493 | buildBoost 494 | scrunchAllLibsTogetherInOneLibPerPlatform 495 | # lipoAllBoostLibraries 496 | [[ $BUILD_IOS -eq 1 ]] && buildFramework $IOSFRAMEWORKDIR $IOSBUILDDIR 497 | [[ $BUILD_OSX -eq 1 ]] && buildFramework $OSXFRAMEWORKDIR $OSXBUILDDIR 498 | 499 | # restoreBoost 500 | echo "Completed successfully" 501 | 502 | #=============================================================================== 503 | -------------------------------------------------------------------------------- /boost_153.sh: -------------------------------------------------------------------------------- 1 | ./boost.sh --version 1.53.0 --with-c++11 2 | -------------------------------------------------------------------------------- /boost_154.sh: -------------------------------------------------------------------------------- 1 | ./boost.sh --version 1.54.0 --with-c++11 2 | --------------------------------------------------------------------------------