diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c39af553..38675710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,6 +166,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 }}" @@ -195,17 +196,41 @@ 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 + if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + fi + if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + fi + if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + fi + if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" fi - name: Test artifact upload @@ -213,7 +238,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 @@ -372,6 +397,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 }}" @@ -401,17 +427,41 @@ 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 + if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + fi + if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + fi + if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + fi + if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" fi - name: Test artifact upload @@ -419,7 +469,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 @@ -567,17 +617,41 @@ 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 + if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + fi + if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + fi + if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + fi + if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" fi - name: Test artifact upload @@ -585,7 +659,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 44a3687f..63c17867 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -8,23 +8,37 @@ # Script managing the build and installation of libbitcoin-node 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 +# -Dwith-ssl= Use embedded ssl library. +# Default: ON # --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. @@ -96,9 +110,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";; @@ -111,9 +126,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[*]}" @@ -121,6 +149,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -132,63 +166,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 @@ -197,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 @@ -256,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 @@ -370,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 @@ -446,6 +468,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 @@ -454,6 +479,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}" @@ -461,6 +489,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_database_FLAGS[@]}" build_cmake "libbitcoin-database" "builds/cmake" "${PARALLEL}" "${libbitcoin_database_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_network_OWNER}" "libbitcoin-network" "${libbitcoin_network_TAG}" @@ -468,6 +499,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_network_FLAGS[@]}" build_cmake "libbitcoin-network" "builds/cmake" "${PARALLEL}" "${libbitcoin_network_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-network" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-network" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_node_OWNER}" "libbitcoin-node" "${libbitcoin_node_TAG}" @@ -478,6 +512,9 @@ main() test_make "libbitcoin-node" "test" "${PARALLEL}" fi install_make "libbitcoin-node" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-node" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -623,11 +660,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 @@ -643,6 +685,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" @@ -790,6 +864,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}" @@ -845,23 +920,37 @@ help() msg "Script managing the build and installation of libbitcoin-node 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 "-Dwith-ssl= Use embedded ssl library." + msg " Default: ON" 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 8d045ae0..b2a32c3b 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -8,15 +8,28 @@ # Script managing the build and installation of libbitcoin-node 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 +# -Dwith-ssl= Use embedded ssl library. +# Default: ON # --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. # @@ -84,9 +97,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#*=}";; @@ -98,9 +112,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[*]}" @@ -108,6 +131,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -115,7 +144,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 @@ -148,18 +177,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}" @@ -170,46 +196,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 @@ -218,7 +241,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 @@ -277,7 +300,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 @@ -391,12 +414,6 @@ main() CONFIGURE_OPTIONS=( "${REMAP[@]}" ) unset REMAP - # handle help - if [[ "${DISPLAY_HELP}" == "yes" ]]; then - help - return 0 - fi - msg_heading "Configuration" display_build_variables @@ -467,6 +484,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 @@ -475,6 +495,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}" @@ -482,6 +505,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_database_FLAGS[@]}" build_preset "libbitcoin-database" "builds/cmake" "${PARALLEL}" "${libbitcoin_database_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_network_OWNER}" "libbitcoin-network" "${libbitcoin_network_TAG}" @@ -489,6 +515,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_network_FLAGS[@]}" build_preset "libbitcoin-network" "builds/cmake" "${PARALLEL}" "${libbitcoin_network_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-network" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-network" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_node_OWNER}" "libbitcoin-node" "${libbitcoin_node_TAG}" @@ -499,6 +528,9 @@ main() test_make "libbitcoin-node" "test" "${PARALLEL}" fi install_make "libbitcoin-node" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-node" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -644,11 +676,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 @@ -664,6 +701,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" @@ -862,6 +931,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}" @@ -917,15 +987,28 @@ help() msg "Script managing the build and installation of libbitcoin-node 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 "-Dwith-ssl= Use embedded ssl library." + msg " Default: ON" 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 e5e856dc..bf033206 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -8,23 +8,37 @@ # Script managing the build and installation of libbitcoin-node 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 +# ---ssl Use embedded ssl library. +# Default: --with-ssl # --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. @@ -96,9 +110,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";; @@ -107,9 +122,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[*]}" @@ -117,6 +145,12 @@ main() display_build_variables fi + # handle help + if [[ "${DISPLAY_HELP}" == "yes" ]]; then + help + return 0 + fi + OS=$(uname -s) @@ -128,63 +162,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 @@ -193,7 +221,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 @@ -235,7 +263,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 @@ -352,12 +380,6 @@ main() CONFIGURE_OPTIONS=( "${REMAP[@]}" ) unset REMAP - # handle help - if [[ "${DISPLAY_HELP}" == "yes" ]]; then - help - return 0 - fi - msg_heading "Configuration" display_build_variables @@ -435,6 +457,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 @@ -443,6 +468,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}" @@ -450,6 +478,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_database_FLAGS[@]}" build_gnu "libbitcoin-database" "." "${PARALLEL}" "${libbitcoin_database_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-database" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-database" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_network_OWNER}" "libbitcoin-network" "${libbitcoin_network_TAG}" @@ -457,6 +488,9 @@ main() export CPPFLAGS="${CPPFLAGS} ${libbitcoin_network_FLAGS[@]}" build_gnu "libbitcoin-network" "." "${PARALLEL}" "${libbitcoin_network_OPTIONS[@]}" "${CONFIGURE_OPTIONS[@]}" install_make "libbitcoin-network" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-network" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" source_github "${libbitcoin_node_OWNER}" "libbitcoin-node" "${libbitcoin_node_TAG}" @@ -467,6 +501,9 @@ main() test_make "libbitcoin-node" "check" "${PARALLEL}" fi install_make "libbitcoin-node" + if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then + clean_make "libbitcoin-node" + fi export CPPFLAGS="${SAVE_CPPFLAGS}" msg_success "Completed successfully." @@ -612,11 +649,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 @@ -632,6 +674,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" @@ -784,6 +858,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}" @@ -835,23 +910,37 @@ help() msg "Script managing the build and installation of libbitcoin-node 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 "---ssl Use embedded ssl library." + msg " Default: --with-ssl" 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 58431bd7..5091a69e 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 @@ -71,7 +74,7 @@ if "!libbitcoin_node_TAG!" == "" ( call :display_constants ) - if "!SHOW_HELP!" == "yes" ( + if "!DISPLAY_HELP!" == "yes" ( call :help exit /b 0 ) @@ -218,9 +221,6 @@ if "!libbitcoin_node_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 @@ -230,26 +230,27 @@ if "!libbitcoin_node_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" @@ -373,7 +374,7 @@ if "!libbitcoin_node_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% @@ -400,13 +401,16 @@ if "!libbitcoin_node_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%