Skip to content

Commit d6d4941

Browse files
committed
Add a script to update the library and subset it
1 parent 287b78b commit d6d4941

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

third-party/update_boost_math.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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

Comments
 (0)