diff --git a/contrib/devtools/build_depends.sh b/contrib/devtools/build_depends.sh index 77bd30647..d0b1f5d27 100755 --- a/contrib/devtools/build_depends.sh +++ b/contrib/devtools/build_depends.sh @@ -1,36 +1,41 @@ #!/usr/bin/env bash export LC_ALL=C set -euxo pipefail : "${TOPLEVEL:=$(git rev-parse --show-toplevel)}" : "${DEPENDS_DIR:=${TOPLEVEL}/depends}" : "${SDK_PATH:=${DEPENDS_DIR}/SDKs}" : "${SDK_ARCHIVE_DIR:=${SDK_PATH}}" +DEPENDS_BUILD_TARGET="${1:-all}" + pushd "${DEPENDS_DIR}" -# Get the OSX SDK -mkdir -p "${SDK_PATH}" -pushd "${SDK_PATH}" +if [ "${DEPENDS_BUILD_TARGET}" = "osx" ] +then + # Get the OSX SDK + mkdir -p "${SDK_PATH}" + pushd "${SDK_PATH}" -find . -maxdepth 1 -type d -name "MacOSX*" -exec rm -rf {} \; + find . -maxdepth 1 -type d -name "MacOSX*" -exec rm -rf {} \; -SDK_ARCHIVE_NAME="MacOSX10.14.sdk.tar.gz" -OSX_SDK_SHA256="2322086a96349db832abbcadea493b79db843553a2e604163238d99fa058a286" + SDK_ARCHIVE_NAME="MacOSX10.14.sdk.tar.gz" + OSX_SDK_SHA256="2322086a96349db832abbcadea493b79db843553a2e604163238d99fa058a286" -OSX_SDK="${SDK_ARCHIVE_DIR}/${SDK_ARCHIVE_NAME}" -if ! echo "${OSX_SDK_SHA256} ${OSX_SDK}" | sha256sum -c; then - rm -f "${OSX_SDK}" - wget https://storage.googleapis.com/27cd7b2a42a430926cc621acdc3bda72a8ed2b0efc080e3/"${SDK_ARCHIVE_NAME}" -O "${OSX_SDK}" - echo "${OSX_SDK_SHA256} ${OSX_SDK}" | sha256sum -c -fi + OSX_SDK="${SDK_ARCHIVE_DIR}/${SDK_ARCHIVE_NAME}" + if ! echo "${OSX_SDK_SHA256} ${OSX_SDK}" | sha256sum -c; then + rm -f "${OSX_SDK}" + wget https://storage.googleapis.com/27cd7b2a42a430926cc621acdc3bda72a8ed2b0efc080e3/"${SDK_ARCHIVE_NAME}" -O "${OSX_SDK}" + echo "${OSX_SDK_SHA256} ${OSX_SDK}" | sha256sum -c + fi -tar -xzf "${OSX_SDK}" + tar -xzf "${OSX_SDK}" -popd + popd +fi -make build-all +make "build-${DEPENDS_BUILD_TARGET}" popd diff --git a/contrib/teamcity/builds/build-linux-aarch64.sh b/contrib/teamcity/builds/build-linux-aarch64.sh index 496305a7e..c510279fa 100755 --- a/contrib/teamcity/builds/build-linux-aarch64.sh +++ b/contrib/teamcity/builds/build-linux-aarch64.sh @@ -1,37 +1,37 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" -build_static_dependencies +build_static_dependencies linux-aarch64 CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/LinuxAArch64.cmake" # This will prepend our executable commands with the given emulator call "-DCMAKE_CROSSCOMPILING_EMULATOR=$(command -v qemu-aarch64-static)" # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. "-DHAVE_DECL_GETIFADDRS=OFF" ) build_with_cmake --junit ninja -k0 check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux-arm.sh b/contrib/teamcity/builds/build-linux-arm.sh index 86004920d..701d9b6ec 100755 --- a/contrib/teamcity/builds/build-linux-arm.sh +++ b/contrib/teamcity/builds/build-linux-arm.sh @@ -1,37 +1,37 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" -build_static_dependencies +build_static_dependencies linux-arm CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/LinuxARM.cmake" # This will prepend our executable commands with the given emulator call "-DCMAKE_CROSSCOMPILING_EMULATOR=$(command -v qemu-arm-static)" # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. "-DHAVE_DECL_GETIFADDRS=OFF" ) build_with_cmake --junit ninja check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux32.sh b/contrib/teamcity/builds/build-linux32.sh index c9824f1b7..d10d9fe40 100755 --- a/contrib/teamcity/builds/build-linux32.sh +++ b/contrib/teamcity/builds/build-linux32.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" -build_static_dependencies +build_static_dependencies linux32 # Build, run unit tests and functional tests. CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/Linux32.cmake" ) build_with_cmake --junit ninja -k0 check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux64.sh b/contrib/teamcity/builds/build-linux64.sh index 79eb48c65..4142fb24f 100755 --- a/contrib/teamcity/builds/build-linux64.sh +++ b/contrib/teamcity/builds/build-linux64.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" -build_static_dependencies +build_static_dependencies linux64 # Build, run unit tests and functional tests. CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/Linux64.cmake" ) build_with_cmake --junit ninja -k0 check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-osx.sh b/contrib/teamcity/builds/build-osx.sh index cd2472ab1..f0dd9458b 100755 --- a/contrib/teamcity/builds/build-osx.sh +++ b/contrib/teamcity/builds/build-osx.sh @@ -1,22 +1,22 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin16/native/lib/python3/dist-packages:${PYTHONPATH:-}" -build_static_dependencies +build_static_dependencies osx CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/OSX.cmake" ) build_with_cmake # Build all the targets that are not built as part of the default target ninja test_bitcoin test_bitcoin-qt test-seeder ninja osx-dmg diff --git a/contrib/teamcity/builds/build-win64.sh b/contrib/teamcity/builds/build-win64.sh index 449d1a6b9..6648ea517 100755 --- a/contrib/teamcity/builds/build-win64.sh +++ b/contrib/teamcity/builds/build-win64.sh @@ -1,36 +1,36 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail # shellcheck source=../ci-fixture.sh source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" -build_static_dependencies +build_static_dependencies win64 CMAKE_FLAGS=( "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/Win64.cmake" "-DBUILD_BITCOIN_SEEDER=OFF" "-DCPACK_STRIP_FILES=ON" ) build_with_cmake # Build all the targets that are not built as part of the default target ninja test_bitcoin test_bitcoin-qt ninja package # Running the tests with wine and jemalloc is causing deadlocks, so disable # jemalloc prior running the tests. # FIXME figure out what is causing the deadlock. Example output: # 01fe:err:ntdll:RtlpWaitForCriticalSection section 0x39e081b0 "?" wait # timed out in thread 01fe, blocked by 01cd, retrying (60 sec) CMAKE_FLAGS+=( "-DUSE_JEMALLOC=OFF" ) build_with_cmake test_bitcoin # Run the tests. Not all will run with wine, so exclude them find src -name "libbitcoinconsensus*.dll" -exec cp {} src/test/ \; wine ./src/test/test_bitcoin.exe --run_test=\!radix_tests,rcu_tests diff --git a/contrib/teamcity/ci-fixture.sh b/contrib/teamcity/ci-fixture.sh index 36be1bbd8..22b69af49 100755 --- a/contrib/teamcity/ci-fixture.sh +++ b/contrib/teamcity/ci-fixture.sh @@ -1,28 +1,28 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail : "${TOPLEVEL:=$(git rev-parse --show-toplevel)}" : "${BUILD_DIR:=${TOPLEVEL}/build}" DEVTOOLS_DIR="${TOPLEVEL}/contrib/devtools" # It is valid to call the function with no argument, so ignore SC2120 # shellcheck disable=SC2120 build_with_cmake() { CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh "$@" } build_with_autotools() { CONFIGURE_FLAGS="${CONFIGURE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_autotools.sh "$@" } run_ibd() { "${TOPLEVEL}"/contrib/teamcity/ibd.sh "$@" } build_static_dependencies() { - "${DEVTOOLS_DIR}"/build_depends.sh + "${DEVTOOLS_DIR}"/build_depends.sh "$@" }