build-cmd.sh 20.3 KB
Newer Older
1
#!/usr/bin/env bash
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
2 3

cd "$(dirname "$0")"
4
top="$(pwd)"
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
5 6

# turn on verbose debugging output for parabuild logs.
7
exec 4>&1; export BASH_XTRACEFD=4; set -x
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
8 9
# make errors fatal
set -e
10 11
# error on undefined environment variables
set -u
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
12

13
BOOST_SOURCE_DIR="boost"
14 15
VERSION_HEADER_FILE="$BOOST_SOURCE_DIR/boost/version.hpp"
VERSION_MACRO="BOOST_LIB_VERSION"
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
16 17

if [ -z "$AUTOBUILD" ] ; then 
18
    exit 1
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
19 20
fi

21
# Libraries on which we depend - please keep alphabetized for maintenance
22
BOOST_LIBS=(atomic chrono context date_time fiber filesystem iostreams program_options \
23
            regex stacktrace system thread wave)
24

25
BOOST_BUILD_SPAM="-d2 -d+4"             # -d0 is quiet, "-d2 -d+4" allows compilation to be examined
26

Logan Dethrow's avatar
Logan Dethrow committed
27 28
top="$(pwd)"
cd "$BOOST_SOURCE_DIR"
29 30 31 32
# As of sometime between Boost 1.67 and 1.72, the Boost build engine b2's
# legacy bjam alias is no longer copied to the top-level Boost directory. Use
# b2 directly.
bjam="$(pwd)/b2"
Logan Dethrow's avatar
Logan Dethrow committed
33
stage="$(pwd)/stage"
34 35

[ -f "$stage"/packages/include/zlib/zlib.h ] || fail "You haven't installed the zlib package yet."
Logan Dethrow's avatar
Logan Dethrow committed
36
                                                     
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
37
if [ "$OSTYPE" = "cygwin" ] ; then
38
    autobuild="$(cygpath -u $AUTOBUILD)"
39 40 41
    # convert from bash path to native OS pathname
    native()
    {
42
        cygpath -w "$@"
43
    }
44 45
else
    autobuild="$AUTOBUILD"
46 47 48 49 50
    # no pathname conversion needed
    native()
    {
        echo "$*"
    }
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
51 52
fi

53
# load autobuild provided shell functions and variables
54 55 56 57 58 59
source_environment_tempfile="$stage/source_environment.sh"
"$autobuild" source_environment > "$source_environment_tempfile"
. "$source_environment_tempfile"

# Explicitly request each of the libraries named in BOOST_LIBS.
# Use magic bash syntax to prefix each entry in BOOST_LIBS with "--with-".
60
BOOST_BJAM_OPTIONS="address-model=$AUTOBUILD_ADDRSIZE architecture=x86 --layout=tagged -sNO_BZIP2=1 \
61 62 63 64 65
                    ${BOOST_LIBS[*]/#/--with-}"

# Turn these into a bash array: it's important that all of cxxflags (which
# we're about to add) go into a single array entry.
BOOST_BJAM_OPTIONS=($BOOST_BJAM_OPTIONS)
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
66

67
stage_lib="${stage}"/lib
Rye Mutt's avatar
Rye Mutt committed
68
stage_debug="${stage_lib}"/debug
69
stage_release="${stage_lib}"/release
Rye Mutt's avatar
Rye Mutt committed
70
mkdir -p "${stage_debug}"
71
mkdir -p "${stage_release}"
Logan Dethrow's avatar
Logan Dethrow committed
72

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
# Restore all .sos
restore_sos ()
{
    for solib in "${stage}"/packages/lib/debug/libz.so*.disable "${stage}"/packages/lib/release/libz.so*.disable; do
        if [ -f "$solib" ]; then
            mv -f "$solib" "${solib%.disable}"
        fi
    done
}

# Restore all .dylibs
restore_dylibs ()
{
    for dylib in "$stage/packages/lib"/{debug,release}/*.dylib.disable; do
        if [ -f "$dylib" ]; then
            mv "$dylib" "${dylib%.disable}"
        fi
    done
}

93 94 95
find_test_jamfile_dir_for()
{
    # Not every Boost library contains a libs/x/test/Jamfile.v2 file. Some
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
    # have libs/x/test/build/Jamfile.v2. Some have more than one test
    # subdirectory with a Jamfile. Try to be general about it.
    # You can't use bash 'read' from a pipe, though truthfully I've always
    # wished that worked. What you *can* do is read from redirected stdin, but
    # that must follow 'done'.
    while read path
    do # caller doesn't want the actual Jamfile name, just its directory
       dirname "$path"
    done < <(find libs/$1/test -name 'Jam????*' -type f -print)
    # Credit to https://stackoverflow.com/a/11100252/5533635 for the
    # < <(command) trick. Empirically, it does iterate 0 times on empty input.
}

find_test_dirs()
{
    # Pass in the libraries of interest. This shell function emits to stdout
    # the corresponding set of test directories, one per line: the specific
    # library directories containing the Jamfiles of interest. Passing each of
    # these directories to bjam should cause it to build and run that set of
    # tests.
    for blib
    do
        find_test_jamfile_dir_for "$blib"
    done
}

# conditionally run unit tests
run_tests()
{
    # This shell function wants to accept two different sets of arguments,
    # each of arbitrary length: the list of library test directories, and the
    # list of bjam arguments for each test. Since we don't have a good way to
    # do that in bash, we read library test directories from stdin, one per
    # line; command-line arguments are simply forwarded to the bjam command.
    if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
        # read individual directories from stdin below
        while read testdir
        do  sep "$testdir"
            "${bjam}" "$testdir" "$@"
        done < /dev/stdin
136
    fi
137 138 139
    return 0
}

140
last_file="$(mktemp -t build-cmd.XXXXXXXX)"
141 142 143
trap "rm '$last_file'" EXIT
# from here on, the only references to last_file will be from Python
last_file="$(native "$last_file")"
144 145 146
last_time="$(python -c "import os.path; print(int(os.path.getmtime(r'$last_file')))")"
start_time="$last_time"

147 148
sep()
{
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
    python -c "
from __future__ import print_function
import os
import sys
import time
start = $start_time
last_file = r'$last_file'
last = int(os.path.getmtime(last_file))
now = int(time.time())
os.utime(last_file, (now, now))
def since(baseline, now):
    duration = now - baseline
    rest, secs = divmod(duration, 60)
    hours, mins = divmod(rest, 60)
    return '%2d:%02d:%02d' % (hours, mins, secs)
print('((((( %s )))))' % since(last, now), file=sys.stderr)
print(since(start, now), ' $* '.center(72, '='), file=sys.stderr)
"
167 168
}

169 170 171
# bjam doesn't support a -sICU_LIBPATH to point to the location
# of the icu libraries like it does for zlib. Instead, it expects
# the library files to be immediately in the ./lib directory
172
# and the headers to be in the ./include directory and doesn't
173 174 175 176 177 178 179
# provide a way to work around this. Because of this, we break
# the standard packaging layout, with the debug library files
# in ./lib/debug and the release in ./lib/release and instead
# only package the release build of icu4c in the ./lib directory.
# If a way to work around this is found, uncomment the
# corresponding blocks in the icu4c build and fix it here.

180
case "$AUTOBUILD_PLATFORM" in
181

182
    windows*)
183 184 185
        INCLUDE_PATH="$(cygpath -m "${stage}"/packages/include)"
        ZLIB_DEBUG_PATH="$(cygpath -m "${stage}"/packages/lib/debug)"
        ZLIB_RELEASE_PATH="$(cygpath -m "${stage}"/packages/lib/release)"
186

187
        case "$AUTOBUILD_WIN_VSVER" in
188 189 190 191
            120)
                bootstrapver="vc12"
                bjamtoolset="msvc-12.0"
                ;;
192
            150)
193
                bootstrapver="vc141"
194
                bjamtoolset="msvc-14.1"
195
                ;;
Rye Mutt's avatar
Rye Mutt committed
196 197 198 199
            16*)
                bootstrapver="vc142"
                bjamtoolset="msvc-14.2"
                ;;
200 201 202 203 204
            *)
                echo "Unrecognized AUTOBUILD_VSVER='$AUTOBUILD_VSVER'" 1>&2 ; exit 1
                ;;
        esac

205
        sep "bootstrap"
206 207 208
        # Odd things go wrong with the .bat files:  branch targets
        # not recognized, file tests incorrect.  Inexplicable but
        # dropping 'echo on' into the .bat files seems to help.
209 210 211
        cmd.exe /C bootstrap.bat "$bootstrapver" || echo bootstrap failed 1>&2
        # Failure of this bootstrap.bat file may or may not produce nonzero rc
        # -- check for the program it should have built.
212 213 214 215
        if [ ! -x "$bjam.exe" ]
        then cat "bootstrap.log"
             exit 1
        fi
216

217
        # Windows build of viewer expects /Zc:wchar_t-, etc., from LL_BUILD_RELEASE.
218 219
        # Without --abbreviate-paths, some compilations fail with:
        # failed to write output file 'some\long\path\something.rsp'!
220 221 222
        # Without /FS, some compilations fail with:
        # fatal error C1041: cannot open program database '...\vc120.pdb';
        # if multiple CL.EXE write to the same .PDB file, please use /FS
223 224 225 226
        # BOOST_STACKTRACE_LINK (not _DYN_LINK) requests external library:
        # https://www.boost.org/doc/libs/release/doc/html/stacktrace/configuration_and_build.html
        # This helps avoid macro collisions in consuming source files:
        # https://github.com/boostorg/stacktrace/issues/76#issuecomment-489347839
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
        WINDOWS_BJAM_OPTIONS=(link=shared runtime-link=shared \
        debug-symbols=on \
        debug-store=database \
        pch=off \
        --toolset=$bjamtoolset \
        -j$NUMBER_OF_PROCESSORS \
        --hash \
        include=$INCLUDE_PATH \
        cxxflags=/std:c++17 \
        cxxflags=/permissive- \
        cxxflags=/FS \
        define=BOOST_STACKTRACE_LINK \
        define=ZLIB_DLL \
        "${BOOST_BJAM_OPTIONS[@]}")

        DEBUG_BJAM_OPTIONS=("${WINDOWS_BJAM_OPTIONS[@]}" variant=debug)

        cp "$top/user-config.jam" user-config.jam
        sed -i -e "s#ZLIB_LIB_PATH#${ZLIB_DEBUG_PATH}#g" user-config.jam
        sed -i -e "s#ZLIB_LIB_NAME#zlibd#g" user-config.jam
        sed -i -e "s#ZLIB_INCLUDE_PATH#${INCLUDE_PATH}/zlib#g" user-config.jam

        USER_CONFIG="$(cygpath -m -a ./user-config.jam)"

        sep "debugbuild"
        "${bjam}" --prefix="$(cygpath -m  ${stage})" --libdir="$(cygpath -m  ${stage_debug})" \
            "${DEBUG_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM define=BOOST_ALL_DYN_LINK --user-config="$USER_CONFIG" -a -q stage

        # Constraining Windows unit tests to link=static produces unit-test
        # link errors. While it may be possible to edit the test/Jamfile.v2
        # logic in such a way as to succeed statically, it's simpler to allow
        # dynamic linking for test purposes. However -- with dynamic linking,
        # some test executables expect to implicitly load a couple of ICU
        # DLLs. But our installed ICU doesn't even package those DLLs!
        # TODO: Does this clutter our eventual tarball, or are the extra Boost
        # DLLs in a separate build directory?
        # In any case, we still observe failures in certain libraries' unit
        # tests. Certain libraries depend on ICU; thread tests are so deeply
        # nested that even with --abbreviate-paths, the .rsp file pathname is
        # too long for Windows. Poor sad broken Windows.

        # conditionally run unit tests
        find_test_dirs "${BOOST_LIBS[@]}" | \
        grep -v \
             -e 'date_time/' \
             -e 'filesystem/' \
             -e 'iostreams/' \
             -e 'regex/' \
             -e 'stacktrace/' \
             -e 'thread/' \
             | \
        run_tests \
                  --prefix="$(native "${stage}")" --libdir="$(native "${stage_debug}")" \
                  "${DEBUG_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM --user-config="$USER_CONFIG" -a -q

        # Move the libs
        mv "${stage_lib}"/*.dll "${stage_debug}"
        mv "${stage_lib}"/*.lib "${stage_debug}"
        mv "${stage_lib}"/*.pdb "${stage_debug}"

        sep "clean"
        "${bjam}" --clean-all

        RELEASE_BJAM_OPTIONS=("${WINDOWS_BJAM_OPTIONS[@]}" variant=release optimization=speed lto=on lto-mode=full)

        cp "$top/user-config.jam" user-config.jam
        sed -i -e "s#ZLIB_LIB_PATH#${ZLIB_RELEASE_PATH}#g" user-config.jam
        sed -i -e "s#ZLIB_LIB_NAME#zlib#g" user-config.jam
        sed -i -e "s#ZLIB_INCLUDE_PATH#${INCLUDE_PATH}/zlib#g" user-config.jam

        USER_CONFIG="$(cygpath -m -a ./user-config.jam)"

        sep "releasebuild"
        "${bjam}" --prefix="$(cygpath -m  ${stage})" --libdir="$(cygpath -m  ${stage_release})" \
            "${RELEASE_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM define=BOOST_ALL_DYN_LINK --user-config="$USER_CONFIG" -a -q stage
302

303 304 305 306 307 308
        # Constraining Windows unit tests to link=static produces unit-test
        # link errors. While it may be possible to edit the test/Jamfile.v2
        # logic in such a way as to succeed statically, it's simpler to allow
        # dynamic linking for test purposes. However -- with dynamic linking,
        # some test executables expect to implicitly load a couple of ICU
        # DLLs. But our installed ICU doesn't even package those DLLs!
309 310
        # TODO: Does this clutter our eventual tarball, or are the extra Boost
        # DLLs in a separate build directory?
311
        # In any case, we still observe failures in certain libraries' unit
312 313 314
        # tests. Certain libraries depend on ICU; thread tests are so deeply
        # nested that even with --abbreviate-paths, the .rsp file pathname is
        # too long for Windows. Poor sad broken Windows.
315

316
        # conditionally run unit tests
317 318 319 320 321 322
        find_test_dirs "${BOOST_LIBS[@]}" | \
        grep -v \
             -e 'date_time/' \
             -e 'filesystem/' \
             -e 'iostreams/' \
             -e 'regex/' \
323
             -e 'stacktrace/' \
324 325
             -e 'thread/' \
             | \
326
        run_tests \
327
                  --prefix="$(native "${stage}")" --libdir="$(native "${stage_release}")" \
328
                  $RELEASE_BJAM_OPTIONS $BOOST_BUILD_SPAM --user-config="$USER_CONFIG" -a -q
329

330
        # Move the libs
331
        mv "${stage_lib}"/*.dll "${stage_release}"
332
        mv "${stage_lib}"/*.lib "${stage_release}"
333
        mv "${stage_lib}"/*.pdb "${stage_release}"
334

335
        sep "version"
336 337 338
        # bjam doesn't need vsvars, but our hand compilation does
        load_vsvars

339 340 341
        # populate version_file
        cl /DVERSION_HEADER_FILE="\"$VERSION_HEADER_FILE\"" \
           /DVERSION_MACRO="$VERSION_MACRO" \
342 343 344
           /Fo"$(native "$stage/version.obj")" \
           /Fe"$(native "$stage/version.exe")" \
           "$(native "$top/version.c")"
345 346 347
        # Boost's VERSION_MACRO emits (e.g.) "1_55"
        "$stage/version.exe" | tr '_' '.' > "$stage/version.txt"
        rm "$stage"/version.{obj,exe}
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
348
        ;;
349

350
    darwin*)
351
        # Force zlib static linkage by moving .dylibs out of the way
352
        trap restore_dylibs EXIT
353 354 355 356 357
        for dylib in "${stage}"/packages/lib/{debug,release}/*.dylib; do
            if [ -f "$dylib" ]; then
                mv "$dylib" "$dylib".disable
            fi
        done
358 359

        sep "bootstrap"
360 361
        stage_lib="${stage}"/lib
        ./bootstrap.sh --prefix=$(pwd) --with-icu="${stage}"/packages
362

363
        # Boost.Context and Boost.Coroutine2 now require C++14 support.
364 365
        # Without the -Wno-etc switches, clang spams the build output with
        # many hundreds of pointless warnings.
366 367
        # Building Boost.Regex without --disable-icu causes the viewer link to
        # fail for lack of an ICU library.
368
        DARWIN_BJAM_OPTIONS=("${BOOST_BJAM_OPTIONS[@]}" \
369
            link=static \
370 371 372
            "include=${stage}/packages/include" \
            "include=${stage}/packages/include/zlib/" \
            "-sZLIB_INCLUDE=${stage}/packages/include/zlib/" \
373
            cxxflags=-std=c++14 \
374
            cxxflags=-Wno-c99-extensions cxxflags=-Wno-variadic-macros \
375
            cxxflags=-Wno-unused-function cxxflags=-Wno-unused-const-variable \
376 377
            cxxflags=-Wno-unused-local-typedef \
            --disable-icu)
378

379 380
        RELEASE_BJAM_OPTIONS=("${DARWIN_BJAM_OPTIONS[@]}" \
            "-sZLIB_LIBPATH=${stage}/packages/lib/release")
381

382
        sep "build"
383
        "${bjam}" toolset=darwin variant=release "${RELEASE_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM stage
384

385
        # conditionally run unit tests
386 387 388 389 390 391 392 393
        # date_time Posix test failures: https://svn.boost.org/trac/boost/ticket/10570
        # With Boost 1.64, skip filesystem/tests/issues -- we get:
        # error: Unable to find file or target named
        # error:     '6638-convert_aux-fails-init-global.cpp'
        # error: referred to from project at
        # error:     'libs/filesystem/test/issues'
        # regex/tests/de_fuzz depends on an external Fuzzer library:
        # ld: library not found for -lFuzzer
394 395
        # Sadly, as of Boost 1.65.1, the Stacktrace self-tests just do not
        # seem ready for prime time on Mac.
396 397
        # Bump the timeout for Boost.Thread tests because our TeamCity Mac
        # build hosts are getting a bit long in the tooth.
398 399 400 401 402
        find_test_dirs "${BOOST_LIBS[@]}" | \
        grep -v \
             -e 'date_time/' \
             -e 'filesystem/test/issues' \
             -e 'regex/test/de_fuzz' \
403
             -e 'stacktrace/' \
404
            | \
405
        run_tests toolset=darwin variant=release -a -q \
406
                  "${RELEASE_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM \
407
                  cxxflags="-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED" \
Nat Goodspeed's avatar
Nat Goodspeed committed
408
                  cxxflags="-DBOOST_THREAD_TEST_TIME_MS=250"
409

410
        mv "${stage_lib}"/*.a "${stage_release}"
411 412

        # populate version_file
413
        sep "version"
414 415 416 417 418 419
        cc -DVERSION_HEADER_FILE="\"$VERSION_HEADER_FILE\"" \
           -DVERSION_MACRO="$VERSION_MACRO" \
           -o "$stage/version" "$top/version.c"
        # Boost's VERSION_MACRO emits (e.g.) "1_55"
        "$stage/version" | tr '_' '.' > "$stage/version.txt"
        rm "$stage/version"
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
420
        ;;
421

422
    linux*)
423
        # Force static linkage to libz by moving .sos out of the way
424
        trap restore_sos EXIT
425 426 427 428 429
        for solib in "${stage}"/packages/lib/debug/libz.so* "${stage}"/packages/lib/release/libz.so*; do
            if [ -f "$solib" ]; then
                mv -f "$solib" "$solib".disable
            fi
        done
430 431

        sep "bootstrap"
Rye Mutt's avatar
Rye Mutt committed
432
        ./bootstrap.sh --prefix=$(pwd) --without-icu
433

434
        DEBUG_BOOST_BJAM_OPTIONS=(--disable-icu toolset=gcc link=static debug-symbols=on "include=$stage/packages/include/zlib/" \
Rye Mutt's avatar
Rye Mutt committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
            "-sZLIB_LIBPATH=$stage/packages/lib/debug" \
            "-sZLIB_INCLUDE=${stage}\/packages/include/zlib/" \
            "${BOOST_BJAM_OPTIONS[@]}" \
            "cflags=-Og" "cflags=-fPIC" "cflags=-DPIC" "cflags=-g" \
            "cxxflags=-std=c++17" "cxxflags=-Og" "cxxflags=-fPIC" "cxxflags=-DPIC" "cxxflags=-g")
        sep "build"
        "${bjam}" variant=debug --reconfigure \
            --prefix="${stage}" --libdir="${stage}"/lib/debug \
            "${DEBUG_BOOST_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM stage

        # conditionally run unit tests
        # date_time Posix test failures: https://svn.boost.org/trac/boost/ticket/10570
        # libs/regex/test/de_fuzz produces:
        # error: "clang" is not a known value of feature <toolset>
        # error: legal values: "gcc"
        find_test_dirs "${BOOST_LIBS[@]}" | \
        grep -v \
Rye Mutt's avatar
Rye Mutt committed
452
             -e 'atomics/' \
Rye Mutt's avatar
Rye Mutt committed
453 454 455 456 457 458 459 460 461 462 463 464 465
             -e 'date_time/' \
             -e 'filesystem/test/issues' \
             -e 'regex/test/de_fuzz' \
            | \
        run_tests variant=debug -a -q \
                  --prefix="${stage}" --libdir="${stage}"/lib/debug \
                  "${DEBUG_BOOST_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM

        mv "${stage_lib}"/libboost* "${stage_debug}"

        sep "clean"
        "${bjam}" --clean

466
        RELEASE_BOOST_BJAM_OPTIONS=(--disable-icu toolset=gcc link=static debug-symbols=on "include=$stage/packages/include/zlib/" \
467 468
            "-sZLIB_LIBPATH=$stage/packages/lib/release" \
            "-sZLIB_INCLUDE=${stage}\/packages/include/zlib/" \
469
            "${BOOST_BJAM_OPTIONS[@]}" \
Rye Mutt's avatar
Rye Mutt committed
470 471
            "cflags=-O3" "cflags=-fstack-protector-strong" "cflags=-fPIC" "cflags=-D_FORTIFY_SOURCE=2" "cflags=-DPIC" "cflags=-g" \
            "cxxflags=-std=c++17" "cxxflags=-O3" "cxxflags=-fstack-protector-strong" "cxxflags=-fPIC" "cxxflags=-D_FORTIFY_SOURCE=2" "cxxflags=-DPIC" "cxxflags=-g")
472
        sep "build"
473 474
        "${bjam}" variant=release --reconfigure \
            --prefix="${stage}" --libdir="${stage}"/lib/release \
475
            "${RELEASE_BOOST_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM stage
476 477

        # conditionally run unit tests
478
        # date_time Posix test failures: https://svn.boost.org/trac/boost/ticket/10570
479 480 481
        # libs/regex/test/de_fuzz produces:
        # error: "clang" is not a known value of feature <toolset>
        # error: legal values: "gcc"
482 483
        find_test_dirs "${BOOST_LIBS[@]}" | \
        grep -v \
Rye Mutt's avatar
Rye Mutt committed
484
             -e 'atomics/' \
485
             -e 'date_time/' \
486
             -e 'filesystem/test/issues' \
487
             -e 'regex/test/de_fuzz' \
488 489 490 491
            | \
        run_tests variant=release -a -q \
                  --prefix="${stage}" --libdir="${stage}"/lib/release \
                  "${RELEASE_BOOST_BJAM_OPTIONS[@]}" $BOOST_BUILD_SPAM
492

493
        mv "${stage_lib}"/libboost* "${stage_release}"
494

495
        sep "clean"
496
        "${bjam}" --clean
497 498

        # populate version_file
499
        sep "version"
500 501 502 503 504 505
        cc -DVERSION_HEADER_FILE="\"$VERSION_HEADER_FILE\"" \
           -DVERSION_MACRO="$VERSION_MACRO" \
           -o "$stage/version" "$top/version.c"
        # Boost's VERSION_MACRO emits (e.g.) "1_55"
        "$stage/version" | tr '_' '.' > "$stage/version.txt"
        rm "$stage/version"
Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
506
        ;;
507
esac
508 509

sep "includes and text"
510 511 512 513
mkdir -p "${stage}"/include
cp -a boost "${stage}"/include/
mkdir -p "${stage}"/LICENSES
cp -a LICENSE_1_0.txt "${stage}"/LICENSES/boost.txt
514 515
mkdir -p "${stage}"/docs/boost/
cp -a "$top"/README.Linden "${stage}"/docs/boost/
516

Mark Palange (Mani)'s avatar
Mark Palange (Mani) committed
517
cd "$top"