diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23311233..7037985e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,6 +150,7 @@ jobs: --build-use-local-src --build-src-dir="${{ github.workspace }}" --prefix="${{ github.workspace }}/prefix" + --build-post-install-clean --build-obj-dir="obj" --build-obj-dir-relative --build-config="${{ matrix.config }}" @@ -179,11 +180,23 @@ jobs: shell: bash working-directory: ${{ github.workspace }} run: | + if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + fi + if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + fi + if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + fi + if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" fi - name: Test artifact upload @@ -191,7 +204,7 @@ jobs: uses: actions/upload-artifact@v7.0.1 with: name: testlogs - path: ${{ github.workspace }}/*test.log + path: ${{ github.workspace }}/*.errors retention-days: 1 if-no-files-found: warn @@ -334,6 +347,7 @@ jobs: --build-use-local-src --build-src-dir="${{ github.workspace }}" --prefix="${{ github.workspace }}/prefix" + --build-post-install-clean --build-obj-dir="obj" --build-obj-dir-relative --build-config="${{ matrix.config }}" @@ -363,11 +377,23 @@ jobs: shell: bash working-directory: ${{ github.workspace }} run: | + if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + fi + if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + fi + if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + fi + if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" fi - name: Test artifact upload @@ -375,7 +401,7 @@ jobs: uses: actions/upload-artifact@v7.0.1 with: name: testlogs - path: ${{ github.workspace }}/*test.log + path: ${{ github.workspace }}/*.errors retention-days: 1 if-no-files-found: warn @@ -507,11 +533,23 @@ jobs: shell: bash working-directory: ${{ github.workspace }} run: | + if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + fi + if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + fi + if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + fi + if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" fi - name: Test artifact upload @@ -519,7 +557,7 @@ jobs: uses: actions/upload-artifact@v7.0.1 with: name: testlogs - path: ${{ github.workspace }}/*test.log + path: ${{ github.workspace }}/*.errors retention-days: 1 if-no-files-found: warn diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index 3946d9bf..c1fa7129 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -8,23 +8,35 @@ # Script managing the build and installation of libbitcoin-database and its dependencies. # # Script options: +# -Denable-avx2= Use Intel AVX2 intrinsics. +# Default: OFF +# -Denable-avx512= Use Intel AVX512 intrinsics. +# Default: OFF +# -Denable-sse41= Use SSE4.1 hardware instructions. +# Default: OFF +# -Denable-shani= Use Intel/ARM SHA Extensions. +# Default: OFF # --build-boost Build Boost libraries # --build-secp256k1 Build libsecp256k1 libraries -# --build-src-dir= Location of sources. -# --build-obj-dir= Location of intermedia objects. -# --build-obj-dir-relative Use build-obj-dir as relative to project sources. +# --build-src-dir= Location for sources. +# Default: $(pwd) +# --build-obj-dir= Location for intermediate objects. +# Default: obj +# --build-obj-dir-relative Interpret build-obj-dir as relative to project sources. # --build-config= Specifies the build configuration. -# Valid values: { debug, release } +# Values: { debug, release } # Toolchain default behavior will occur if no value specified. -# --build-link= Specifies link mode. -# Valid values: { dynamic, static } +# --build-link= Specifies the link mode. +# Values: { dynamic, static } # Toolchain default behavior will occur if no value specified. # --build-full-repositories Sync full github repositories. -# Default clones depth 1, single branch +# Default: git clone --depth 1 --single-branch +# --build-post-install-clean Clean dependencies after installation (saves space). +# --build-skip-tests Skip test compilation and execution. # --build-parallel= Number of jobs to run simultaneously. -# Default: discovery -# --build-use-local-src Use existing sources in build-src-dir path. -# --prefix= Library install location. +# Default: supported platforms use nproc/sysctl +# --build-use-local-src Use existing sources in relevant paths. +# --prefix= Installation destination. # Default: /usr/local # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. @@ -82,9 +94,10 @@ main() (--build-config=*) BUILD_CONFIG="${OPTION#*=}";; (--build-link=*) BUILD_LINK="${OPTION#*=}";; (--build-full-repositories) BUILD_FULL_REPOSITORIES="yes";; - (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; - (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-post-install-clean)BUILD_POST_INSTALL_CLEAN="yes";; (--build-skip-tests) BUILD_SKIP_TESTS="yes";; + (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; @@ -97,9 +110,22 @@ main() CONFIGURE_OPTIONS_ORIGINAL=("$@") CONFIGURE_OPTIONS=("$@") - CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-boost/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-secp256k1/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-src-dir=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-obj-dir=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-obj-dir-relative/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-config=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-link=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-full-repositories/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-post-install-clean/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-skip-tests/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" msg_verbose "*** SANITIZED: ${CONFIGURE_OPTIONS[*]}" @@ -107,6 +133,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -118,63 +150,57 @@ main() msg_verbose "No build-src-dir specified, using default '${BUILD_SRC_DIR}'." fi - if [[ -d "${BUILD_SRC_DIR}" ]]; then - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-src-dir '${BUILD_SRC_DIR}'." - else + if ! [[ -d "${BUILD_SRC_DIR}" ]]; then create_directory "${BUILD_SRC_DIR}" - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-src-dir '${BUILD_SRC_DIR}'." + msg_verbose "Created --build-src-dir '${BUILD_SRC_DIR}'." fi + push_directory "${BUILD_SRC_DIR}" + BUILD_SRC_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-src-dir '${BUILD_SRC_DIR}'." + # --build-obj-dir if [[ -z "${BUILD_OBJ_DIR}" ]]; then if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then BUILD_OBJ_DIR="obj" - msg_verbose "No build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." else BUILD_OBJ_DIR="$(pwd)/obj" - msg_verbose "No build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." fi fi if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then - msg_verbose "Deferring relative path action for build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Deferring relative path action for --build-obj-dir '${BUILD_OBJ_DIR}'." else - if [[ -d "${BUILD_OBJ_DIR}" ]]; then - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-obj-dir '${BUILD_OBJ_DIR}'." - else + if ! [[ -d "${BUILD_OBJ_DIR}" ]]; then create_directory "${BUILD_OBJ_DIR}" - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Created --build-obj-dir '${BUILD_OBJ_DIR}'." fi + + push_directory "${BUILD_OBJ_DIR}" + BUILD_OBJ_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-obj-dir '${BUILD_OBJ_DIR}'." fi # --build-config if [[ -z "${BUILD_CONFIG}" ]]; then - msg_verbose "No build-config specified." + msg_verbose "No --build-config specified." elif [[ "${BUILD_CONFIG}" != "debug" ]] && [[ "${BUILD_CONFIG}" != "release" ]]; then - msg_error "Provided build-config '${BUILD_CONFIG}' not a valid value." + msg_error "Provided --build-config '${BUILD_CONFIG}' not a valid value." help exit 1 else - msg_verbose "Using provided build-config '${BUILD_CONFIG}'" + msg_verbose "Using provided --build-config '${BUILD_CONFIG}'" fi # --build-link if [[ -z "${BUILD_LINK}" ]]; then - msg_verbose "No build-link specified." + msg_verbose "No --build-link specified." elif [[ "${BUILD_LINK}" != "dynamic" ]] && [[ "${BUILD_LINK}" != "static" ]]; then - msg_error "Provided build-link '${BUILD_LINK}' not a valid value." + msg_error "Provided --build-link '${BUILD_LINK}' not a valid value." help exit 1 fi @@ -183,7 +209,7 @@ main() if [[ -z "${PREFIX}" ]]; then # Always set a prefix (required for OSX and lib detection). PREFIX="/usr/local" - msg_verbose "No prefix specified, defaulting to '${PREFIX}'." + msg_verbose "No --prefix specified, defaulting to '${PREFIX}'." else # Incorporate the custom libdir into each object, for link time resolution if [[ -z "${LD_RUN_PATH}" ]]; then @@ -242,7 +268,7 @@ main() PARALLEL=$(sysctl -n hw.ncpu) else msg_error "Unsupported system: '${OS}'" - msg_error " Unable to determine value for '--parallel='" + msg_error " Unable to determine value for --build-parallel" msg_error " Please specify explicitly to continue." msg_error "" help @@ -356,12 +382,6 @@ main() CONFIGURE_OPTIONS=( "${REMAP[@]}" ) unset REMAP - # handle help - if [[ "${DISPLAY_HELP}" == "yes" ]]; then - help - return 0 - fi - msg_heading "Configuration" display_build_variables @@ -420,6 +440,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${secp256k1_FLAGS[@]}" build_cmake "secp256k1" "." "${PARALLEL}" "${secp256k1_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "secp256k1" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "secp256k1" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" fi @@ -428,6 +451,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_system_FLAGS[@]}" build_cmake "libbitcoin-system" "builds/cmake" "${PARALLEL}" "${libbitcoin_system_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-system" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-system" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_database_OWNER}" "libbitcoin-database" "${libbitcoin_database_TAG}" @@ -438,6 +464,9 @@ main() test_make "libbitcoin-database" "test" "${PARALLEL}" fi install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -583,11 +612,16 @@ test_make() local RESULT=$? - # Test runners emit to the test.log file. + if [[ -e "Testing/Temporary/LastTest.log" ]]; then + msg_warn "begin error log: Testing/Temporary/LastTest.log" + cat "Testing/Temporary/LastTest.log" + msg_warn " end error log: Testing/Temporary/LastTest.log" + fi + if [[ -e "test.log" ]]; then - msg_warn "test.log - begin" + msg_warn "begin error log: test.log" cat "test.log" - msg_warn "test.log - end" + msg_warn " end error log: test.log" fi if [[ ${RESULT} -ne 0 ]]; then @@ -603,6 +637,38 @@ test_make() msg_success "'${PROJECT}' test complete." } +clean_make() +{ + local PROJECT="$1" + shift 1 + + msg "Preparing to clean ${PROJECT}" + + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + + if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then + push_directory "${BUILD_OBJ_DIR}" + else + push_directory "${BUILD_OBJ_DIR}/${PROJECT}" + fi + + disable_exit_on_error + + make clean + + local RESULT=$? + + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." + exit ${RESULT} + fi + + pop_directory # BUILD_OBJ_DIR + pop_directory # BUILD_SRC_DIR/PROJECT + + msg_success "'${PROJECT}' clean complete." +} + build_boost() { local PROJECT="$1" @@ -750,6 +816,7 @@ display_build_variables() msg "BUILD_CONFIG : ${BUILD_CONFIG}" msg "BUILD_LINK : ${BUILD_LINK}" msg "BUILD_FULL_REPOSITORIES : ${BUILD_FULL_REPOSITORIES}" + msg "BUILD_POST_INSTALL_CLEAN : ${BUILD_POST_INSTALL_CLEAN}" msg "BUILD_USE_LOCAL_SRC : ${BUILD_USE_LOCAL_SRC}" msg "BUILD_SKIP_TESTS : ${BUILD_SKIP_TESTS}" msg "PARALLEL : ${PARALLEL}" @@ -799,23 +866,35 @@ help() msg "Script managing the build and installation of libbitcoin-database and its dependencies." msg "" msg "Script options:" + msg "-Denable-avx2= Use Intel AVX2 intrinsics." + msg " Default: OFF" + msg "-Denable-avx512= Use Intel AVX512 intrinsics." + msg " Default: OFF" + msg "-Denable-sse41= Use SSE4.1 hardware instructions." + msg " Default: OFF" + msg "-Denable-shani= Use Intel/ARM SHA Extensions." + msg " Default: OFF" msg "--build-boost Build Boost libraries" msg "--build-secp256k1 Build libsecp256k1 libraries" - msg "--build-src-dir= Location of sources." - msg "--build-obj-dir= Location of intermedia objects." - msg "--build-obj-dir-relative Use build-obj-dir as relative to project sources." + msg "--build-src-dir= Location for sources." + msg " Default: $(pwd)" + msg "--build-obj-dir= Location for intermediate objects." + msg " Default: obj" + msg "--build-obj-dir-relative Interpret build-obj-dir as relative to project sources." msg "--build-config= Specifies the build configuration." - msg " Valid values: { debug, release }" + msg " Values: { debug, release }" msg " Toolchain default behavior will occur if no value specified." - msg "--build-link= Specifies link mode." - msg " Valid values: { dynamic, static }" + msg "--build-link= Specifies the link mode." + msg " Values: { dynamic, static }" msg " Toolchain default behavior will occur if no value specified." msg "--build-full-repositories Sync full github repositories." - msg " Default clones depth 1, single branch" + msg " Default: git clone --depth 1 --single-branch" + msg "--build-post-install-clean Clean dependencies after installation (saves space)." + msg "--build-skip-tests Skip test compilation and execution." msg "--build-parallel= Number of jobs to run simultaneously." - msg " Default: discovery" - msg "--build-use-local-src Use existing sources in build-src-dir path." - msg "--prefix= Library install location." + msg " Default: supported platforms use nproc/sysctl" + msg "--build-use-local-src Use existing sources in relevant paths." + msg "--prefix= Installation destination." msg " Default: /usr/local" msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." diff --git a/builds/cmake/install-presets.sh b/builds/cmake/install-presets.sh index 86e93f46..1bc81b28 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -8,15 +8,26 @@ # Script managing the build and installation of libbitcoin-database and its dependencies. # # Script options: +# -Denable-avx2= Use Intel AVX2 intrinsics. +# Default: OFF +# -Denable-avx512= Use Intel AVX512 intrinsics. +# Default: OFF +# -Denable-sse41= Use SSE4.1 hardware instructions. +# Default: OFF +# -Denable-shani= Use Intel/ARM SHA Extensions. +# Default: OFF # --build-boost Build Boost libraries # --build-secp256k1 Build libsecp256k1 libraries -# --build-preset= Preset configuration to build. -# --build-src-dir= Location of sources. +# --build-preset= Specifies preset configuration to build. +# --build-src-dir= Location for sources. +# Default: $(pwd) # --build-full-repositories Sync full github repositories. -# Default clones depth 1, single branch +# Default: git clone --depth 1 --single-branch +# --build-post-install-clean Clean dependencies after installation (saves space). +# --build-skip-tests Skip test compilation and execution. # --build-parallel= Number of jobs to run simultaneously. -# Default: discovery -# --build-use-local-src Use existing sources in build-src-dir path. +# Default: supported platforms use nproc/sysctl +# --build-use-local-src Use existing sources in relevant paths. # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # @@ -70,9 +81,10 @@ main() (--build-preset=*) BUILD_PRESET="${OPTION#*=}";; (--build-src-dir=*) BUILD_SRC_DIR="${OPTION#*=}";; (--build-full-repositories) BUILD_FULL_REPOSITORIES="yes";; - (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; - (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-post-install-clean)BUILD_POST_INSTALL_CLEAN="yes";; (--build-skip-tests) BUILD_SKIP_TESTS="yes";; + (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; (-DCMAKE_PREFIX_PATH=*) CMAKE_PREFIX_PATH="${OPTION#*=}";; @@ -84,9 +96,18 @@ main() CONFIGURE_OPTIONS_ORIGINAL=("$@") CONFIGURE_OPTIONS=("$@") - CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-*/}") - CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-boost/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-secp256k1/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-preset=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-src-dir=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-full-repositories/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-post-install-clean/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-skip-tests/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" msg_verbose "*** SANITIZED: ${CONFIGURE_OPTIONS[*]}" @@ -94,6 +115,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -101,7 +128,7 @@ main() # --build-preset if [[ -z "${BUILD_PRESET}" ]]; then - msg_error "No build-preset specified." + msg_error "No --build-preset specified." help exit 1 fi @@ -134,18 +161,15 @@ main() msg_verbose "No build-src-dir specified, using default '${BUILD_SRC_DIR}'." fi - if [[ -d "${BUILD_SRC_DIR}" ]]; then - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-src-dir '${BUILD_SRC_DIR}'." - else + if ! [[ -d "${BUILD_SRC_DIR}" ]]; then create_directory "${BUILD_SRC_DIR}" - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-src-dir '${BUILD_SRC_DIR}'." + msg_verbose "Created --build-src-dir '${BUILD_SRC_DIR}'." fi + + push_directory "${BUILD_SRC_DIR}" + BUILD_SRC_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-src-dir '${BUILD_SRC_DIR}'." # Embedded knowlege of CMakePresets: binaryDir BUILD_OBJ_DIR="obj/${BUILD_PRESET}" @@ -156,46 +180,43 @@ main() if [[ -z "${BUILD_OBJ_DIR}" ]]; then if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then BUILD_OBJ_DIR="obj" - msg_verbose "No build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." else BUILD_OBJ_DIR="$(pwd)/obj" - msg_verbose "No build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." fi fi if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then - msg_verbose "Deferring relative path action for build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Deferring relative path action for --build-obj-dir '${BUILD_OBJ_DIR}'." else - if [[ -d "${BUILD_OBJ_DIR}" ]]; then - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-obj-dir '${BUILD_OBJ_DIR}'." - else + if ! [[ -d "${BUILD_OBJ_DIR}" ]]; then create_directory "${BUILD_OBJ_DIR}" - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Created --build-obj-dir '${BUILD_OBJ_DIR}'." fi + + push_directory "${BUILD_OBJ_DIR}" + BUILD_OBJ_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-obj-dir '${BUILD_OBJ_DIR}'." fi # --build-config if [[ -z "${BUILD_CONFIG}" ]]; then - msg_verbose "No build-config specified." + msg_verbose "No --build-config specified." elif [[ "${BUILD_CONFIG}" != "debug" ]] && [[ "${BUILD_CONFIG}" != "release" ]]; then - msg_error "Provided build-config '${BUILD_CONFIG}' not a valid value." + msg_error "Provided --build-config '${BUILD_CONFIG}' not a valid value." help exit 1 else - msg_verbose "Using provided build-config '${BUILD_CONFIG}'" + msg_verbose "Using provided --build-config '${BUILD_CONFIG}'" fi # --build-link if [[ -z "${BUILD_LINK}" ]]; then - msg_verbose "No build-link specified." + msg_verbose "No --build-link specified." elif [[ "${BUILD_LINK}" != "dynamic" ]] && [[ "${BUILD_LINK}" != "static" ]]; then - msg_error "Provided build-link '${BUILD_LINK}' not a valid value." + msg_error "Provided --build-link '${BUILD_LINK}' not a valid value." help exit 1 fi @@ -204,7 +225,7 @@ main() if [[ -z "${PREFIX}" ]]; then # Always set a prefix (required for OSX and lib detection). PREFIX="/usr/local" - msg_verbose "No prefix specified, defaulting to '${PREFIX}'." + msg_verbose "No --prefix specified, defaulting to '${PREFIX}'." else # Incorporate the custom libdir into each object, for link time resolution if [[ -z "${LD_RUN_PATH}" ]]; then @@ -263,7 +284,7 @@ main() PARALLEL=$(sysctl -n hw.ncpu) else msg_error "Unsupported system: '${OS}'" - msg_error " Unable to determine value for '--parallel='" + msg_error " Unable to determine value for --build-parallel" msg_error " Please specify explicitly to continue." msg_error "" help @@ -377,12 +398,6 @@ main() CONFIGURE_OPTIONS=( "${REMAP[@]}" ) unset REMAP - # handle help - if [[ "${DISPLAY_HELP}" == "yes" ]]; then - help - return 0 - fi - msg_heading "Configuration" display_build_variables @@ -441,6 +456,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${secp256k1_FLAGS[@]}" build_cmake "secp256k1" "." "${PARALLEL}" "${secp256k1_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "secp256k1" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "secp256k1" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" fi @@ -449,6 +467,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_system_FLAGS[@]}" build_preset "libbitcoin-system" "builds/cmake" "${PARALLEL}" "${libbitcoin_system_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-system" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-system" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_database_OWNER}" "libbitcoin-database" "${libbitcoin_database_TAG}" @@ -459,6 +480,9 @@ main() test_make "libbitcoin-database" "test" "${PARALLEL}" fi install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -604,11 +628,16 @@ test_make() local RESULT=$? - # Test runners emit to the test.log file. + if [[ -e "Testing/Temporary/LastTest.log" ]]; then + msg_warn "begin error log: Testing/Temporary/LastTest.log" + cat "Testing/Temporary/LastTest.log" + msg_warn " end error log: Testing/Temporary/LastTest.log" + fi + if [[ -e "test.log" ]]; then - msg_warn "test.log - begin" + msg_warn "begin error log: test.log" cat "test.log" - msg_warn "test.log - end" + msg_warn " end error log: test.log" fi if [[ ${RESULT} -ne 0 ]]; then @@ -624,6 +653,38 @@ test_make() msg_success "'${PROJECT}' test complete." } +clean_make() +{ + local PROJECT="$1" + shift 1 + + msg "Preparing to clean ${PROJECT}" + + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + + if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then + push_directory "${BUILD_OBJ_DIR}" + else + push_directory "${BUILD_OBJ_DIR}/${PROJECT}" + fi + + disable_exit_on_error + + make clean + + local RESULT=$? + + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." + exit ${RESULT} + fi + + pop_directory # BUILD_OBJ_DIR + pop_directory # BUILD_SRC_DIR/PROJECT + + msg_success "'${PROJECT}' clean complete." +} + build_boost() { local PROJECT="$1" @@ -822,6 +883,7 @@ display_build_variables() msg "BUILD_CONFIG : ${BUILD_CONFIG}" msg "BUILD_LINK : ${BUILD_LINK}" msg "BUILD_FULL_REPOSITORIES : ${BUILD_FULL_REPOSITORIES}" + msg "BUILD_POST_INSTALL_CLEAN : ${BUILD_POST_INSTALL_CLEAN}" msg "BUILD_USE_LOCAL_SRC : ${BUILD_USE_LOCAL_SRC}" msg "BUILD_SKIP_TESTS : ${BUILD_SKIP_TESTS}" msg "PARALLEL : ${PARALLEL}" @@ -871,15 +933,26 @@ help() msg "Script managing the build and installation of libbitcoin-database and its dependencies." msg "" msg "Script options:" + msg "-Denable-avx2= Use Intel AVX2 intrinsics." + msg " Default: OFF" + msg "-Denable-avx512= Use Intel AVX512 intrinsics." + msg " Default: OFF" + msg "-Denable-sse41= Use SSE4.1 hardware instructions." + msg " Default: OFF" + msg "-Denable-shani= Use Intel/ARM SHA Extensions." + msg " Default: OFF" msg "--build-boost Build Boost libraries" msg "--build-secp256k1 Build libsecp256k1 libraries" - msg "--build-preset= Preset configuration to build." - msg "--build-src-dir= Location of sources." + msg "--build-preset= Specifies preset configuration to build." + msg "--build-src-dir= Location for sources." + msg " Default: $(pwd)" msg "--build-full-repositories Sync full github repositories." - msg " Default clones depth 1, single branch" + msg " Default: git clone --depth 1 --single-branch" + msg "--build-post-install-clean Clean dependencies after installation (saves space)." + msg "--build-skip-tests Skip test compilation and execution." msg "--build-parallel= Number of jobs to run simultaneously." - msg " Default: discovery" - msg "--build-use-local-src Use existing sources in build-src-dir path." + msg " Default: supported platforms use nproc/sysctl" + msg "--build-use-local-src Use existing sources in relevant paths." msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index 4fd3ae0a..3fceb156 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -8,23 +8,35 @@ # Script managing the build and installation of libbitcoin-database and its dependencies. # # Script options: +# ---avx2 Use Intel AVX2 intrinsics. +# Default: --disable-avx2 +# ---avx512 Use Intel AVX512 intrinsics. +# Default: --disable-avx512 +# ---sse41 Use SSE4.1 hardware instructions. +# Default: --disable-sse41 +# ---shani Use Intel/ARM SHA Extensions. +# Default: --disable-shani # --build-boost Build Boost libraries # --build-secp256k1 Build libsecp256k1 libraries -# --build-src-dir= Location of sources. -# --build-obj-dir= Location of intermedia objects. -# --build-obj-dir-relative Use build-obj-dir as relative to project sources. +# --build-src-dir= Location for sources. +# Default: $(pwd) +# --build-obj-dir= Location for intermediate objects. +# Default: obj +# --build-obj-dir-relative Interpret build-obj-dir as relative to project sources. # --build-config= Specifies the build configuration. -# Valid values: { debug, release } +# Values: { debug, release } # Toolchain default behavior will occur if no value specified. -# --build-link= Specifies link mode. -# Valid values: { dynamic, static } +# --build-link= Specifies the link mode. +# Values: { dynamic, static } # Toolchain default behavior will occur if no value specified. # --build-full-repositories Sync full github repositories. -# Default clones depth 1, single branch +# Default: git clone --depth 1 --single-branch +# --build-post-install-clean Clean dependencies after installation (saves space). +# --build-skip-tests Skip test compilation and execution. # --build-parallel= Number of jobs to run simultaneously. -# Default: discovery -# --build-use-local-src Use existing sources in build-src-dir path. -# --prefix= Library install location. +# Default: supported platforms use nproc/sysctl +# --build-use-local-src Use existing sources in relevant paths. +# --prefix= Installation destination. # Default: /usr/local # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. @@ -82,9 +94,10 @@ main() (--build-config=*) BUILD_CONFIG="${OPTION#*=}";; (--build-link=*) BUILD_LINK="${OPTION#*=}";; (--build-full-repositories) BUILD_FULL_REPOSITORIES="yes";; - (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; - (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-post-install-clean)BUILD_POST_INSTALL_CLEAN="yes";; (--build-skip-tests) BUILD_SKIP_TESTS="yes";; + (--build-parallel=*) PARALLEL="${OPTION#*=}";; + (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; @@ -93,9 +106,22 @@ main() CONFIGURE_OPTIONS_ORIGINAL=("$@") CONFIGURE_OPTIONS=("$@") - CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-boost/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-secp256k1/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-src-dir=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-obj-dir=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-obj-dir-relative/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-config=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-link=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-full-repositories/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-post-install-clean/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-skip-tests/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") msg_verbose "*** ARGUMENTS: ${CONFIGURE_OPTIONS_ORIGINAL[*]}" msg_verbose "*** SANITIZED: ${CONFIGURE_OPTIONS[*]}" @@ -103,6 +129,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -114,63 +146,57 @@ main() msg_verbose "No build-src-dir specified, using default '${BUILD_SRC_DIR}'." fi - if [[ -d "${BUILD_SRC_DIR}" ]]; then - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-src-dir '${BUILD_SRC_DIR}'." - else + if ! [[ -d "${BUILD_SRC_DIR}" ]]; then create_directory "${BUILD_SRC_DIR}" - push_directory "${BUILD_SRC_DIR}" - BUILD_SRC_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-src-dir '${BUILD_SRC_DIR}'." + msg_verbose "Created --build-src-dir '${BUILD_SRC_DIR}'." fi + push_directory "${BUILD_SRC_DIR}" + BUILD_SRC_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-src-dir '${BUILD_SRC_DIR}'." + # --build-obj-dir if [[ -z "${BUILD_OBJ_DIR}" ]]; then if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then BUILD_OBJ_DIR="obj" - msg_verbose "No build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using relative default '${BUILD_OBJ_DIR}'." else BUILD_OBJ_DIR="$(pwd)/obj" - msg_verbose "No build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." + msg_verbose "No --build-obj-dir specified, using default '${BUILD_OBJ_DIR}'." fi fi if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then - msg_verbose "Deferring relative path action for build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Deferring relative path action for --build-obj-dir '${BUILD_OBJ_DIR}'." else - if [[ -d "${BUILD_OBJ_DIR}" ]]; then - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Determined absolute path for build-obj-dir '${BUILD_OBJ_DIR}'." - else + if ! [[ -d "${BUILD_OBJ_DIR}" ]]; then create_directory "${BUILD_OBJ_DIR}" - push_directory "${BUILD_OBJ_DIR}" - BUILD_OBJ_DIR="$(pwd)" - pop_directory - msg_verbose "Created build-obj-dir '${BUILD_OBJ_DIR}'." + msg_verbose "Created --build-obj-dir '${BUILD_OBJ_DIR}'." fi + + push_directory "${BUILD_OBJ_DIR}" + BUILD_OBJ_DIR="$(pwd)" + pop_directory + msg_verbose "Determined absolute path for --build-obj-dir '${BUILD_OBJ_DIR}'." fi # --build-config if [[ -z "${BUILD_CONFIG}" ]]; then - msg_verbose "No build-config specified." + msg_verbose "No --build-config specified." elif [[ "${BUILD_CONFIG}" != "debug" ]] && [[ "${BUILD_CONFIG}" != "release" ]]; then - msg_error "Provided build-config '${BUILD_CONFIG}' not a valid value." + msg_error "Provided --build-config '${BUILD_CONFIG}' not a valid value." help exit 1 else - msg_verbose "Using provided build-config '${BUILD_CONFIG}'" + msg_verbose "Using provided --build-config '${BUILD_CONFIG}'" fi # --build-link if [[ -z "${BUILD_LINK}" ]]; then - msg_verbose "No build-link specified." + msg_verbose "No --build-link specified." elif [[ "${BUILD_LINK}" != "dynamic" ]] && [[ "${BUILD_LINK}" != "static" ]]; then - msg_error "Provided build-link '${BUILD_LINK}' not a valid value." + msg_error "Provided --build-link '${BUILD_LINK}' not a valid value." help exit 1 fi @@ -179,7 +205,7 @@ main() if [[ -z "${PREFIX}" ]]; then # Always set a prefix (required for OSX and lib detection). PREFIX="/usr/local" - msg_verbose "No prefix specified, defaulting to '${PREFIX}'." + msg_verbose "No --prefix specified, defaulting to '${PREFIX}'." else # Incorporate the custom libdir into each object, for link time resolution if [[ -z "${LD_RUN_PATH}" ]]; then @@ -221,7 +247,7 @@ main() PARALLEL=$(sysctl -n hw.ncpu) else msg_error "Unsupported system: '${OS}'" - msg_error " Unable to determine value for '--parallel='" + msg_error " Unable to determine value for --build-parallel" msg_error " Please specify explicitly to continue." msg_error "" help @@ -338,12 +364,6 @@ main() CONFIGURE_OPTIONS=( "${REMAP[@]}" ) unset REMAP - # handle help - if [[ "${DISPLAY_HELP}" == "yes" ]]; then - help - return 0 - fi - msg_heading "Configuration" display_build_variables @@ -406,6 +426,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${secp256k1_FLAGS[@]}" build_gnu "secp256k1" "." "${PARALLEL}" "${secp256k1_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "secp256k1" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "secp256k1" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" fi @@ -414,6 +437,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_system_FLAGS[@]}" build_gnu "libbitcoin-system" "." "${PARALLEL}" "${libbitcoin_system_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-system" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-system" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_database_OWNER}" "libbitcoin-database" "${libbitcoin_database_TAG}" @@ -424,6 +450,9 @@ main() test_make "libbitcoin-database" "check" "${PARALLEL}" fi install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -569,11 +598,16 @@ test_make() local RESULT=$? - # Test runners emit to the test.log file. + if [[ -e "test-suite.log" ]]; then + msg_warn "begin error log: test-suite.log" + cat "test-suite.log" + msg_warn " end error log: test-suite.log" + fi + if [[ -e "test.log" ]]; then - msg_warn "test.log - begin" + msg_warn "begin error log: test.log" cat "test.log" - msg_warn "test.log - end" + msg_warn " end error log: test.log" fi if [[ ${RESULT} -ne 0 ]]; then @@ -589,6 +623,38 @@ test_make() msg_success "'${PROJECT}' test complete." } +clean_make() +{ + local PROJECT="$1" + shift 1 + + msg "Preparing to clean ${PROJECT}" + + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + + if [[ "${BUILD_OBJ_DIR_RELATIVE}" == "yes" ]]; then + push_directory "${BUILD_OBJ_DIR}" + else + push_directory "${BUILD_OBJ_DIR}/${PROJECT}" + fi + + disable_exit_on_error + + make clean + + local RESULT=$? + + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." + exit ${RESULT} + fi + + pop_directory # BUILD_OBJ_DIR + pop_directory # BUILD_SRC_DIR/PROJECT + + msg_success "'${PROJECT}' clean complete." +} + build_boost() { local PROJECT="$1" @@ -741,6 +807,7 @@ display_build_variables() msg "BUILD_CONFIG : ${BUILD_CONFIG}" msg "BUILD_LINK : ${BUILD_LINK}" msg "BUILD_FULL_REPOSITORIES : ${BUILD_FULL_REPOSITORIES}" + msg "BUILD_POST_INSTALL_CLEAN : ${BUILD_POST_INSTALL_CLEAN}" msg "BUILD_USE_LOCAL_SRC : ${BUILD_USE_LOCAL_SRC}" msg "BUILD_SKIP_TESTS : ${BUILD_SKIP_TESTS}" msg "PARALLEL : ${PARALLEL}" @@ -786,23 +853,35 @@ help() msg "Script managing the build and installation of libbitcoin-database and its dependencies." msg "" msg "Script options:" + msg "---avx2 Use Intel AVX2 intrinsics." + msg " Default: --disable-avx2" + msg "---avx512 Use Intel AVX512 intrinsics." + msg " Default: --disable-avx512" + msg "---sse41 Use SSE4.1 hardware instructions." + msg " Default: --disable-sse41" + msg "---shani Use Intel/ARM SHA Extensions." + msg " Default: --disable-shani" msg "--build-boost Build Boost libraries" msg "--build-secp256k1 Build libsecp256k1 libraries" - msg "--build-src-dir= Location of sources." - msg "--build-obj-dir= Location of intermedia objects." - msg "--build-obj-dir-relative Use build-obj-dir as relative to project sources." + msg "--build-src-dir= Location for sources." + msg " Default: $(pwd)" + msg "--build-obj-dir= Location for intermediate objects." + msg " Default: obj" + msg "--build-obj-dir-relative Interpret build-obj-dir as relative to project sources." msg "--build-config= Specifies the build configuration." - msg " Valid values: { debug, release }" + msg " Values: { debug, release }" msg " Toolchain default behavior will occur if no value specified." - msg "--build-link= Specifies link mode." - msg " Valid values: { dynamic, static }" + msg "--build-link= Specifies the link mode." + msg " Values: { dynamic, static }" msg " Toolchain default behavior will occur if no value specified." msg "--build-full-repositories Sync full github repositories." - msg " Default clones depth 1, single branch" + msg " Default: git clone --depth 1 --single-branch" + msg "--build-post-install-clean Clean dependencies after installation (saves space)." + msg "--build-skip-tests Skip test compilation and execution." msg "--build-parallel= Number of jobs to run simultaneously." - msg " Default: discovery" - msg "--build-use-local-src Use existing sources in build-src-dir path." - msg "--prefix= Library install location." + msg " Default: supported platforms use nproc/sysctl" + msg "--build-use-local-src Use existing sources in relevant paths." + msg "--prefix= Installation destination." msg " Default: /usr/local" msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." diff --git a/builds/msvc/build-msvc.cmd b/builds/msvc/build-msvc.cmd index 087dd180..f007aaf5 100644 --- a/builds/msvc/build-msvc.cmd +++ b/builds/msvc/build-msvc.cmd @@ -14,13 +14,16 @@ REM Script options: REM --build-config config Build configuration. REM --build-platform platform Build platform. REM --build-version version Build MSVC version. -REM --build-src-dir path Location of sources. -REM --build-full-repositories Sync full github repositories. -REM --build-use-local-src Use existing sources in build-src-dir path. REM --build-mode mode Determines action on target. REM Default: Rebuild REM --build-symbols mode Determines treatment of symbols. -REM Values: default, disabled, public-only +REM Values: { default, disabled, public-only } +REM --build-src-dir path Location for sources. +REM Default: !CD! +REM --build-full-repositories Sync full github repositories. +REM Default: git clone --depth 1 --single-branch +REM --build-skip-tests Skip test compilation and execution. +REM --build-use-local-src Use existing sources in relevant paths. REM --verbose Display verbose script output. REM --help, -h Display usage, overriding script execution. REM @@ -57,7 +60,7 @@ if "!libbitcoin_database_TAG!" == "" ( call :display_constants ) - if "!SHOW_HELP!" == "yes" ( + if "!DISPLAY_HELP!" == "yes" ( call :help exit /b 0 ) @@ -190,9 +193,6 @@ if "!libbitcoin_database_TAG!" == "" ( :parse_input if "%~1" == "" ( goto :end_parse_input - ) else if "%~1" == "--build-src-dir" ( - set "BUILD_SRC_DIR=%~2" - shift ) else if "%~1" == "--build-config" ( set "BUILD_CONFIG=%~2" shift @@ -202,26 +202,27 @@ if "!libbitcoin_database_TAG!" == "" ( ) else if "%~1" == "--build-version" ( set "BUILD_VERSION=%~2" shift - ) else if "%!1" == "--build-mode" ( + ) else if "%~1" == "--build-mode" ( set "BUILD_MODE=%~2" shift - ) else if "%!1" == "--build-symbols" ( + ) else if "%~1" == "--build-symbols" ( set "BUILD_SYMBOLS=%~2" shift + ) else if "%~1" == "--build-src-dir" ( + set "BUILD_SRC_DIR=%~2" + shift ) else if "%~1" == "--build-full-repositories" ( set "BUILD_FULL_REPOSITORIES=yes" - ) else if "%~1" == "--build-use-local-src" ( - set "BUILD_USE_LOCAL_SRC=yes" ) else if "%~1" == "--build-skip-tests" ( set "BUILD_SKIP_TESTS=yes" + ) else if "%~1" == "--build-use-local-src" ( + set "BUILD_USE_LOCAL_SRC=yes" ) else if "%~1" == "--verbose" ( set "DISPLAY_VERBOSE=yes" - ) else if "%~1" == "-v" ( - set "DISPLAY_VERBOSE=yes" ) else if "%~1" == "--help" ( - set "SHOW_HELP=yes" + set "DISPLAY_HELP=yes" ) else if "%~1" == "-h" ( - set "SHOW_HELP=yes" + set "DISPLAY_HELP=yes" ) else ( if "!UNHANDLED_ARGS!" == "" ( set "UNHANDLED_ARGS=%1" @@ -345,7 +346,7 @@ if "!libbitcoin_database_TAG!" == "" ( call :msg "BUILD_MODE : !BUILD_MODE!" call :msg "BUILD_SYMBOLS : !BUILD_SYMBOLS!" call :msg "DISPLAY_VERBOSE : !DISPLAY_VERBOSE!" - call :msg "SHOW_HELP : !SHOW_HELP!" + call :msg "DISPLAY_HELP : !DISPLAY_HELP!" exit /b %ERRORLEVEL% @@ -368,13 +369,16 @@ if "!libbitcoin_database_TAG!" == "" ( call :msg "--build-config config Build configuration." call :msg "--build-platform platform Build platform." call :msg "--build-version version Build MSVC version." - call :msg "--build-src-dir path Location of sources." - call :msg "--build-full-repositories Sync full github repositories." - call :msg "--build-use-local-src Use existing sources in build-src-dir path." call :msg "--build-mode mode Determines action on target." call :msg " Default: Rebuild" call :msg "--build-symbols mode Determines treatment of symbols." - call :msg " Values: default, disabled, public-only" + call :msg " Values: { default, disabled, public-only }" + call :msg "--build-src-dir path Location for sources." + call :msg " Default: !CD!" + call :msg "--build-full-repositories Sync full github repositories." + call :msg " Default: git clone --depth 1 --single-branch" + call :msg "--build-skip-tests Skip test compilation and execution." + call :msg "--build-use-local-src Use existing sources in relevant paths." call :msg "--verbose Display verbose script output." call :msg "--help, -h Display usage, overriding script execution." exit /b %ERRORLEVEL%