aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/build/boost/build_travis.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build/boost/build_travis.sh')
-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 "$@"
}