Build of Boost Cleanup (#707)

* Updated to check the boost SHA256 when downloading

* Fixed invalid shell option

* Allow the user to request a minimal build of Boost

* Ensure boost build script exits on error

* Removed apparently unused "mkdir"
This commit is contained in:
Roy Keene 2018-03-08 05:18:22 -06:00 committed by Russel Waters
commit 6051604c10

View file

@ -1,18 +1,37 @@
#!/usr/bin/env bash
set -o unset
set -o nounset
set -o errexit
set -o xtrace
bootstrapArgs=()
while getopts 'm' OPT; do
case "${OPT}" in
m)
bootstrapArgs+=('--with-libraries=atomic,chrono,thread,log,date_time,filesystem,program_options,regex')
;;
esac
done
BOOST_BASENAME=boost_1_66_0
BOOST_ROOT=${BOOST_ROOT-/usr/local/boost}
BOOST_URL=https://downloads.sourceforge.net/project/boost/boost/1.66.0/${BOOST_BASENAME}.tar.bz2
BOOST_ARCHIVE="${BOOST_BASENAME}.tar.bz2"
BOOST_ARCHIVE_SHA256='5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9'
wget --quiet -O ${BOOST_BASENAME}.tar.gz "${BOOST_URL}"
tar xf ${BOOST_BASENAME}.tar.gz
wget --quiet -O "${BOOST_ARCHIVE}.new" "${BOOST_URL}"
checkHash="$(openssl dgst -sha256 "${BOOST_ARCHIVE}.new" | sed 's@^.*= *@@')"
if [ "${checkHash}" != "${BOOST_ARCHIVE_SHA256}" ]; then
echo "Checksum mismatch. Expected ${BOOST_ARCHIVE_SHA256}, got ${checkHash}" >&2
exit 1
fi
mv "${BOOST_ARCHIVE}.new" "${BOOST_ARCHIVE}"
tar xf "${BOOST_ARCHIVE}"
cd ${BOOST_BASENAME}
./bootstrap.sh
./bootstrap.sh "${bootstrapArgs[@]}"
./b2 -d0 --prefix=${BOOST_ROOT} link=static install
cd ..
rm -rf ${BOOST_BASENAME}
rm -f ${BOOST_BASENAME}.tar.gz
mkdir -p app
rm -f "${BOOST_ARCHIVE}"