Created
November 10, 2018 00:28
-
-
Save praveen-palanisamy/a3c9de2f3098499a769df8c36818640b to your computer and use it in GitHub Desktop.
Script to build Boost C++ libraries for python2 and python3
This file contains 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 characters
BOOST_VERSION=1.67.0 | |
BOOST_TOOLSET="clang-5.0" | |
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY" | |
BOOST_BASENAME="boost-${BOOST_VERSION}" | |
BOOST_INCLUDE=${PWD}/${BOOST_BASENAME}-install/include | |
BOOST_LIBPATH=${PWD}/${BOOST_BASENAME}-install/lib | |
echo "Downloading boost." | |
wget "https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//./_}.tar.gz" | |
echo "Extracting boost." | |
tar -xzf ${BOOST_BASENAME//[-.]/_}.tar.gz | |
mkdir -p ${BOOST_BASENAME}-install/include | |
mv ${BOOST_BASENAME//[-.]/_} ${BOOST_BASENAME}-source | |
pushd ${BOOST_BASENAME}-source >/dev/null | |
echo "Building boost for python2" | |
py2="/usr/bin/env python2" | |
py2_root=`${py2} -c "import sys; print(sys.prefix)"` | |
pyv=`$py2 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";` | |
./bootstrap.sh \ | |
--with-toolset=clang \ | |
--prefix=../boost-install \ | |
--with-libraries=python,filesystem \ | |
--with-python=${py2} --with-python-root=${py2_root} | |
echo "using python version: ${pyv}" | |
echo "using python : ${pyv} : ${py2_root}/bin/python2 ;" > ${HOME}/user-config.jam | |
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release | |
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install | |
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} --clean-all | |
# Get rid of python2 build artifacts completely & do a clean build for python3 | |
echo "Cleaning up boost python2 build artifacts" | |
popd >/dev/null | |
rm -Rf ${BOOST_BASENAME}-source | |
tar -xzf ${BOOST_BASENAME//[-.]/_}.tar.gz | |
mkdir -p ${BOOST_BASENAME}-install/include | |
mv ${BOOST_BASENAME//[-.]/_} ${BOOST_BASENAME}-source | |
pushd ${BOOST_BASENAME}-source >/dev/null | |
echo "Building python3 boost" | |
py3="/usr/bin/env python3" | |
py3_root=`${py3} -c "import sys; print(sys.prefix)"` | |
pyv=`$py3 -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";` | |
./bootstrap.sh \ | |
--with-toolset=clang \ | |
--prefix=../boost-install \ | |
--with-libraries=python \ | |
--with-python=${py3} --with-python-root=${py3_root} | |
echo "using python version: ${pyv}" | |
echo "using python : ${pyv} : ${py3_root}/bin/python3 ;" > ${HOME}/user-config.jam | |
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release | |
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install | |
popd >/dev/null | |
rm -Rf ${BOOST_BASENAME}-source | |
rm ${BOOST_BASENAME//[-.]/_}.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment