Advertisement
kelsos

build boost

Oct 15th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.17 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. version=1.58.0
  4. echo "Building boost $version..."
  5.  
  6. set -eu
  7.  
  8. toolchain=$PWD/toolchain
  9. if [ ! -d "$toolchain" ]; then
  10.   echo "Building toolchain..."
  11.   $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh \
  12.       --arch=armeabi-v7a --platform=android-17 \
  13.       --install-dir="$toolchain" \
  14.       --toolchain=arm-linux-androideabi-clang \
  15.       --use-llvm --stl=libc++
  16. else
  17.   echo "Toolchain already built"
  18. fi
  19.  
  20. dir_name=boost_$(sed 's#\.#_#g' <<< $version)
  21. archive=${dir_name}.tar.bz2
  22. if [ ! -f "$archive" ]; then
  23.   wget -O $archive "http://downloads.sourceforge.net/project/boost/boost/$version/$archive?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F$version%2F&ts=1463606893&use_mirror=jaist"
  24. else
  25.   echo "Archive $archive already downloaded"
  26. fi
  27.  
  28. echo "Extracting..."
  29. if [ ! -d "$dir_name" ]; then
  30.   # rm -rf $dir_name
  31.   tar xf $archive
  32. else
  33.   echo "Archive $archive already unpacked into $dir_name"
  34. fi
  35. cd $dir_name
  36.  
  37. echo "Generating config..."
  38. user_config=tools/build/src/user-config.jam
  39. rm -f $user_config
  40. cat <<EOF > $user_config
  41. import os ;
  42.  
  43. using clang : android
  44. :
  45. "$toolchain/bin/clang++"
  46. :
  47. <archiver>$toolchain/bin/arm-linux-androideabi-ar
  48. <ranlib>$toolchain/bin/arm-linux-androideabi-ranlib
  49. ;
  50. EOF
  51.  
  52. echo "Bootstrapping..."
  53. ./bootstrap.sh
  54.  
  55. #    --with-coroutine \
  56. #    --with-coroutine2 \
  57.  
  58. echo "Building..."
  59. ./b2 -j16 \
  60.   --with-atomic \
  61.     --with-chrono \
  62.     --with-date_time \
  63.     --with-exception \
  64.     --with-filesystem \
  65.     --with-system \
  66.     --with-test \
  67.     --with-regex \
  68.     --with-signals \
  69.     --with-program_options \
  70.     --with-thread \
  71.     toolset=clang-android \
  72.     architecture=arm \
  73.     variant=release \
  74.     --layout=versioned \
  75.     target-os=android \
  76.     threading=multi \
  77.     threadapi=pthread \
  78.     link=static \
  79.     runtime-link=static \
  80.  
  81. echo "Running ranlib on libraries..."
  82. libs=$(find "bin.v2/libs/" -name '*.so')
  83. for lib in $libs; do
  84.   "$toolchain/bin/arm-linux-androideabi-ranlib" "$lib"
  85. done
  86.  
  87. echo "Done!"
  88.  
  89.   # boost_regex
  90.   #         boost_filesystem
  91.   #         boost_unit_test_framework
  92.   #         boost_program_options
  93.   #         boost_system
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement