install_boost.sh 1.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#! /bin/bash

set -e
set -x

ROOT=${PWD}

if [ ! -d install/ ]; then
   mkdir -p install
fi
11
INSTALL_PREFIX=${ROOT}/install
12 13
cd install

14 15 16
BOOST_VERSION="1.62.0"
BOOST_FILENAME="boost_${BOOST_VERSION//[.]/_}.tar.gz"

17
#install current boost version
18 19
if [ ! -d boost/${BOOST_VERSION}/ ]; then
   curl -o boost.tar.gz "http://netcologne.dl.sourceforge.net/project/boost/boost/${BOOST_VERSION}/${BOOST_FILENAME}"
20 21 22 23
   mkdir boost_tmp
   tar --strip-components=1 -xf boost.tar.gz -C boost_tmp
   rm boost.tar.gz
   cd boost_tmp
24 25 26
   ./bootstrap.sh --prefix=${INSTALL_PREFIX}/boost/${BOOST_VERSION}/ --with-libraries=system,iostreams,filesystem,program_options,date_time,unit_test_framework
   ./b2 -s NO_BZIP2=1 cxxflags="-std=c++11" --build-type=minimal variant=release -j 4 install
   cd ${INSTALL_PREFIX}
27
   rm -rf boost_tmp
28 29 30 31 32 33 34
fi

# set a symbolic link to the latest boost installation
if [ ! -e ${INSTALL_PREFIX}/boost/latest ]; then
  rm -f ${INSTALL_PREFIX}/boost/latest
fi
ln -s ${INSTALL_PREFIX}/boost/${BOOST_VERSION} ${INSTALL_PREFIX}/boost/latest