diff options
author | Jack Lloyd <[email protected]> | 2016-12-04 17:26:47 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-04 17:26:47 -0500 |
commit | b89e7a2d5315ac3df90e40d06868d5a9ce671afc (patch) | |
tree | 597a673c760b3574f03cf0c1673848ca7cab9662 | |
parent | a681421d01ea132ea3461f99641daacd9bd64df9 (diff) | |
parent | 8c6dbef39ed10072154a30c52835a5f609fd1544 (diff) |
Merge GH #745 Make --via-amalgamation an error. Improve quoting in Travis build script
-rwxr-xr-x | configure.py | 5 | ||||
-rw-r--r-- | doc/manual/building.rst | 11 | ||||
-rwxr-xr-x | src/scripts/ci/travis/build.sh | 42 |
3 files changed, 31 insertions, 27 deletions
diff --git a/configure.py b/configure.py index 52f4326c9..5a63d887a 100755 --- a/configure.py +++ b/configure.py @@ -1903,7 +1903,7 @@ def generate_amalgamation(build_config, options): amalg_header = """/* * Botan %s Amalgamation -* (C) 1999-2013,2014,2015 Jack Lloyd and others +* (C) 1999-2013,2014,2015,2016 Jack Lloyd and others * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -2201,8 +2201,7 @@ def main(argv = None): raise Exception("--gen-amalgamation was removed. Migrate to --amalgamation.") if options.via_amalgamation: - logging.warn("--via-amalgamation is deprecated. Use --amalgamation.") - options.amalgamation = True + raise Exception("--via-amalgamation was removed. Use --amalgamation instead.") if options.build_shared_lib and not osinfo.building_shared_supported: raise Exception('Botan does not support building as shared library on the target os. ' diff --git a/doc/manual/building.rst b/doc/manual/building.rst index 807ff5556..a92d1c6a5 100644 --- a/doc/manual/building.rst +++ b/doc/manual/building.rst @@ -254,13 +254,13 @@ is quite convenient if you plan to embed the library into another application. To generate the amalgamation, run ``configure.py`` with whatever options you would ordinarily use, along with the option -``--gen-amalgamation``. This will create two (rather large) files, +``--amalgamation``. This will create two (rather large) files, ``botan_all.h`` and ``botan_all.cpp``, plus (unless the option ``--single-amalgmation-file`` is used) also some number of files like ``botan_all_aesni.cpp`` and ``botan_all_sse2.cpp`` which need to be compiled with the appropriate compiler flags to enable that instruction set. The ISA specific files are only generated if there is -code that requires them, so you can simplify your build The +code that requires them, so you can simplify your build. The ``--minimized-build`` option (described elsewhere in this documentation) is also quite useful with the amalgamation. @@ -272,11 +272,14 @@ to take advantage of prepackaged versions of botan on operating systems that support it), you can instead ignore ``botan_all.h`` and use the headers from ``build/include`` as normal. -You can also build the library as normal but using the amalgamation -instead of the individual source files using ``--via-amalgamation``. +You can also build the library using Botan's build system (as normal) +but utilizing the amalgamation instead of the individual source files +by running something like ``./configure.py --amalgamation && make``. This is essentially a very simple form of link time optimization; because the entire library source is visible to the compiler, it has more opportunities for interprocedural optimizations. +Additionally, amalgamation builds usually have significantly shorter +compile times for full rebuilds. Modules Relying on Third Party Libraries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh index 5fb6bec2d..f5de4bf32 100755 --- a/src/scripts/ci/travis/build.sh +++ b/src/scripts/ci/travis/build.sh @@ -2,10 +2,10 @@ set -ev which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if available -MAKE_PREFIX="" -TEST_PREFIX="" +MAKE_PREFIX=() +TEST_PREFIX=() TEST_EXE=./botan-test -TEST_FLAGS="" +TEST_FLAGS=() CFG_FLAGS=(--prefix=/tmp/botan-installation --cc=$CC --os=$TRAVIS_OS_NAME) # PKCS11 is optional but doesn't pull in new dependencies @@ -14,7 +14,7 @@ CFG_FLAGS+=(--with-pkcs11) CC_BIN=$CXX if [ "$BUILD_MODE" = "static" ] || [ "$BUILD_MODE" = "mini-static" ]; then - CFG_FLAGS+=(--disable-shared --via-amalgamation) + CFG_FLAGS+=(--disable-shared --amalgamation) elif [ "$BUILD_MODE" = "shared" ] || [ "$BUILD_MODE" = "mini-shared" ]; then # No special flags required for shared lib build CFG_FLAGS+=() @@ -38,7 +38,7 @@ elif [ "$BUILD_MODE" = "sanitizer" ]; then CFG_FLAGS+=(--with-sanitizers --disable-modules=locking_allocator) elif [ "$BUILD_MODE" = "valgrind" ]; then CFG_FLAGS+=(--with-valgrind --with-debug-info --disable-modules=locking_allocator) - TEST_PREFIX="valgrind --error-exitcode=9 -v" + TEST_PREFIX=(valgrind --error-exitcode=9 -v) fi if [ "$BUILD_MODE" = "mini-static" ] || [ "$BUILD_MODE" = "mini-shared" ]; then @@ -54,7 +54,7 @@ elif [ "${BUILD_MODE:0:5}" != "cross" ]; then if [ "$BUILD_MODE" = "coverage" ]; then CFG_FLAGS+=(--with-tpm) - TEST_FLAGS="--run-online-tests --pkcs11-lib=/tmp/softhsm/lib/softhsm/libsofthsm2.so" + TEST_FLAGS=(--run-online-tests --pkcs11-lib=/tmp/softhsm/lib/softhsm/libsofthsm2.so) fi # Avoid OpenSSL when using dynamic checkers... @@ -72,7 +72,7 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then if [ "$TRAVIS_OS_NAME" = "osx" ]; then CFG_FLAGS+=(--disable-shared) - MAKE_PREFIX="xcrun --sdk iphoneos" + MAKE_PREFIX=(xcrun --sdk iphoneos) if [ "$BUILD_MODE" = "cross-arm32" ]; then CFG_FLAGS+=(--cpu=armv7 --cc-abi-flags="-arch armv7 -arch armv7s -stdlib=libc++") elif [ "$BUILD_MODE" = "cross-arm64" ]; then @@ -83,22 +83,22 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then if [ "$BUILD_MODE" = "cross-arm32" ]; then CC_BIN=arm-linux-gnueabihf-g++-4.8 - TEST_PREFIX="qemu-arm -L /usr/arm-linux-gnueabihf/" + TEST_PREFIX=(qemu-arm -L /usr/arm-linux-gnueabihf/) CFG_FLAGS+=(--cpu=armv7) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-arm64" ]; then CC_BIN=aarch64-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-aarch64 -L /usr/aarch64-linux-gnu/" + TEST_PREFIX=(qemu-aarch64 -L /usr/aarch64-linux-gnu/) CFG_FLAGS+=(--cpu=armv8-a) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-ppc32" ]; then CC_BIN=powerpc-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-ppc -L /usr/powerpc-linux-gnu/" + TEST_PREFIX=(qemu-ppc -L /usr/powerpc-linux-gnu/) CFG_FLAGS+=(--cpu=ppc32) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-ppc64" ]; then CC_BIN=powerpc64le-linux-gnu-g++-4.8 - TEST_PREFIX="qemu-ppc64le -L /usr/powerpc64le-linux-gnu/" + TEST_PREFIX=(qemu-ppc64le -L /usr/powerpc64le-linux-gnu/) CFG_FLAGS+=(--cpu=ppc64 --with-endian=little) CFG_FLAGS+=(--module-policy=modern --enable-modules=tls) elif [ "$BUILD_MODE" = "cross-win32" ]; then @@ -113,7 +113,7 @@ fi CFG_FLAGS+=(--cc-bin="ccache $CC_BIN") if [ "$BUILD_MODE" = "sonarqube" ]; then - MAKE_PREFIX="./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs" + MAKE_PREFIX=(./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs) fi # configure @@ -128,8 +128,9 @@ if [ "$BUILD_MODE" = "docs" ]; then doxygen build/botan.doxy sphinx-build -a -W -c src/build-data/sphinx doc/manual manual-out else - echo $MAKE_PREFIX make -j $BUILD_JOBS - time $MAKE_PREFIX make -j $BUILD_JOBS + MAKE_CMD=("${MAKE_PREFIX[@]}" make -j "$BUILD_JOBS") + echo "Running" "${MAKE_CMD[@]}" + time "${MAKE_CMD[@]}" fi # post-build ccache stats @@ -157,11 +158,11 @@ if [ "$BUILD_MODE" = "sonarqube" ]; then # http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests # That's why the analysis does not need to be executed if the variable GITHUB_TOKEN is not defined. echo "Starting Pull Request analysis by SonarQube..." - sonar-scanner -Dsonar.login=$SONAR_TOKEN \ + sonar-scanner -Dsonar.login="$SONAR_TOKEN" \ -Dsonar.analysis.mode=preview \ - -Dsonar.github.oauth=$GITHUB_TOKEN \ - -Dsonar.github.repository=$TRAVIS_REPO_SLUG \ - -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST + -Dsonar.github.oauth="$GITHUB_TOKEN" \ + -Dsonar.github.repository="$TRAVIS_REPO_SLUG" \ + -Dsonar.github.pullRequest="$TRAVIS_PULL_REQUEST" fi # When neither on master branch nor on a non-external pull request => nothing to do fi @@ -170,8 +171,9 @@ if [ "$BUILD_MODE" = "sonarqube" ] || [ "$BUILD_MODE" = "docs" ] || \ ( [ "${BUILD_MODE:0:5}" = "cross" ] && [ "$TRAVIS_OS_NAME" = "osx" ] ); then echo "Running tests disabled on this build type" else - echo Running $TEST_PREFIX $TEST_EXE $TEST_FLAGS - time $TEST_PREFIX $TEST_EXE $TEST_FLAGS + TEST_CMD=("${TEST_PREFIX[@]}" $TEST_EXE "${TEST_FLAGS[@]}") + echo "Running" "${TEST_CMD[@]}" + time "${TEST_CMD[@]}" fi # Run Python tests (need shared libs) |