#! /bin/bash
  
set -e
set -x

cd "$(mktemp -dt plumed.XXXXXX)"

# this should probably match system boost
version=1.65.1

version_=${version//./_}

echo $version $version_

wget https://boostorg.jfrog.io/artifactory/main/release/$version/source/boost_${version_}.tar.gz > /dev/null 2> /dev/null
tar xzf boost_${version_}.tar.gz

cd boost_${version_}

./bootstrap.sh --with-libraries=serialization --prefix="$HOME/opt"

if [ "$1" = release ] ; then
# release build:
./b2 release install -j 4  > /dev/null 2> /dev/null
else
# debug build:
./b2 debug cxxflags=-D_GLIBCXX_DEBUG install -j 4 > /dev/null 2> /dev/null
fi

