-
-
Save mhaylock/2889d081525e589c7cae to your computer and use it in GitHub Desktop.
Revisions
-
mhaylock revised this gist
Oct 29, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -169,6 +169,8 @@ parseArgs() if [ -n $2 ]; then BOOST_VERSION=$2 BOOST_VERSION2="${BOOST_VERSION//./_}" BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION2.tar.bz2 BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION2} shift else missingParameter $1 @@ -250,9 +252,9 @@ cleanup() downloadBoost() { if [ ! -s $BOOST_TARBALL ]; then echo "Downloading boost ${BOOST_VERSION}" curl -L -o $BOOST_TARBALL \ http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION2}.tar.bz2/download fi -
faithfracture renamed this gist
Sep 22, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
faithfracture revised this gist
Sep 22, 2015 . 2 changed files with 374 additions and 135 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,9 @@ -- 2015-09-22 UPDATE -- Added command line args! You can now specify if you want to build just for iOS or OS X, along with some other things. Run boost.sh -h for more info. Let me know if there are any other parameters that you think would be useful. -- 2015-09-18 UPDATE -- Fixed script for iOS Simulator (Thanks @XMitja!) • There is now a MIN_IOS_VERSION variable. Make sure you set this appropriately. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,40 +6,43 @@ # Modified version #=============================================================================== # # Builds a Boost framework for iOS, iOS Simulator, and OSX. # Creates a set of universal libraries that can be used on an iOS and in the # iOS simulator. Then creates a pseudo-framework to make using boost in Xcode # less painful. # # To configure the script, define: # BOOST_VERSION: Which version of Boost to build (e.g. 1.58.0) # BOOST_VERSION2: Same as BOOST_VERSION, but with _ instead of . (e.g. 1_58_0) # BOOST_LIBS: Which Boost libraries to build # MIN_IOS_VERSION: Minimum iOS Target Version (e.g. 8.0) # IOS_SDK_VERSION: iOS SDK version (e.g. 9.0) # OSX_SDK_VERSION: OSX SDK version (e.g. 10.11) # # If a boost tarball does not exist in the current directory, this script will # attempt to download the version specified by BOOST_VERSION. You may also # manually place a matching tarball in the current directory and the script # will use that. # #=============================================================================== BOOST_LIBS="atomic chrono date_time exception filesystem program_options random signals system test thread" BUILD_IOS= BUILD_OSX= CLEAN= NO_CLEAN= NO_FRAMEWORK= BOOST_VERSION=1.58.0 BOOST_VERSION2=1_58_0 MIN_IOS_VERSION=8.0 IOS_SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | \ egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1` OSX_SDK_VERSION=`xcodebuild -showsdks | grep macosx | \ egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1` XCODE_ROOT=`xcode-select -print-path` # The EXTRA_CPPFLAGS definition works around a thread race issue in # shared_ptr. I encountered this historically and have not verified that @@ -48,19 +51,20 @@ # shared_ptr use count causing nasty and subtle bugs. # # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS EXTRA_CPPFLAGS="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG \ -std=c++11 -stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden" EXTRA_IOS_CPPFLAGS="$EXTRA_CPPFLAGS -mios-version-min=$MIN_IOS_VERSION" EXTRA_OSX_CPPFLAGS="$EXTRA_CPPFLAGS" TARBALLDIR=`pwd` SRCDIR=$TARBALLDIR/src IOSOUTPUTDIR=$TARBALLDIR/ios OSXOUTPUTDIR=$TARBALLDIR/osx IOSBUILDDIR=$IOSOUTPUTDIR/build OSXBUILDDIR=$OSXOUTPUTDIR/build PREFIXDIR=$IOSOUTPUTDIR/prefix IOSFRAMEWORKDIR=$IOSOUTPUTDIR/framework OSXFRAMEWORKDIR=$OSXOUTPUTDIR/framework BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION2.tar.bz2 BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION2} @@ -73,13 +77,152 @@ OSX_DEV_CMD="xcrun --sdk macosx" # Functions #=============================================================================== usage() { cat << EOF usage: $0 options Build Boost for iOS, iOS Simulator, and OS X OPTIONS: -h, -\? | --help Display these options and exit. --boost-version Specify which version of Boost to build. Defaults to $BOOST_VERSION. -ios Build for the iOS platform. May be used in conjunction with -osx. If neither -ios nor -osx are specified, both are built. -osx Build for the OS X platform. May be used in conjunction with -ios. If neither -ios nor -osx are specified, both are built. --ios-sdk [num] Specify the iOS SDK version to build with. Defaults to $IOS_SDK_VERSION. --min-ios-version [num] Specify the minimum iOS version to target. Defaults to $MIN_IOS_VERSION. --osx-sdk [num] Specify the OS X SDK version to build with. Defaults to $OSX_SDK_VERSION. --no-framework Do not create the framework. --clean Just clean up build artifacts, but don't actually build anything. --no-clean Do not clean up existing build artifacts before building. EOF } abort() { echo echo "Aborted: $@" exit 1 } die() { usage exit 1 } missingParameter() { echo $1 requires a parameter die } unknownParameter() { if [[ -n $2 && $2 != "" ]]; then echo Unknown argument \"$2\" for parameter $1. else echo Unknown argument $1 fi die } parseArgs() { while [ "$1" != "" ]; do case $1 in -h | -\?) usage exit ;; -ios) BUILD_IOS=1 ;; -osx) BUILD_OSX=1 ;; --boost-version) if [ -n $2 ]; then BOOST_VERSION=$2 BOOST_VERSION2="${BOOST_VERSION//./_}" shift else missingParameter $1 fi ;; --ios-sdk) if [ -n $2 ]; then IOS_SDK_VERSION=$2 shift else missingParameter $1 fi ;; --min-ios-version) if [ -n $2 ]; then MIN_IOS_VERSION=$2 shift else missingParameter $1 fi ;; --osx-sdk) if [ -n $2 ]; then OSX_SDK_VERSION=$2 shift else missingParameter $1 fi ;; --clean) CLEAN=1 ;; --no-clean) NO_CLEAN=1 ;; --no-framework) NO_FRAMEWORK=1 ;; *) unknownParameter $1 ;; esac shift done } doneSection() { echo @@ -92,9 +235,11 @@ doneSection() cleanup() { echo Cleaning everything rm -rf $BOOST_SRC/iphone-build rm -rf $BOOST_SRC/iphonesim-build rm -rf $BOOST_SRC/osx-build rm -rf $IOSOUTPUTDIR rm -rf $OSXOUTPUTDIR @@ -107,7 +252,8 @@ downloadBoost() { if [ ! -s $TARBALLDIR/boost_${BOOST_VERSION2}.tar.bz2 ]; then echo "Downloading boost ${BOOST_VERSION}" curl -L -o $TARBALLDIR/boost_${BOOST_VERSION2}.tar.bz2 \ http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION2}.tar.bz2/download fi doneSection @@ -130,9 +276,14 @@ unpackBoost() #=============================================================================== inventMissingHeaders() { # These files are missing in the ARM iPhoneOS SDK, but they are in the simulator. # They are supported on the device, so we copy them from x86 SDK to a staging area # to use them on ARM, too. echo Invent missing headers cp $XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk/usr/include/{crt_externs,bzlib}.h $BOOST_SRC } #=============================================================================== @@ -143,41 +294,37 @@ updateBoost() mv $BOOST_SRC/tools/build/src/user-config.jam $BOOST_SRC/tools/build/src/user-config.jam-bk if [[ -n $BUILD_IOS ]]; then cat >> $BOOST_SRC/tools/build/src/user-config.jam <<EOF using darwin : ${IOS_SDK_VERSION}~iphone : $XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 \ -arch armv7s -arch arm64 $EXTRA_IOS_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer : <architecture>arm <target-os>iphone ; using darwin : ${IOS_SDK_VERSION}~iphonesim : g++ -arch i386 -arch x86_64 $EXTRA_IOS_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer : <architecture>x86 <target-os>iphone ; EOF fi if [[ -n $BUILD_OSX ]]; then cat >> $BOOST_SRC/tools/build/src/user-config.jam <<EOF using darwin : ${OSX_SDK_VERSION} : g++ -arch i386 -arch x86_64 $EXTRA_OSX_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/MacOSX.platform/Developer : <architecture>x86 <target-os>darwin ; EOF fi doneSection } #=============================================================================== bootstrapBoost() { cd $BOOST_SRC @@ -195,19 +342,47 @@ buildBoost() { cd $BOOST_SRC if [[ -n $BUILD_IOS ]]; then echo Building Boost for iPhone # Install this one so we can copy the headers for the frameworks... ./b2 -j16 --build-dir=iphone-build --stagedir=iphone-build/stage \ --prefix=$PREFIXDIR toolset=darwin architecture=arm target-os=iphone \ macosx-version=iphone-${IOS_SDK_VERSION} define=_LITTLE_ENDIAN \ link=static stage ./b2 -j16 --build-dir=iphone-build --stagedir=iphone-build/stage \ --prefix=$PREFIXDIR toolset=darwin architecture=arm \ target-os=iphone macosx-version=iphone-${IOS_SDK_VERSION} \ define=_LITTLE_ENDIAN link=static install doneSection echo Building Boost for iPhoneSimulator ./b2 -j16 --build-dir=iphonesim-build --stagedir=iphonesim-build/stage \ toolset=darwin-${IOS_SDK_VERSION}~iphonesim architecture=x86 \ target-os=iphone macosx-version=iphonesim-${IOS_SDK_VERSION} \ link=static stage doneSection fi if [[ -n $BUILD_OSX ]]; then echo building Boost for OSX ./b2 -j16 --build-dir=osx-build --stagedir=osx-build/stage toolset=clang \ cxxflags="-std=c++11 -stdlib=libc++ -arch i386 -arch x86_64" \ linkflags="-stdlib=libc++" link=static threading=multi \ macosx-version=${OSX_SDK_VERSION} stage # If we are only building for OS X and we are outputting a framework, # then we need to install this one so we can copy the headers if [[ -z $BUILD_IOS && -z $NO_FRAMEWORK ]]; then PREFIXDIR=$OSXBUILDDIR/prefix ./b2 -j16 --build-dir=osx-build --stagedir=osx-build/stage \ --prefix=$PREFIXDIR toolset=clang \ cxxflags="-std=c++11 -stdlib=libc++ -arch i386 -arch x86_64" \ linkflags="-stdlib=libc++" link=static threading=multi \ macosx-version=${OSX_SDK_VERSION} install fi doneSection fi } #=============================================================================== @@ -219,9 +394,12 @@ unpackArchive() echo "Unpacking $LIBNAME" if [[ -d $BUILDDIR/$LIBNAME ]]; then rm $BUILDDIR/$LIBNAME/*.o rm $BUILDDIR/$LIBNAME/*.SYMDEF* else mkdir -p $BUILDDIR/$LIBNAME fi ( cd $BUILDDIR/$NAME; ar -x ../../libboost_$NAME.a; @@ -236,18 +414,22 @@ scrunchAllLibsTogetherInOneLibPerPlatform() { cd $BOOST_SRC if [[ -n $BUILD_IOS ]]; then # iOS Device mkdir -p $IOSBUILDDIR/armv7/obj mkdir -p $IOSBUILDDIR/armv7s/obj mkdir -p $IOSBUILDDIR/arm64/obj # iOS Simulator mkdir -p $IOSBUILDDIR/i386/obj mkdir -p $IOSBUILDDIR/x86_64/obj fi if [[ -n $BUILD_OSX ]]; then # OSX mkdir -p $OSXBUILDDIR/i386/obj mkdir -p $OSXBUILDDIR/x86_64/obj fi ALL_LIBS="" @@ -260,15 +442,26 @@ scrunchAllLibsTogetherInOneLibPerPlatform() ALL_LIBS="$ALL_LIBS libboost_$NAME.a" if [[ -n $BUILD_IOS ]]; then $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" \ -thin armv7 -o $IOSBUILDDIR/armv7/libboost_$NAME.a $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" \ -thin armv7s -o $IOSBUILDDIR/armv7s/libboost_$NAME.a $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" \ -thin arm64 -o $IOSBUILDDIR/arm64/libboost_$NAME.a $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" \ -thin i386 -o $IOSBUILDDIR/i386/libboost_$NAME.a $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" \ -thin x86_64 -o $IOSBUILDDIR/x86_64/libboost_$NAME.a fi if [[ -n $BUILD_OSX ]]; then $OSX_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" \ -thin i386 -o $OSXBUILDDIR/i386/libboost_$NAME.a $OSX_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" \ -thin x86_64 -o $OSXBUILDDIR/x86_64/libboost_$NAME.a fi done echo "Decomposing each architecture's .a files" @@ -279,20 +472,28 @@ scrunchAllLibsTogetherInOneLibPerPlatform() fi echo "Decomposing libboost_${NAME}.a" if [[ -n $BUILD_IOS ]]; then unpackArchive "$IOSBUILDDIR/armv7/obj" $NAME unpackArchive "$IOSBUILDDIR/armv7s/obj" $NAME unpackArchive "$IOSBUILDDIR/arm64/obj" $NAME unpackArchive "$IOSBUILDDIR/i386/obj" $NAME unpackArchive "$IOSBUILDDIR/x86_64/obj" $NAME fi if [[ -n $BUILD_OSX ]]; then unpackArchive "$OSXBUILDDIR/i386/obj" $NAME unpackArchive "$OSXBUILDDIR/x86_64/obj" $NAME fi done echo "Linking each architecture into an uberlib ($ALL_LIBS => libboost.a )" if [[ -n $BUILD_IOS ]]; then rm $IOSBUILDDIR/*/libboost.a fi if [[ -n $BUILD_OSX ]]; then rm $OSXBUILDDIR/*/libboost.a fi for NAME in $BOOST_LIBS; do if [ "$NAME" == "test" ]; then @@ -301,22 +502,26 @@ scrunchAllLibsTogetherInOneLibPerPlatform() echo $NAME if [[ -n $BUILD_IOS ]]; then echo ...armv7 (cd $IOSBUILDDIR/armv7; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...armv7s (cd $IOSBUILDDIR/armv7s; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...arm64 (cd $IOSBUILDDIR/arm64; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...i386 (cd $IOSBUILDDIR/i386; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...x86_64 (cd $IOSBUILDDIR/x86_64; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) fi if [[ -n $BUILD_OSX ]]; then echo ...osx-i386 (cd $OSXBUILDDIR/i386; $OSX_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...osx-x86_64 (cd $OSXBUILDDIR/x86_64; $OSX_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) fi done } @@ -389,39 +594,67 @@ EOF doneSection } #=============================================================================== restoreBoost() { cp $BOOST_SRC/tools/build/src/user-config.jam-bk $BOOST_SRC/tools/build/src/user-config.jam } #=============================================================================== # Execution starts here #=============================================================================== parseArgs $@ if [ -n "$CLEAN" ]; then cleanup exit fi if [[ -z $BUILD_IOS && -z $BUILD_OSX ]]; then BUILD_IOS=1 BUILD_OSX=1 fi format="%-20s %s\n" printf "$format" "BUILD_IOS:" $( [[ -n $BUILD_IOS ]] && echo "YES" || echo "NO") printf "$format" "BUILD_OSX:" $( [[ -n $BUILD_OSX ]] && echo "YES" || echo "NO") printf "$format" "BOOST_VERSION:" $BOOST_VERSION printf "$format" "IOS_SDK_VERSION:" $IOS_SDK_VERSION printf "$format" "OSX_SDK_VERSION:" $OSX_SDK_VERSION printf "$format" "MIN_IOS_VERSION:" $MIN_IOS_VERSION printf "$format" "BOOST_LIBS:" "$BOOST_LIBS" printf "$format" "BOOST_SRC:" $BOOST_SRC printf "$format" "IOSBUILDDIR:" $IOSBUILDDIR printf "$format" "OSXBUILDDIR:" $OSXBUILDDIR printf "$format" "PREFIXDIR:" $PREFIXDIR printf "$format" "IOSFRAMEWORKDIR:" $IOSFRAMEWORKDIR printf "$format" "OSXFRAMEWORKDIR:" $OSXFRAMEWORKDIR printf "$format" "XCODE_ROOT:" $XCODE_ROOT echo if [ -z $NO_CLEAN ]; then cleanup fi downloadBoost unpackBoost inventMissingHeaders bootstrapBoost updateBoost buildBoost scrunchAllLibsTogetherInOneLibPerPlatform if [ -z $NO_FRAMEWORK ]; then if [[ -n $BUILD_IOS ]]; then buildFramework $IOSFRAMEWORKDIR $IOSBUILDDIR fi if [[ -n $BUILD_OSX ]]; then buildFramework $OSXFRAMEWORKDIR $OSXBUILDDIR fi fi restoreBoost echo "Completed successfully" -
faithfracture revised this gist
Sep 18, 2015 . 2 changed files with 56 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,11 @@ #=============================================================================== # Filename: boost.sh # Author: Pete Goodliffe # Copyright: (c) Copyright 2009 Pete Goodliffe # Licence: Please feel free to use this, with attribution # Modified version #=============================================================================== # # Builds a Boost framework for the iPhone, iPhone Simulator, and OSX. # Creates a set of universal libraries that can be used on an iPhone and in the # iPhone simulator. Then creates a pseudo-framework to make using boost in Xcode @@ -10,25 +18,28 @@ # # Then go get the source tar.bz of the boost you want to build, shove it in the # same directory as this script, and run "./boost.sh". Grab a cuppa. And voila. # #=============================================================================== : ${BOOST_VERSION:=1.58.0} : ${BOOST_VERSION2:=1_58_0} : ${BOOST_LIBS:="atomic chrono date_time exception filesystem program_options random signals system test thread"} # Minimum IOS target version. : ${MIN_IOS_VERSION:=8.0} # Current iPhone SDK : ${IPHONE_SDKVERSION:=`xcodebuild -showsdks | grep iphoneos | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`} # Specific iPhone SDK # : ${IPHONE_SDKVERSION:=9.0} # Current OSX SDK : ${OSX_SDKVERSION:=`xcodebuild -showsdks | grep macosx | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`} # Specific OSX SDK # : ${OSX_SDKVERSION:=10.10} : ${XCODE_ROOT:=`xcode-select -print-path`} # The EXTRA_CPPFLAGS definition works around a thread race issue in # shared_ptr. I encountered this historically and have not verified that @@ -37,19 +48,23 @@ # shared_ptr use count causing nasty and subtle bugs. # # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG -std=c++11 -stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden"} : ${EXTRA_IOS_CPPFLAGS:="$EXTRA_CPPFLAGS -mios-version-min=$MIN_IOS_VERSION"} : ${EXTRA_OSX_CPPFLAGS:="$EXTRA_CPPFLAGS"} : ${TARBALLDIR:=`pwd`} : ${SRCDIR:=$TARBALLDIR/src} : ${IOSOUTPUTDIR:=$TARBALLDIR/ios} : ${OSXOUTPUTDIR:=$TARBALLDIR/osx} : ${IOSBUILDDIR:=$IOSOUTPUTDIR/build} : ${OSXBUILDDIR:=$OSXOUTPUTDIR/build} : ${PREFIXDIR:=$IOSOUTPUTDIR/prefix} : ${IOSFRAMEWORKDIR:=$IOSOUTPUTDIR/framework} : ${OSXFRAMEWORKDIR:=$OSXOUTPUTDIR/framework} BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION2.tar.bz2 BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION2} ARM_DEV_CMD="xcrun --sdk iphoneos" SIM_DEV_CMD="xcrun --sdk iphonesimulator" OSX_DEV_CMD="xcrun --sdk macosx" @@ -68,23 +83,20 @@ abort() doneSection() { echo echo "Done" echo "=================================================================" echo } #=============================================================================== cleanup() { echo Cleaning everything before we start to build... rm -rf $BOOST_SRC/iphone-build $BOOST_SRC/iphonesim-build $BOOST_SRC/osx-build rm -rf $IOSOUTPUTDIR rm -rf $OSXOUTPUTDIR doneSection } @@ -129,21 +141,21 @@ updateBoost() { echo Updating boost into $BOOST_SRC... mv $BOOST_SRC/tools/build/src/user-config.jam $BOOST_SRC/tools/build/src/user-config.jam-bk cat >> $BOOST_SRC/tools/build/src/user-config.jam <<EOF using darwin : ${IPHONE_SDKVERSION}~iphone : $XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -arch armv7s -arch arm64 $EXTRA_IOS_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer : <architecture>arm <target-os>iphone ; using darwin : ${IPHONE_SDKVERSION}~iphonesim : g++ -arch i386 -arch x86_64 $EXTRA_IOS_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer : <architecture>x86 <target-os>iphone ; using darwin : ${OSX_SDKVERSION} : g++ -arch i386 -arch x86_64 $EXTRA_OSX_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/MacOSX.platform/Developer : <architecture>x86 <target-os>darwin ; @@ -179,7 +191,7 @@ bootstrapBoost() #=============================================================================== buildBoost() { cd $BOOST_SRC @@ -381,21 +393,20 @@ EOF # Execution starts here #=============================================================================== # may want to comment if repeatedly running during dev cleanup echo "BOOST_VERSION: $BOOST_VERSION" echo "IPHONE_SDKVERSION: $IPHONE_SDKVERSION" echo "OSX_SDKVERSION: $OSX_SDKVERSION" echo "MIN_IOS_VERSION: $MIN_IOS_VERSION" echo "BOOST_LIBS: $BOOST_LIBS" echo "BOOST_SRC: $BOOST_SRC" echo "IOSBUILDDIR: $IOSBUILDDIR" echo "OSXBUILDDIR: $OSXBUILDDIR" echo "PREFIXDIR: $PREFIXDIR" echo "IOSFRAMEWORKDIR: $IOSFRAMEWORKDIR" echo "OSXFRAMEWORKDIR: $OSXFRAMEWORKDIR" echo "XCODE_ROOT: $XCODE_ROOT" echo @@ -404,7 +415,7 @@ unpackBoost inventMissingHeaders bootstrapBoost updateBoost buildBoost scrunchAllLibsTogetherInOneLibPerPlatform buildFramework $IOSFRAMEWORKDIR $IOSBUILDDIR buildFramework $OSXFRAMEWORKDIR $OSXBUILDDIR This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,17 @@ -- 2015-09-18 UPDATE -- Fixed script for iOS Simulator (Thanks @XMitja!) • There is now a MIN_IOS_VERSION variable. Make sure you set this appropriately. cleanup function now actually removes all build artifacts Fixed updateBoost function to move the existing user-config.jam instead of copying it. Copying it resulted in writing duplicate entries each time the script was run. NOTE: Currently does not build with bitcode. I will figure that one out when I get time. I'm at the cusp of a product release though, so it might be a little while. Just disable bitcode for your project for the time being. -- 2015-08-26 UPDATE -- The resulting libraries from this script are currently not working for the iOS simulator under Xcode 7 as of beta 6. I have an issue opened -
faithfracture revised this gist
Aug 27, 2015 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,9 @@ -- 2015-08-26 UPDATE -- The resulting libraries from this script are currently not working for the iOS simulator under Xcode 7 as of beta 6. I have an issue opened with Apple about this. It does still work for physical devices though. As soon as I figure out what the problem is, I will post an update. -- 2014-12-29 UPDATE -- Updated to work with Boost 1.56, 1.57, and 1.58 -
faithfracture revised this gist
Jul 10, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ -- 2014-12-29 UPDATE -- Updated to work with Boost 1.56, 1.57, and 1.58 Automatically choose the currently selected SDK for both iOS and OSX -
faithfracture revised this gist
Dec 29, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,8 @@ This is a modified version of Pete Goodliffe's original boost.sh build script, The original version didn't work with the 64-bit iPhone Simulator, and didn't build at all for OSX. This works for Boost 1.56 and 1.57. If you need the version that builds 1.55 and older, use this revision: https://gist.github.com/faithfracture/c629ae4c7168216a9856/61be257e1c0839c85743777d0687becad9913bf7 I also ran into an issue where utf8_codecvt_facet.o existed in both the program_options and filesystem libraries. When linking against the -
faithfracture revised this gist
Dec 29, 2014 . 2 changed files with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ # : ${OSX_SDKVERSION:=10.10} : ${XCODE_ROOT:=`xcode-select -print-path`} : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG -std=c++11 -stdlib=libc++"} # The EXTRA_CPPFLAGS definition works around a thread race issue in # shared_ptr. I encountered this historically and have not verified that This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ -- 2014-12-29 UPDATE -- Updated to work with Boost 1.56+ (works with both 1.56 and 1.57 so far) Automatically choose the currently selected SDK for both iOS and OSX Fixed a couple places where the wrong $XXX_DEV_CMD was being used -- END UPDATE -- This is a modified version of Pete Goodliffe's original boost.sh build script, (and a couple of other sources whom I can't remember) -
faithfracture revised this gist
Dec 29, 2014 . 2 changed files with 35 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,34 @@ # Builds a Boost framework for the iPhone, iPhone Simulator, and OSX. # Creates a set of universal libraries that can be used on an iPhone and in the # iPhone simulator. Then creates a pseudo-framework to make using boost in Xcode # less painful. # # To configure the script, define: # BOOST_LIBS: which libraries to build # IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1) # OSX_SDKVERSION: OSX SDK version (e.g. 10.10) # # Then go get the source tar.bz of the boost you want to build, shove it in the # same directory as this script, and run "./boost.sh". Grab a cuppa. And voila. #=============================================================================== : ${BOOST_VERSION:=1.56.0} : ${BOOST_VERSION2:=1_56_0} : ${BOOST_LIBS:="atomic chrono date_time exception filesystem program_options random signals system test thread"} # Current iPhone SDK : ${IPHONE_SDKVERSION:=`xcodebuild -showsdks | grep iphoneos | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`} # Specific iPhone SDK # : ${IPHONE_SDKVERSION:=8.1} # Current OSX SDK : ${OSX_SDKVERSION:=`xcodebuild -showsdks | grep macosx | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`} # Specific OSX SDK # : ${OSX_SDKVERSION:=10.10} : ${XCODE_ROOT:=`xcode-select -print-path`} : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREAD -DBOOST_SP_USE_PTHREAD -g -DNDEBUG -std=c++11 -stdlib=libc++"} # The EXTRA_CPPFLAGS definition works around a thread race issue in # shared_ptr. I encountered this historically and have not verified that @@ -33,9 +46,6 @@ : ${IOSFRAMEWORKDIR:=`pwd`/ios/framework} : ${OSXFRAMEWORKDIR:=`pwd`/osx/framework} BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION2.tar.bz2 BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION2} @@ -110,7 +120,7 @@ unpackBoost() restoreBoost() { cp $BOOST_SRC/tools/build/src/user-config.jam-bk $BOOST_SRC/tools/build/src/user-config.jam } #=============================================================================== @@ -119,9 +129,9 @@ updateBoost() { echo Updating boost into $BOOST_SRC... cp $BOOST_SRC/tools/build/src/user-config.jam $BOOST_SRC/tools/build/src/user-config.jam-bk cat >> $BOOST_SRC/tools/build/src/user-config.jam <<EOF using darwin : ${IPHONE_SDKVERSION}~iphone : $XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -arch armv7s -arch arm64 -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer @@ -245,8 +255,8 @@ scrunchAllLibsTogetherInOneLibPerPlatform() $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" -thin i386 -o $IOSBUILDDIR/i386/libboost_$NAME.a $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" -thin x86_64 -o $IOSBUILDDIR/x86_64/libboost_$NAME.a $OSX_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" -thin i386 -o $OSXBUILDDIR/i386/libboost_$NAME.a $OSX_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" -thin x86_64 -o $OSXBUILDDIR/x86_64/libboost_$NAME.a done echo "Decomposing each architecture's .a files" @@ -270,7 +280,8 @@ scrunchAllLibsTogetherInOneLibPerPlatform() echo "Linking each architecture into an uberlib ($ALL_LIBS => libboost.a )" rm $IOSBUILDDIR/*/libboost.a rm $OSXBUILDDIR/*/libboost.a for NAME in $BOOST_LIBS; do if [ "$NAME" == "test" ]; then NAME="unit_test_framework" @@ -290,11 +301,10 @@ scrunchAllLibsTogetherInOneLibPerPlatform() echo ...x86_64 (cd $IOSBUILDDIR/x86_64; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...osx-i386 (cd $OSXBUILDDIR/i386; $OSX_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...osx-x86_64 (cd $OSXBUILDDIR/x86_64; $OSX_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) done } @@ -403,4 +413,4 @@ restoreBoost echo "Completed successfully" #=============================================================================== This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,11 @@ -- 2014-12-29 UPDATE -- Automatically choose the currently selected SDK for both iOS and OSX Updated updateBoost() to work with Boost 1.56+ (works with both 1.56 and 1.57 so far) This is a modified version of Pete Goodliffe's original boost.sh build script, (and a couple of other sources whom I can't remember) -
Jordan Bondo revised this gist
Oct 28, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,8 @@ This is a modified version of Pete Goodliffe's original boost.sh build script, The original version didn't work with the 64-bit iPhone Simulator, and didn't build at all for OSX. This works for Boost 1.55 and I haven't built any other versions. I do know that this will not build 1.56 at this point. I also ran into an issue where utf8_codecvt_facet.o existed in both the program_options and filesystem libraries. When linking against the framework, there was a missing vtable entry for it. Adding the step -
Jordan Bondo revised this gist
Jul 29, 2014 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ This is a modified version of Pete Goodliffe's original boost.sh build script, (and a couple of other sources whom I can't remember) The original version didn't work with the 64-bit iPhone Simulator, and didn't build at all for OSX. I also ran into an issue where utf8_codecvt_facet.o existed in both the program_options and filesystem libraries. When linking against the framework, there was a missing vtable entry for it. Adding the step in unpackArchive() that prepends the library name to the .o files prevents this error. I hope this keeps at least one other person from ripping their hair out. Let me know if you find errors or have optimizations. I will be updating this as often as necessary. -
Jordan Bondo created this gist
Jul 29, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,406 @@ # Builds a Boost framework for the iPhone. # Creates a set of universal libraries that can be used on an iPhone and in the # iPhone simulator. Then creates a pseudo-framework to make using boost in Xcode # less painful. # # To configure the script, define: # BOOST_LIBS: which libraries to build # IPHONE_SDKVERSION: iPhone SDK version (e.g. 5.1) # # Then go get the source tar.bz of the boost you want to build, shove it in the # same directory as this script, and run "./boost.sh". Grab a cuppa. And voila. #=============================================================================== : ${BOOST_LIBS:="atomic chrono date_time exception filesystem program_options random signals system test thread"} : ${IPHONE_SDKVERSION:=`xcodebuild -showsdks | grep iphoneos | egrep "[[:digit:]]+\.[[:digit:]]+" -o | tail -1`} : ${OSX_SDKVERSION:=10.9} : ${XCODE_ROOT:=`xcode-select -print-path`} : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -std=c++11 -stdlib=libc++"} # The EXTRA_CPPFLAGS definition works around a thread race issue in # shared_ptr. I encountered this historically and have not verified that # the fix is no longer required. Without using the posix thread primitives # an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the # shared_ptr use count causing nasty and subtle bugs. # # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS : ${TARBALLDIR:=`pwd`} : ${SRCDIR:=`pwd`/src} : ${IOSBUILDDIR:=`pwd`/ios/build} : ${OSXBUILDDIR:=`pwd`/osx/build} : ${PREFIXDIR:=`pwd`/ios/prefix} : ${IOSFRAMEWORKDIR:=`pwd`/ios/framework} : ${OSXFRAMEWORKDIR:=`pwd`/osx/framework} : ${BOOST_VERSION:=1.55.0} : ${BOOST_VERSION2:=1_55_0} BOOST_TARBALL=$TARBALLDIR/boost_$BOOST_VERSION2.tar.bz2 BOOST_SRC=$SRCDIR/boost_${BOOST_VERSION2} #=============================================================================== ARM_DEV_CMD="xcrun --sdk iphoneos" SIM_DEV_CMD="xcrun --sdk iphonesimulator" OSX_DEV_CMD="xcrun --sdk macosx" #=============================================================================== # Functions #=============================================================================== abort() { echo echo "Aborted: $@" exit 1 } doneSection() { echo echo "=================================================================" echo "Done" echo } #=============================================================================== cleanEverythingReadyToStart() { echo Cleaning everything before we start to build... rm -rf iphone-build iphonesim-build osx-build rm -rf $IOSBUILDDIR rm -rf $OSXBUILDDIR rm -rf $PREFIXDIR rm -rf $IOSFRAMEWORKDIR/$FRAMEWORK_NAME.framework rm -rf $OSXFRAMEWORKDIR/$FRAMEWORK_NAME.framework doneSection } #=============================================================================== downloadBoost() { if [ ! -s $TARBALLDIR/boost_${BOOST_VERSION2}.tar.bz2 ]; then echo "Downloading boost ${BOOST_VERSION}" curl -L -o $TARBALLDIR/boost_${BOOST_VERSION2}.tar.bz2 http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION2}.tar.bz2/download fi doneSection } #=============================================================================== unpackBoost() { [ -f "$BOOST_TARBALL" ] || abort "Source tarball missing." echo Unpacking boost into $SRCDIR... [ -d $SRCDIR ] || mkdir -p $SRCDIR [ -d $BOOST_SRC ] || ( cd $SRCDIR; tar xfj $BOOST_TARBALL ) [ -d $BOOST_SRC ] && echo " ...unpacked as $BOOST_SRC" doneSection } #=============================================================================== restoreBoost() { cp $BOOST_SRC/tools/build/v2/user-config.jam-bk $BOOST_SRC/tools/build/v2/user-config.jam } #=============================================================================== updateBoost() { echo Updating boost into $BOOST_SRC... cp $BOOST_SRC/tools/build/v2/user-config.jam $BOOST_SRC/tools/build/v2/user-config.jam-bk cat >> $BOOST_SRC/tools/build/v2/user-config.jam <<EOF using darwin : ${IPHONE_SDKVERSION}~iphone : $XCODE_ROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -arch armv7s -arch arm64 -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer : <architecture>arm <target-os>iphone ; using darwin : ${IPHONE_SDKVERSION}~iphonesim : g++ -arch i386 -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer : <architecture>x86 <target-os>iphone ; using darwin : ${OSX_SDKVERSION} : g++ -arch i386 -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden $EXTRA_CPPFLAGS : <striper> <root>$XCODE_ROOT/Platforms/MacOSX.platform/Developer : <architecture>x86 <target-os>darwin ; EOF doneSection } #=============================================================================== inventMissingHeaders() { # These files are missing in the ARM iPhoneOS SDK, but they are in the simulator. # They are supported on the device, so we copy them from x86 SDK to a staging area # to use them on ARM, too. echo Invent missing headers cp $XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${IPHONE_SDKVERSION}.sdk/usr/include/{crt_externs,bzlib}.h $BOOST_SRC } #=============================================================================== bootstrapBoost() { cd $BOOST_SRC BOOST_LIBS_COMMA=$(echo $BOOST_LIBS | sed -e "s/ /,/g") echo "Bootstrapping (with libs $BOOST_LIBS_COMMA)" ./bootstrap.sh --with-libraries=$BOOST_LIBS_COMMA doneSection } #=============================================================================== buildBoostForIPhoneOS() { cd $BOOST_SRC echo Building Boost for iPhone # Install this one so we can copy the includes for the frameworks... ./b2 -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 ./b2 -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 doneSection echo Building Boost for iPhoneSimulator ./b2 -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 doneSection echo building Boost for OSX ./b2 -j16 --build-dir=osx-build --stagedir=osx-build/stage toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -arch i386 -arch x86_64" linkflags="-stdlib=libc++" link=static threading=multi macosx-version=${OSX_SDKVERSION} stage doneSection } #=============================================================================== unpackArchive() { BUILDDIR=$1 LIBNAME=$2 echo "Unpacking $LIBNAME" mkdir -p $BUILDDIR/$LIBNAME rm $BUILDDIR/$LIBNAME/*.o rm $BUILDDIR/$LIBNAME/*.SYMDEF* ( cd $BUILDDIR/$NAME; ar -x ../../libboost_$NAME.a; for FILE in *.o; do NEW_FILE="${NAME}_${FILE}" mv $FILE $NEW_FILE done ) } scrunchAllLibsTogetherInOneLibPerPlatform() { cd $BOOST_SRC # iOS Device mkdir -p $IOSBUILDDIR/armv7/obj mkdir -p $IOSBUILDDIR/armv7s/obj mkdir -p $IOSBUILDDIR/arm64/obj # iOS Simulator mkdir -p $IOSBUILDDIR/i386/obj mkdir -p $IOSBUILDDIR/x86_64/obj # OSX mkdir -p $OSXBUILDDIR/i386/obj mkdir -p $OSXBUILDDIR/x86_64/obj ALL_LIBS="" echo Splitting all existing fat binaries... for NAME in $BOOST_LIBS; do if [ "$NAME" == "test" ]; then NAME="unit_test_framework" fi ALL_LIBS="$ALL_LIBS libboost_$NAME.a" $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" -thin armv7 -o $IOSBUILDDIR/armv7/libboost_$NAME.a $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" -thin armv7s -o $IOSBUILDDIR/armv7s/libboost_$NAME.a $ARM_DEV_CMD lipo "iphone-build/stage/lib/libboost_$NAME.a" -thin arm64 -o $IOSBUILDDIR/arm64/libboost_$NAME.a $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" -thin i386 -o $IOSBUILDDIR/i386/libboost_$NAME.a $SIM_DEV_CMD lipo "iphonesim-build/stage/lib/libboost_$NAME.a" -thin x86_64 -o $IOSBUILDDIR/x86_64/libboost_$NAME.a $ARM_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" -thin i386 -o $OSXBUILDDIR/i386/libboost_$NAME.a $ARM_DEV_CMD lipo "osx-build/stage/lib/libboost_$NAME.a" -thin x86_64 -o $OSXBUILDDIR/x86_64/libboost_$NAME.a done echo "Decomposing each architecture's .a files" for NAME in $BOOST_LIBS; do if [ "$NAME" == "test" ]; then NAME="unit_test_framework" fi echo "Decomposing libboost_${NAME}.a" unpackArchive "$IOSBUILDDIR/armv7/obj" $NAME unpackArchive "$IOSBUILDDIR/armv7s/obj" $NAME unpackArchive "$IOSBUILDDIR/arm64/obj" $NAME unpackArchive "$IOSBUILDDIR/i386/obj" $NAME unpackArchive "$IOSBUILDDIR/x86_64/obj" $NAME unpackArchive "$OSXBUILDDIR/i386/obj" $NAME unpackArchive "$OSXBUILDDIR/x86_64/obj" $NAME done echo "Linking each architecture into an uberlib ($ALL_LIBS => libboost.a )" rm $IOSBUILDDIR/*/libboost.a for NAME in $BOOST_LIBS; do if [ "$NAME" == "test" ]; then NAME="unit_test_framework" fi echo $NAME echo ...armv7 (cd $IOSBUILDDIR/armv7; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...armv7s (cd $IOSBUILDDIR/armv7s; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...arm64 (cd $IOSBUILDDIR/arm64; $ARM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...i386 (cd $IOSBUILDDIR/i386; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...x86_64 (cd $IOSBUILDDIR/x86_64; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) rm $OSXBUILDDIR/*/libboost.a echo ...osx-i386 (cd $OSXBUILDDIR/i386; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) echo ...osx-x86_64 (cd $OSXBUILDDIR/x86_64; $SIM_DEV_CMD ar crus libboost.a obj/$NAME/*.o; ) done } #=============================================================================== buildFramework() { : ${1:?} FRAMEWORKDIR=$1 BUILDDIR=$2 VERSION_TYPE=Alpha FRAMEWORK_NAME=boost FRAMEWORK_VERSION=A FRAMEWORK_CURRENT_VERSION=$BOOST_VERSION FRAMEWORK_COMPATIBILITY_VERSION=$BOOST_VERSION FRAMEWORK_BUNDLE=$FRAMEWORKDIR/$FRAMEWORK_NAME.framework echo "Framework: Building $FRAMEWORK_BUNDLE from $BUILDDIR..." rm -rf $FRAMEWORK_BUNDLE echo "Framework: Setting up directories..." mkdir -p $FRAMEWORK_BUNDLE mkdir -p $FRAMEWORK_BUNDLE/Versions mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Resources mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Headers mkdir -p $FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/Documentation echo "Framework: Creating symlinks..." ln -s $FRAMEWORK_VERSION $FRAMEWORK_BUNDLE/Versions/Current ln -s Versions/Current/Headers $FRAMEWORK_BUNDLE/Headers ln -s Versions/Current/Resources $FRAMEWORK_BUNDLE/Resources ln -s Versions/Current/Documentation $FRAMEWORK_BUNDLE/Documentation ln -s Versions/Current/$FRAMEWORK_NAME $FRAMEWORK_BUNDLE/$FRAMEWORK_NAME FRAMEWORK_INSTALL_NAME=$FRAMEWORK_BUNDLE/Versions/$FRAMEWORK_VERSION/$FRAMEWORK_NAME echo "Lipoing library into $FRAMEWORK_INSTALL_NAME..." $ARM_DEV_CMD lipo -create $BUILDDIR/*/libboost.a -o "$FRAMEWORK_INSTALL_NAME" || abort "Lipo $1 failed" echo "Framework: Copying includes..." cp -r $PREFIXDIR/include/boost/* $FRAMEWORK_BUNDLE/Headers/ echo "Framework: Creating plist..." cat > $FRAMEWORK_BUNDLE/Resources/Info.plist <<EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>${FRAMEWORK_NAME}</string> <key>CFBundleIdentifier</key> <string>org.boost</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>${FRAMEWORK_CURRENT_VERSION}</string> </dict> </plist> EOF doneSection } #=============================================================================== # Execution starts here #=============================================================================== mkdir -p $IOSBUILDDIR cleanEverythingReadyToStart #may want to comment if repeatedly running during dev restoreBoost echo "BOOST_VERSION: $BOOST_VERSION" echo "BOOST_LIBS: $BOOST_LIBS" echo "BOOST_SRC: $BOOST_SRC" echo "IOSBUILDDIR: $IOSBUILDDIR" echo "OSXBUILDDIR: $OSXBUILDDIR" echo "PREFIXDIR: $PREFIXDIR" echo "IOSFRAMEWORKDIR: $IOSFRAMEWORKDIR" echo "OSXFRAMEWORKDIR: $OSXFRAMEWORKDIR" echo "IPHONE_SDKVERSION: $IPHONE_SDKVERSION" echo "OSX_SDKVERSION: $OSX_SDKVERSION" echo "XCODE_ROOT: $XCODE_ROOT" echo downloadBoost unpackBoost inventMissingHeaders bootstrapBoost updateBoost buildBoostForIPhoneOS scrunchAllLibsTogetherInOneLibPerPlatform buildFramework $IOSFRAMEWORKDIR $IOSBUILDDIR buildFramework $OSXFRAMEWORKDIR $OSXBUILDDIR restoreBoost echo "Completed successfully" #===============================================================================