|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -e # stop at the first error |
| 4 | + |
| 5 | +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) |
| 6 | + |
| 7 | +echo "This script deletes ${SCRIPT_DIR}/boost-math and re-downloads it from the standalone Boost.Math release." |
| 8 | +echo "It then subsets it so it only contains the parts that are used in libc++." |
| 9 | +echo |
| 10 | +read -p "To continue, please enter the version you wish to download (e.g. 1.89.0), or Ctrl+C to cancel: " version |
| 11 | + |
| 12 | +# Boost versions are always 1.xx.yy so far, use this to validate. |
| 13 | +# That will probably have to be updated at some point. |
| 14 | +if [[ "${version}" != "1."* ]]; then |
| 15 | + echo "Invalid version '${version}' provided, was expecting 1.XX.YY" |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +echo "****************************************" |
| 20 | +echo "Downloading Boost.Math ${version}" |
| 21 | +echo "****************************************" |
| 22 | +BOOST_URL="https://github.com/boostorg/math/archive/refs/tags/boost-${version}.tar.gz" |
| 23 | +function cleanup_tarball() { |
| 24 | + rm ${SCRIPT_DIR}/boost-math-${version}.tar.gz |
| 25 | +} |
| 26 | +trap cleanup_tarball EXIT |
| 27 | +wget "${BOOST_URL}" -O ${SCRIPT_DIR}/boost-math-${version}.tar.gz |
| 28 | +rm -rf ${SCRIPT_DIR}/boost-math |
| 29 | +mkdir ${SCRIPT_DIR}/boost-math |
| 30 | +tar -x --file ${SCRIPT_DIR}/boost-math-${version}.tar.gz -C ${SCRIPT_DIR}/boost-math --strip-components=1 |
| 31 | + |
| 32 | +echo "****************************************" |
| 33 | +echo "Subsetting Boost.Math ${version}" |
| 34 | +echo "****************************************" |
| 35 | +rm -rf ${SCRIPT_DIR}/boost-math/{.circleci,.drone,.github,build,config,doc,example,meta,test,tools} |
0 commit comments