aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.travis/build_boost.sh
blob: 9c757a5780e3596b3d27c292a3288c795a940261 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail -o xtrace

readonly boost_fs="boost_${boost_version//\./_}"
readonly boost_url="https://dl.bintray.com/boostorg/release/$boost_version/source/$boost_fs.tar.gz"
readonly boost_dir="$HOME/$boost_fs"

address_model=32
[ "$arch" = x64 ] && address_model=64
readonly address_model

clean() {
    cd -- "$HOME/"
}

download() {
    trap clean RETURN
    wget -- "$boost_url"
    tar xzvf "$boost_fs.tar.gz" > /dev/null
}

bootstrap() {
    trap clean RETURN
    cd -- "$boost_dir"
    ./bootstrap.sh
}

build() {
    trap clean RETURN
    cd -- "$boost_dir"
    ./b2                                      \
        "address-model=$address_model"        \
        link=static                           \
        variant="$build_type"                 \
        "--stagedir=stage/$arch/$build_type"  \
        --with-filesystem                     \
        --with-program_options                \
        --with-test
}

main() {
    clean
    download
    bootstrap
    build
}

main