aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/build/boost
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-11 08:33:58 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-11 15:43:07 +0300
commit847c49dd01f984ac10e195569b49c7f1bdf33335 (patch)
treed0b06f4968679ae468e7238a97502a0e85578c86 /build/boost
parenttoolchains: add gcc-x{86,64}.cmake (diff)
downloadcmake-common-847c49dd01f984ac10e195569b49c7f1bdf33335.tar.gz
cmake-common-847c49dd01f984ac10e195569b49c7f1bdf33335.zip
refactor build/boost/build_travis.sh
Diffstat (limited to 'build/boost')
-rwxr-xr-xbuild/boost/build_travis.sh61
1 files changed, 46 insertions, 15 deletions
diff --git a/build/boost/build_travis.sh b/build/boost/build_travis.sh
index 1491bc8..267262d 100755
--- a/build/boost/build_travis.sh
+++ b/build/boost/build_travis.sh
@@ -15,35 +15,66 @@
set -o errexit -o nounset -o pipefail -o xtrace
readonly base_dir="$HOME"
-readonly boost_fs="boost_${travis_boost_version//\./_}"
-readonly boost_url="https://dl.bintray.com/boostorg/release/$travis_boost_version/source/$boost_fs.tar.gz"
-readonly boost_dir="$base_dir/$boost_fs"
+readonly script_name="$( basename -- "${BASH_SOURCE[0]}" )"
-address_model=32
-[ "$platform" = x64 ] && address_model=64
-readonly address_model
+dump() {
+ local msg
+ for msg; do
+ echo "$script_name: $msg"
+ done
+}
+
+set_paths() {
+ local boost_fs="boost_${travis_boost_version//\./_}"
+
+ readonly boost_archive="$boost_fs.tar.gz"
+ readonly boost_url="https://dl.bintray.com/boostorg/release/$travis_boost_version/source/$boost_archive"
+ readonly boost_dir="$base_dir/$boost_fs"
+}
+
+set_address_model() {
+ if [ "$platform" = x64 ]; then
+ readonly address_model=64
+ elif [ "$platform" = x86 ]; then
+ readonly address_model=32
+ else
+ dump "unsupported platform: $platform" >&2
+ exit 1
+ fi
+}
-configuration="${configuration,,}"
-readonly configuration
+set_configuration() {
+ configuration="${configuration,,}"
+ readonly configuration
+}
+
+set_parameters() {
+ set_paths
+ set_address_model
+ set_configuration
+}
download() {
- cd -- "$base_dir"
- wget --quiet -- "$boost_url"
- tar xzvf "$boost_fs.tar.gz" > /dev/null
+ wget --quiet -O "$boost_archive" -- "$boost_url"
+ tar xzvf "$boost_archive" > /dev/null
}
build() {
cd -- "$boost_dir"
+
./bootstrap.sh
- ./b2 \
- "address-model=$address_model" \
- variant="$configuration" \
- "--stagedir=stage/$platform/$configuration" \
+ ./b2 \
+ "address-model=$address_model" \
+ variant="$configuration" \
+ "--stagedir=$boost_dir/stage/$platform/$configuration" \
"$@"
}
main() {
+ pushd -- "$base_dir"
+ trap 'popd' EXIT
+ set_parameters
download
build "$@"
}