diff --git a/cmake/platforms/OSX.cmake b/cmake/platforms/OSX.cmake index ff910ab95..6506b4210 100644 --- a/cmake/platforms/OSX.cmake +++ b/cmake/platforms/OSX.cmake @@ -1,57 +1,57 @@ # Copyright (c) 2017 The Bitcoin developers set(CMAKE_SYSTEM_NAME Darwin) set(CMAKE_SYSTEM_PROCESSOR x86_64) -set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-apple-darwin19) +set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-apple-darwin) # Set Corrosion Rust target set(Rust_CARGO_TARGET "x86_64-apple-darwin") # On OSX, we use clang by default. set(CMAKE_C_COMPILER clang) set(CMAKE_CXX_COMPILER clang++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(OSX_MIN_VERSION 10.15) # OSX_SDK_VERSION 10.15.6 # Note: don't use XCODE_VERSION, it's a cmake built-in variable ! set(SDK_XCODE_VERSION 12.1) set(SDK_XCODE_BUILD_ID 12A7403) set(LD64_VERSION 609) # On OSX we use various stuff from Apple's SDK. set(OSX_SDK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/SDKs/Xcode-${SDK_XCODE_VERSION}-${SDK_XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers") set(CMAKE_OSX_SYSROOT "${OSX_SDK_PATH}") set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_MIN_VERSION}) set(CMAKE_OSX_ARCHITECTURES x86_64) # target environment on the build host system # set 1st to dir with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};${OSX_SDK_PATH}") # We also may have built dependencies for the native plateform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # When cross-compiling for Darwin using Clang, -mlinker-version must be passed # to ensure that modern linker features are enabled. string(APPEND CMAKE_CXX_FLAGS_INIT " -stdlib=libc++ -mlinker-version=${LD64_VERSION}") # Ensure we use an OSX specific version the binary manipulation tools. find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar) find_program(CMAKE_INSTALL_NAME_TOOL ${TOOLCHAIN_PREFIX}-install_name_tool) find_program(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld) find_program(CMAKE_NM ${TOOLCHAIN_PREFIX}-nm) find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy) find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump) find_program(CMAKE_OTOOL ${TOOLCHAIN_PREFIX}-otool) find_program(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-ranlib) find_program(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip) diff --git a/contrib/devtools/build_cmake.sh b/contrib/devtools/build_cmake.sh index 7f2f9feb8..bdc79c91a 100755 --- a/contrib/devtools/build_cmake.sh +++ b/contrib/devtools/build_cmake.sh @@ -1,107 +1,107 @@ #!/usr/bin/env bash export LC_ALL=C set -euxo pipefail : "${TOPLEVEL:=$(git rev-parse --show-toplevel)}" : "${BUILD_DIR:=${TOPLEVEL}/build}" function usage() { echo "Usage: $0 [--Werror] [targets]" echo "Build the targets using cmake and ninja." echo "If no target is provided the default (all) target is built." echo echo "Options:" echo " --clang: build with clang/clang++" echo " --gcc: build with gcc/g++" echo " --junit: enable Junit reports generation" echo " --no-build: Only run the configuration step and skip the build" echo " --Werror: add -Werror to the compiler flags" echo "Environment variables:" echo " CMAKE_FLAGS: array of the CMAKE flags to use for the build" echo " BUILD_DIR: the build directory, (default: ${BUILD_DIR}})" echo " TOPLEVEL: the project root directory, (default: ${TOPLEVEL}})" } # Default to nothing : "${CMAKE_FLAGS:=}" mkdir -p "${BUILD_DIR}" cd ${BUILD_DIR} git clean -xffd || true read -a CMAKE_FLAGS <<< "${CMAKE_FLAGS}" BUILD="yes" TARGETS=() while [[ $# -gt 0 ]]; do case $1 in --clang) CMAKE_FLAGS+=( "-DCMAKE_C_COMPILER=clang" "-DCMAKE_CXX_COMPILER=clang++" ) shift ;; --gcc) CMAKE_FLAGS+=( "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" ) shift ;; --junit) CMAKE_FLAGS+=( "-DENABLE_JUNIT_REPORT=ON" ) shift ;; --no-build) BUILD="no" shift ;; --Werror) CMAKE_FLAGS+=( "-DCMAKE_C_FLAGS=-Werror" "-DCMAKE_CXX_FLAGS=-Werror" ) shift ;; *) TARGETS+=("$1") shift ;; esac done # If cross building for OSX, the python library needs to be added to the python # library path. -export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin19/native/lib/python3/dist-packages:${PYTHONPATH:-}" +export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin/native/lib/python3/dist-packages:${PYTHONPATH:-}" cmake -GNinja "${TOPLEVEL}" "${CMAKE_FLAGS[@]}" # If valid targets are given, use them, otherwise default to "all". if [ ${#TARGETS[@]} -eq 0 ]; then TARGETS=("all") else mapfile -t VALID_TARGETS < <(ninja -t targets all | cut -d ':' -f 1) # "all" is not part of the targets exported by ninja, so add it. VALID_TARGETS+=("all") IFS=" " for TARGET in "${TARGETS[@]}" do # The array prints as a space delimited word list, surround the target with # spaces to avoid partial match. if [[ ! " ${VALID_TARGETS[*]} " =~ \ ${TARGET}\ ]]; then echo "Trying to build an invalid target: ${TARGET}" exit 2 fi done fi # Run build if [ "${BUILD}" == "yes" ] then ninja "${TARGETS[@]}" fi diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 729d4f0a8..9d26959b0 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -1,183 +1,183 @@ --- name: "bitcoin-abc-osx" enable_cache: true distro: "debian" suites: - "bullseye" architectures: - "amd64" packages: - "autoconf" - "automake" - "bsdmainutils" - "ca-certificates" - "cmake" - "curl" - "faketime" - "fonts-tuffy" - "g++" - "git" - "imagemagick" - "libbz2-dev" - "libcap-dev" - "librsvg2-bin" - "libtiff-tools" - "libtinfo5" - "libtool" - "libz-dev" - "ninja-build" - "pkg-config" - "python3" - "python3-dev" - "python3-pip" - "python3-setuptools" - "xorriso" remotes: - "url": "https://github.com/Bitcoin-ABC/bitcoin-abc.git" "dir": "bitcoin" files: - "Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz" script: | WRAP_DIR=$HOME/wrapped HOSTS=( - x86_64-apple-darwin19 + x86_64-apple-darwin ) # CMake toolchain file name differ from host name declare -A CMAKE_TOOLCHAIN_FILE - CMAKE_TOOLCHAIN_FILE[x86_64-apple-darwin19]=OSX.cmake + CMAKE_TOOLCHAIN_FILE[x86_64-apple-darwin]=OSX.cmake FAKETIME_HOST_PROGS="" FAKETIME_PROGS="ar ranlib date xorrisofs" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} if test -n "$GBUILD_CACHE_ENABLED"; then export SOURCES_PATH=${GBUILD_COMMON_CACHE} export BASE_CACHE=${GBUILD_PACKAGE_CACHE} mkdir -p ${BASE_CACHE} ${SOURCES_PATH} fi export ZERO_AR_DATE=1 function create_global_faketime_wrappers { for prog in ${FAKETIME_PROGS}; do echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} echo "\$REAL \$@" >> $WRAP_DIR/${prog} chmod +x ${WRAP_DIR}/${prog} done } function create_per-host_faketime_wrappers { for i in ${HOSTS[@]}; do for prog in ${FAKETIME_HOST_PROGS}; do echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog} echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog} chmod +x ${WRAP_DIR}/${i}-${prog} done done } pip3 install lief==0.11.5 # Faketime for depends so intermediate results are comparable export PATH_orig=${PATH} create_global_faketime_wrappers "2000-01-01 12:00:00" create_per-host_faketime_wrappers "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} cd bitcoin SOURCEDIR=`pwd` BASEPREFIX=`pwd`/depends mkdir -p ${BASEPREFIX}/SDKs tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz # Build dependencies for each host for i in ${HOSTS[@]}; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done # Faketime for binaries export PATH=${PATH_orig} create_global_faketime_wrappers "${REFERENCE_DATETIME}" create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" export PATH=${WRAP_DIR}:${PATH} mkdir -p source_package pushd source_package # Any toolchain file will work for building the source package, just pick the # first one cmake -GNinja .. \ -DCMAKE_TOOLCHAIN_FILE=${SOURCEDIR}/cmake/platforms/${CMAKE_TOOLCHAIN_FILE[${HOSTS[0]}]} ninja package_source SOURCEDIST=`echo bitcoin-abc-*.tar.gz` mv ${SOURCEDIST} .. popd DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'` # Correct tar file order mkdir -p temp pushd temp tar -xf ../$SOURCEDIST find bitcoin-abc-* | sort | tar --mtime="${REFERENCE_DATETIME}" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST popd ORIGPATH="$PATH" # Extract the release tarball into a dir for each host and build for i in ${HOSTS[@]}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir -p distsrc-${i} cd distsrc-${i} INSTALLPATH=`pwd`/installed/${DISTNAME} mkdir -p ${INSTALLPATH} cmake -GNinja .. \ -DCMAKE_TOOLCHAIN_FILE=${SOURCEDIR}/cmake/platforms/${CMAKE_TOOLCHAIN_FILE[${i}]} \ -DCLIENT_VERSION_IS_RELEASE=ON \ -DENABLE_CLANG_TIDY=OFF \ -DENABLE_REDUCE_EXPORTS=ON \ -DCMAKE_INSTALL_PREFIX=${INSTALLPATH} \ -DCCACHE=OFF \ -DXORRISOFS_EXECUTABLE="${WRAP_DIR}/xorrisofs" ninja ninja security-check ninja symbol-check ninja install/strip export PYTHONPATH="${BASEPREFIX}/${i}/native/lib/python3/dist-packages:${PYTHONPATH}" ninja osx-deploydir OSX_VOLNAME="$(cat osx_volname)" mkdir -p unsigned-app-${i} cp osx_volname unsigned-app-${i}/ cp ../contrib/macdeploy/detached-sig-apply.sh unsigned-app-${i} cp ../contrib/macdeploy/detached-sig-create.sh unsigned-app-${i} cp ${BASEPREFIX}/${i}/native/bin/${i}-codesign_allocate unsigned-app-${i}/codesign_allocate cp ${BASEPREFIX}/${i}/native/bin/${i}-pagestuff unsigned-app-${i}/pagestuff mv dist unsigned-app-${i} pushd unsigned-app-${i} find . | sort | tar --mtime="${REFERENCE_DATETIME}" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz popd ninja osx-dmg mv "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg cd installed find -path "*.app*" -type f -executable -exec mv {} ${DISTNAME}/bin/bitcoin-qt \; find ${DISTNAME} -not -path "*.app*" | sort | tar --mtime="${REFERENCE_DATETIME}" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz cd ../../ done mkdir -p $OUTDIR/src mv $SOURCEDIST $OUTDIR/src mv ${OUTDIR}/${DISTNAME}-x86_64-*.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz diff --git a/contrib/guix/README.md b/contrib/guix/README.md index 9e4f67996..7e31fcddb 100644 --- a/contrib/guix/README.md +++ b/contrib/guix/README.md @@ -1,382 +1,382 @@ # Bootstrappable Bitcoin ABC Builds This directory contains the files necessary to perform bootstrappable Bitcoin ABC builds. [Bootstrappability][b17e] furthers our binary security guarantees by allowing us to _audit and reproduce_ our toolchain instead of blindly _trusting_ binary downloads. We achieve bootstrappability by using Guix as a functional package manager. # Requirements Conservatively, you will need an x86_64 machine with: - 16GB of free disk space on the partition that /gnu/store will reside in - 8GB of free disk space **per platform triple** you're planning on building (see the `HOSTS` [environment variable description][env-vars-list]) # Installation and Setup If you don't have Guix installed and set up, please follow the instructions in [INSTALL.md](./INSTALL.md) # Usage If you haven't considered your security model yet, please read [the relevant section](#choosing-your-security-model) before proceeding to perform a build. ## Making the Xcode SDK available for macOS cross-compilation In order to perform a build for macOS (which is included in the default set of platform triples to build), you'll need to extract the macOS SDK tarball using tools found in the [`macdeploy` directory](../macdeploy/README.md). You can then either point to the SDK using the `SDK_PATH` environment variable: ```sh # Extract the SDK tarball to /path/to/parent/dir/of/extracted/SDK/Xcode---extracted-SDK-with-libcxx-headers tar -C /path/to/parent/dir/of/extracted/SDK -xaf /path/to/Xcode---extracted-SDK-with-libcxx-headers.tar.gz # Indicate where to locate the SDK tarball export SDK_PATH=/path/to/parent/dir/of/extracted/SDK ``` or extract it into `depends/SDKs`: ```sh mkdir -p depends/SDKs tar -C depends/SDKs -xaf /path/to/SDK/tarball ``` ## Building *The author highly recommends at least reading over the [common usage patterns and examples](#common-guix-build-invocation-patterns-and-examples) section below before starting a build. For a full list of customization options, see the [recognized environment variables][env-vars-list] section.* To build Bitcoin ABC reproducibly with all default options, invoke the following from the top of a clean repository: ```sh ./contrib/guix/guix-build ``` ## Cleaning intermediate work directories By default, `guix-build` leaves all intermediate files or "work directories" (e.g. `depends/work`, `guix-build-*/distsrc-*`) intact at the end of a build so that they are available to the user (to aid in debugging, etc.). However, these directories usually take up a large amount of disk space. Therefore, a `guix-clean` convenience script is provided which cleans the current `git` worktree to save disk space: ``` ./contrib/guix/guix-clean ``` ## Common `guix-build` invocation patterns and examples ### Keeping caches and SDKs outside of the worktree If you perform a lot of builds and have a bunch of worktrees, you may find it more efficient to keep the depends tree's download cache, build cache, and SDKs outside of the worktrees to avoid duplicate downloads and unnecessary builds. To help with this situation, the `guix-build` script honours the `SOURCES_PATH`, `BASE_CACHE`, and `SDK_PATH` environment variables and will pass them on to the depends tree so that you can do something like: ```sh env SOURCES_PATH="$HOME/depends-SOURCES_PATH" BASE_CACHE="$HOME/depends-BASE_CACHE" SDK_PATH="$HOME/macOS-SDKs" ./contrib/guix/guix-build ``` Note that the paths that these environment variables point to **must be directories**, and **NOT symlinks to directories**. See the [recognized environment variables][env-vars-list] section for more details. ### Building a subset of platform triples Sometimes you only want to build a subset of the supported platform triples, in which case you can override the default list by setting the space-separated `HOSTS` environment variable: ```sh -env HOSTS='x86_64-w64-mingw32 x86_64-apple-darwin19' ./contrib/guix/guix-build +env HOSTS='x86_64-w64-mingw32 x86_64-apple-darwin' ./contrib/guix/guix-build ``` See the [recognized environment variables][env-vars-list] section for more details. ### Controlling the number of threads used by `guix` build commands Depending on your system's RAM capacity, you may want to decrease the number of threads used to decrease RAM usage or vice versa. By default, the scripts under `./contrib/guix` will invoke all `guix` build commands with `--cores="$JOBS"`. Note that `$JOBS` defaults to `$(nproc)` if not specified. However, astute manual readers will also notice that `guix` build commands also accept a `--max-jobs=` flag (which defaults to 1 if unspecified). Here is the difference between `--cores=` and `--max-jobs=`: > Note: When I say "derivation," think "package" `--cores=` - controls the number of CPU cores to build each derivation. This is the value passed to `make`'s `--jobs=` flag. `--max-jobs=` - controls how many derivations can be built in parallel - defaults to 1 Therefore, the default is for `guix` build commands to build one derivation at a time, utilizing `$JOBS` threads. Specifying the `$JOBS` environment variable will only modify `--cores=`, but you can also modify the value for `--max-jobs=` by specifying `$ADDITIONAL_GUIX_COMMON_FLAGS`. For example, if you have a LOT of memory, you may want to set: ```sh export ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=8' ``` Which allows for a maximum of 8 derivations to be built at the same time, each utilizing `$JOBS` threads. Or, if you'd like to avoid spurious build failures caused by issues with parallelism within a single package, but would still like to build multiple packages when the dependency graph allows for it, you may want to try: ```sh export JOBS=1 ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=8' ``` See the [recognized environment variables][env-vars-list] section for more details. ## Recognized environment variables * _**HOSTS**_ Override the space-separated list of platform triples for which to perform a bootstrappable build. _(defaults to "x86\_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu - x86\_64-w64-mingw32 x86\_64-apple-darwin19")_ + x86\_64-w64-mingw32 x86\_64-apple-darwin")_ * _**SOURCES_PATH**_ Set the depends tree download cache for sources. This is passed through to the depends tree. Setting this to the same directory across multiple builds of the depends tree can eliminate unnecessary redownloading of package sources. The path that this environment variable points to **must be a directory**, and **NOT a symlink to a directory**. * _**BASE_CACHE**_ Set the depends tree cache for built packages. This is passed through to the depends tree. Setting this to the same directory across multiple builds of the depends tree can eliminate unnecessary building of packages. The path that this environment variable points to **must be a directory**, and **NOT a symlink to a directory**. * _**SDK_PATH**_ Set the path where _extracted_ SDKs can be found. This is passed through to the depends tree. Note that this is should be set to the _parent_ directory of the actual SDK (e.g. `SDK_PATH=$HOME/Downloads/macOS-SDKs` instead of `$HOME/Downloads/macOS-SDKs/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers`). The path that this environment variable points to **must be a directory**, and **NOT a symlink to a directory**. * _**JOBS**_ Override the number of jobs to run simultaneously, you might want to do so on a memory-limited machine. This may be passed to: - `guix` build commands as in `guix environment --cores="$JOBS"` - `make` as in `make --jobs="$JOBS"` - `xargs` as in `xargs -P"$JOBS"` See [here](#controlling-the-number-of-threads-used-by-guix-build-commands) for more details. _(defaults to the value of `nproc` outside the container)_ * _**SOURCE_DATE_EPOCH**_ Override the reference UNIX timestamp used for bit-for-bit reproducibility, the variable name conforms to [standard][r12e/source-date-epoch]. _(defaults to the output of `$(git log --format=%at -1)`)_ * _**V**_ If non-empty, will pass `V=1` to all `make` invocations, making `make` output verbose. Note that any given value is ignored. The variable is only checked for emptiness. More concretely, this means that `V=` (setting `V` to the empty string) is interpreted the same way as not setting `V` at all, and that `V=0` has the same effect as `V=1`. * _**SUBSTITUTE_URLS**_ A whitespace-delimited list of URLs from which to download pre-built packages. A URL is only used if its signing key is authorized (refer to the [substitute servers section](#option-1-building-with-substitutes) for more details). * _**ADDITIONAL_GUIX_COMMON_FLAGS**_ Additional flags to be passed to all `guix` commands. * _**ADDITIONAL_GUIX_TIMEMACHINE_FLAGS**_ Additional flags to be passed to `guix time-machine`. * _**ADDITIONAL_GUIX_ENVIRONMENT_FLAGS**_ Additional flags to be passed to the invocation of `guix environment` inside `guix time-machine`. # Choosing your security model No matter how you installed Guix, you need to decide on your security model for building packages with Guix. Guix allows us to achieve better binary security by using our CPU time to build everything from scratch. However, it doesn't sacrifice user choice in pursuit of this: users can decide whether or not to use **substitutes** (pre-built packages). ## Option 1: Building with substitutes ### Step 1: Authorize the signing keys Depending on the installation procedure you followed, you may have already authorized the Guix build farm key. In particular, the official shell installer script asks you if you want the key installed, and the debian distribution package authorized the key during installation. You can check the current list of authorized keys at `/etc/guix/acl`. At the time of writing, a `/etc/guix/acl` with just the Guix build farm key authorized looks something like: ```lisp (acl (entry (public-key (ecc (curve Ed25519) (q #8D156F295D24B0D9A86FA5741A840FF2D24F60F7B6C4134814AD55625971B394#) ) ) (tag (guix import) ) ) ) ``` If you've determined that the official Guix build farm key hasn't been authorized, and you would like to authorize it, run the following as root: ``` guix archive --authorize < /var/guix/profiles/per-user/root/current-guix/share/guix/ci.guix.gnu.org.pub ``` If `/var/guix/profiles/per-user/root/current-guix/share/guix/ci.guix.gnu.org.pub` doesn't exist, try: ```sh guix archive --authorize < /share/guix/ci.guix.gnu.org.pub ``` Where `` is likely: - `/usr` if you installed from a distribution package - `/usr/local` if you installed Guix from source and didn't supply any prefix-modifying flags to Guix's `./configure` For dongcarl's substitute server at https://guix.carldong.io, run as root: ```sh wget -qO- 'https://guix.carldong.io/signing-key.pub' | guix archive --authorize ``` #### Removing authorized keys To remove previously authorized keys, simply edit `/etc/guix/acl` and remove the `(entry (public-key ...))` entry. ### Step 2: Specify the substitute servers Once its key is authorized, the official Guix build farm at https://ci.guix.gnu.org is automatically used unless the `--no-substitutes` flag is supplied. This default list of substitute servers is overridable both on a `guix-daemon` level and when you invoke `guix` commands. See examples below for the various ways of adding dongcarl's substitute server after having [authorized his signing key](#step-1-authorize-the-signing-keys). Change the **default list** of substitute servers by starting `guix-daemon` with the `--substitute-urls` option (you will likely need to edit your init script): ```sh guix-daemon --substitute-urls='https://guix.carldong.io https://ci.guix.gnu.org' ``` Override the default list of substitute servers by passing the `--substitute-urls` option for invocations of `guix` commands: ```sh guix --substitute-urls='https://guix.carldong.io https://ci.guix.gnu.org' ``` For scripts under `./contrib/guix`, set the `SUBSTITUTE_URLS` environment variable: ```sh export SUBSTITUTE_URLS='https://guix.carldong.io https://ci.guix.gnu.org' ``` ## Option 2: Disabling substitutes on an ad-hoc basis If you prefer not to use any substitutes, make sure to supply `--no-substitutes` like in the following snippet. The first build will take a while, but the resulting packages will be cached for future builds. For direct invocations of `guix`: ```sh guix --no-substitutes ``` For the scripts under `./contrib/guix/`: ```sh export ADDITIONAL_GUIX_COMMON_FLAGS='--no-substitutes' ``` ## Option 3: Disabling substitutes by default `guix-daemon` accepts a `--no-substitutes` flag, which will make sure that, unless otherwise overridden by a command line invocation, no substitutes will be used. If you start `guix-daemon` using an init script, you can edit said script to supply this flag. [b17e]: https://bootstrappable.org/ [r12e/source-date-epoch]: https://reproducible-builds.org/docs/source-date-epoch/ [env-vars-list]: #recognized-environment-variables diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml index 00e67712f..bef5c5752 100644 --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -1,674 +1,674 @@ --- # Templates can be referenced in builds to avoid duplication templates: gitian_builds: script: | "${TOPLEVEL}/contrib/teamcity/gitian.sh" timeout: 7200 artifacts: gitian-results: '' check+secp256k1: targets: - - all - install - install-secp256k1 - - check - check-secp256k1 - check-functional diff-node: runOnDiffRegex: - cmake/ - src/ - test/ - CMakeLists.txt secp256k1: runOnDiffRegex: - src/secp256k1/ Werror: true targets: - - secp256k1 - install-secp256k1 - - check-secp256k1 ibd: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log ibd-no-assumevalid-checkpoint: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -assumevalid=0 -checkpoints=0 -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log # This template expect the following environment variables to be set: # - JS_PROJECT_ROOT: the root directory for the js project being tested, # relative to the repository top level (no trailing /). js-mocha: artifacts: coverage.tar.gz: coverage.tar.gz script: | # Convert hyphen separated words to space separated capitalized words project_to_suite() { HYPHEN_SEPARATED=$1 WORD_SEPARATED=($(echo "${HYPHEN_SEPARATED//-/ }")) echo "${WORD_SEPARATED[@]^}" } PROJECT_NAME="$(basename ${JS_PROJECT_ROOT})" TEST_SUITE_NAME="$(project_to_suite ${PROJECT_NAME})" pushd "${TOPLEVEL}/${JS_PROJECT_ROOT}" MOCHA_JUNIT_DIR="test_results" MOCHA_JUNIT_PATH="${MOCHA_JUNIT_DIR}/${PROJECT_NAME}-junit.xml" rm -rf "${MOCHA_JUNIT_DIR}" && mkdir -p "${MOCHA_JUNIT_DIR}" npm ci # Make sure the report is available even if the tests fail move_junit_report() { mv "${MOCHA_JUNIT_PATH}" "${BUILD_DIR}/" } trap "move_junit_report" EXIT nyc \ --reporter=text \ --reporter=lcov \ --reporter=teamcity \ npm test -- \ --reporter mocha-junit-reporter \ --reporter-options mochaFile="${MOCHA_JUNIT_PATH}" \ --reporter-options testsuitesTitle="${TEST_SUITE_NAME} Unit Tests" \ --reporter-options rootSuiteTitle="${TEST_SUITE_NAME}" # Generate a summary report lcov \ --rc lcov_branch_coverage=1 \ --summary coverage/lcov.info \ > coverage/lcov-report/coverage-summary.txt 2>&1 pushd coverage/lcov-report tar -czf ../coverage.tar.gz -- * popd mv coverage/coverage.tar.gz "${BUILD_DIR}/" rm -rf coverage # The build descriptions. # If a script is defined, then this will be the only step to run. # Otherwise a list of targets can be specified, grouped by parallel runs. # Example: # targets: # - - build11 # - build12 # - - build21 # - build22 # Will run: # ninja build11 build12 # ninja build21 build22 builds: build-asan: Werror: true clang: true fail_fast: true cmake_flags: - '-DCMAKE_CXX_FLAGS=-DARENA_DEBUG' - '-DCRYPTO_USE_ASM=OFF' - '-DENABLE_SANITIZERS=address' templates: - check+secp256k1 timeout: 2400 env: ASAN_OPTIONS: log_path=stdout LSAN_OPTIONS: log_path=stdout build-bench: runOnDiffRegex: - src/bench/ Werror: true targets: - - all - install-bitcoin-bench - - bench-bitcoin timeout: 1200 artifacts: src/bench/BitcoinABC_Bench.csv: bench/BitcoinABC_Bench.csv src/bench/BitcoinABC_Bench.json: bench/BitcoinABC_Bench.json post_build: | "${TOPLEVEL}/contrib/teamcity/nanobench_json_to_teamcity_messages.py" \ "Bitcoin ABC Benchmark" \ "${BUILD_DIR}/src/bench/BitcoinABC_Bench.json" build-chronik: runOnDiffRegex: - chronik/ cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - check-crates - - all - install - - check - check-functional build-clang: Werror: true clang: true targets: - - all - install - install-secp256k1 - - check - check-secp256k1 templates: - diff-node timeout: 1200 build-clang-tidy: clang: true cmake_flags: - '-DENABLE_CLANG_TIDY=ON' targets: - - all - - check templates: - diff-node timeout: 1800 build-coverage: gcc: true cmake_flags: - '-DENABLE_COVERAGE=ON' - '-DENABLE_BRANCH_COVERAGE=ON' targets: - - coverage-check-extended post_build: | "${TOPLEVEL}/contrib/teamcity/upload-coverage.sh" check-extended timeout: 4800 artifacts: coverage.tar.gz: coverage.tar.gz build-debug: Werror: true cmake_flags: - '-DCMAKE_BUILD_TYPE=Debug' templates: - check+secp256k1 - diff-node timeout: 1200 build-diff: Werror: true targets: - - all - install - install-secp256k1 - - check-all - check-upgrade-activated templates: - diff-node timeout: 1200 build-docs: targets: - - doc-rpc - doc-doxygen post_build: | xvfb-run -a -e /dev/stderr ninja install-manpages-html timeout: 600 artifacts: doc/*: doc build-fuzzer: runOnDiffRegex: - src/test/fuzz/ - test/fuzz/ clang: true Werror: true cmake_flags: - '-DENABLE_SANITIZERS=fuzzer' targets: - - bitcoin-fuzzers build-ibd: templates: - ibd build-ibd-no-assumevalid-checkpoint: templates: - ibd-no-assumevalid-checkpoint build-linux32: cross_build: static_depends: linux32 toolchain: Linux32 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux64: cross_build: static_depends: linux64 toolchain: Linux64 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux-aarch64: cross_build: static_depends: linux-aarch64 toolchain: LinuxAArch64 emulator: qemu-aarch64-static cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' # 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" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/aarch64-linux-gnu build-linux-arm: cross_build: static_depends: linux-arm toolchain: LinuxARM emulator: qemu-arm-static cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' # 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" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf build-make-generator: generator: name: 'Unix Makefiles' command: make flags: - '-k' templates: - check+secp256k1 timeout: 1200 build-master: Werror: true targets: - - all - install - install-secp256k1 - - check-extended - check-upgrade-activated-extended timeout: 4800 build-native-osx: templates: - check+secp256k1 timeout: 3600 build-osx: cross_build: static_depends: osx toolchain: OSX # Uncomment to build Chronik once the cxx crate is working for OSX # cmake_flags: # - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - all - install - install-secp256k1 - install-tests post_build: | - export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin19/native/lib/python3/dist-packages:${PYTHONPATH:-}" + export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin/native/lib/python3/dist-packages:${PYTHONPATH:-}" ninja osx-dmg timeout: 3600 artifacts: Bitcoin-ABC.dmg: Bitcoin-ABC.dmg build-secp256k1: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' templates: - secp256k1 timeout: 600 build-secp256k1-java: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_JNI=ON' - '-DUSE_JEMALLOC=OFF' templates: - secp256k1 timeout: 600 build-secp256k1-bench: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' targets: - - install-secp256k1-bench - - bench-secp256k1 timeout: 1200 build-tsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=thread' targets: - - all - install - - check - check-functional timeout: 2400 env: TSAN_OPTIONS: log_path=stdout build-ubsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=undefined' templates: - check+secp256k1 timeout: 2400 env: UBSAN_OPTIONS: log_path=stdout build-win64: cross_build: static_depends: win64 toolchain: Win64 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' - "-DBUILD_BITCOIN_SEEDER=OFF" - "-DCPACK_STRIP_FILES=ON" - "-DUSE_JEMALLOC=OFF" targets: - - all - install - install-secp256k1 # install-tests is broken on debian bullseye because the leveldb tests # do not export any symbol and trigger a mingw linker bug: # https://sourceware.org/bugzilla/show_bug.cgi?id=26588 # We still install most test suites so we can use the artifacts and run # them on the native platform. #- install-tests - install-test-suite-bitcoin - install-test-suite-bitcoin-qt - install-test-suite-avalanche - install-test-suite-pow - - package post_build: | wine "${ARTIFACT_DIR}/bin/test_bitcoin.exe" --run_test=\!radix_tests,rcu_tests timeout: 3600 artifacts: bitcoin-abc-*-x86_64-w64-mingw32.exe: bitcoin-abc-x86_64-w64-mingw32.exe build-without-bip70: Werror: true cmake_flags: - '-DENABLE_BIP70=OFF' targets: - - all - install - - check - check-functional timeout: 1800 build-without-cli: Werror: true cmake_flags: - '-DBUILD_BITCOIN_CLI=OFF' targets: - - all - install - - check-functional timeout: 1200 build-without-qt: Werror: true cmake_flags: - '-DBUILD_BITCOIN_QT=OFF' targets: - - all - install - - check timeout: 1200 build-without-wallet: Werror: true cmake_flags: - '-DBUILD_BITCOIN_WALLET=OFF' targets: - - all - install - - check - check-functional templates: - diff-node timeout: 1200 build-without-zmq: Werror: true cmake_flags: - '-DBUILD_BITCOIN_ZMQ=OFF' targets: - - all - install - - check - check-functional timeout: 1800 check-buildbot: runOnDiffRegex: - contrib/buildbot/ targets: - - check-buildbot timeout: 600 check-seeds: targets: - - bitcoind - bitcoin-cli post_build: | # Run on different ports to avoid a race where the rpc port used in the first run # may not be closed in time for the second to start. SEEDS_DIR="${TOPLEVEL}"/contrib/seeds RPC_PORT=18832 "${SEEDS_DIR}"/check-seeds.sh main 80 RPC_PORT=18833 "${SEEDS_DIR}"/check-seeds.sh test 70 timeout: 600 check-source-control-tools: cmake_flags: - '-DENABLE_SOURCE_CONTROL_TOOLS_TESTS=ON' targets: - - check-source-control-tools timeout: 600 gitian-linux: templates: - gitian_builds env: OS_NAME: linux gitian-osx: templates: - gitian_builds env: OS_NAME: osx gitian-win: templates: - gitian_builds env: OS_NAME: win lint-circular-dependencies: runOnDiffRegex: - src/ - test/lint/ script: | "${TOPLEVEL}/test/lint/lint-circular-dependencies.sh" cashtab-tests: runOnDiffRegex: - cashtab/ artifacts: coverage.tar.gz: coverage.tar.gz env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab.xml" script: | pushd "${TOPLEVEL}/cashtab" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test --coverage -- \ --reporters=default \ --reporters=jest-junit \ --coverageReporters=text \ --coverageReporters=lcov \ --coverageReporters=teamcity # Generate a summary report lcov \ --rc lcov_branch_coverage=1 \ --summary coverage/lcov.info \ > coverage/lcov-report/coverage-summary.txt 2>&1 pushd coverage/lcov-report tar -czf ../coverage.tar.gz -- * popd mv coverage/coverage.tar.gz "${BUILD_DIR}/" cashtab-components-tests: runOnDiffRegex: - modules/cashtab-components/ env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Components Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Components Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab-components.xml" script: | pushd "${TOPLEVEL}/modules/cashtab-components" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test -- \ --reporters=default \ --reporters=jest-junit alias-server-tests: runOnDiffRegex: - apps/alias-server/ env: JS_PROJECT_ROOT: apps/alias-server templates: - js-mocha ecash-herald-tests: runOnDiffRegex: - apps/ecash-herald/ env: JS_PROJECT_ROOT: apps/ecash-herald templates: - js-mocha ecashaddrjs-tests: runOnDiffRegex: - modules/ecashaddrjs/ env: JS_PROJECT_ROOT: modules/ecashaddrjs templates: - js-mocha preview-e.cash: docker: context: web/e.cash port: 3000 preview-explorer: docker: context: web/explorer port: 3035 preview-cashtab: docker: context: cashtab diff --git a/depends/Makefile b/depends/Makefile index db539023e..5cc6e5fe1 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -1,244 +1,244 @@ .NOTPARALLEL : # Pattern rule to print variables, e.g. make print-build_arch print-%: @echo '$*'='$($*)' # When invoking a sub-make, keep only the command line variable definitions # matching the pattern in the filter function. # # e.g. invoking: # $ make A=1 C=1 print-MAKEOVERRIDES print-MAKEFLAGS # # with the following in the Makefile: # MAKEOVERRIDES := $(filter A=% B=%,$(MAKEOVERRIDES)) # # will print: # MAKEOVERRIDES = A=1 # MAKEFLAGS = -- A=1 # # this is because as the GNU make manual says: # The command line variable definitions really appear in the variable # MAKEOVERRIDES, and MAKEFLAGS contains a reference to this variable. # # and since the GNU make manual also says: # variables defined on the command line are passed to the sub-make through # MAKEFLAGS # # this means that sub-makes will be invoked as if: # $(MAKE) A=1 blah blah MAKEOVERRIDES := $(filter V=%,$(MAKEOVERRIDES)) SOURCES_PATH ?= $(BASEDIR)/sources WORK_PATH = $(BASEDIR)/work BASE_CACHE ?= $(BASEDIR)/built SDK_PATH ?= $(BASEDIR)/SDKs NO_QT ?= NO_PROTOBUF ?= NO_QR ?= NO_WALLET ?= NO_ZMQ ?= NO_UPNP ?= NO_NATPMP ?= NO_JEMALLOC ?= FALLBACK_DOWNLOAD_PATH ?= https://download.bitcoinabc.org/depends-sources BUILD = $(shell ./config.guess) HOST ?= $(BUILD) PATCHES_PATH = $(BASEDIR)/patches BASEDIR = $(CURDIR) HASH_LENGTH:=11 DOWNLOAD_CONNECT_TIMEOUT:=30 DOWNLOAD_RETRIES:=3 HOST_ID_SALT ?= salt BUILD_ID_SALT ?= salt JOBS ?= $(shell echo $$(($(shell nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 0) + 1))) host:=$(BUILD) ifneq ($(HOST),) host:=$(HOST) host_toolchain:=$(HOST)- endif ifneq ($(DEBUG),) release_type=debug else release_type=release endif base_build_dir=$(WORK_PATH)/build base_staging_dir=$(WORK_PATH)/staging base_download_dir=$(WORK_PATH)/download canonical_host:=$(shell ./config.sub $(HOST)) build:=$(shell ./config.sub $(BUILD)) build_arch =$(firstword $(subst -, ,$(build))) build_vendor=$(word 2,$(subst -, ,$(build))) full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build)) build_os:=$(findstring linux,$(full_build_os)) build_os+=$(findstring darwin,$(full_build_os)) build_os:=$(strip $(build_os)) ifeq ($(build_os),) build_os=$(full_build_os) endif host_arch=$(firstword $(subst -, ,$(canonical_host))) host_vendor=$(word 2,$(subst -, ,$(canonical_host))) full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host)) host_os:=$(findstring linux,$(full_host_os)) host_os+=$(findstring darwin,$(full_host_os)) host_os+=$(findstring mingw32,$(full_host_os)) host_os:=$(strip $(host_os)) ifeq ($(host_os),) host_os=$(full_host_os) endif $(host_arch)_$(host_os)_prefix=$(BASEDIR)/$(host) $(host_arch)_$(host_os)_host=$(host) host_prefix=$($(host_arch)_$(host_os)_prefix) build_prefix=$(host_prefix)/native build_host=$(build) all: install include hosts/$(host_os).mk include hosts/default.mk include builders/$(build_os).mk include builders/default.mk include packages/packages.mk # Previously, we directly invoked the well-known programs using $(shell ...) # to contruct build_id_string. However, that was problematic because: # # 1. When invoking a shell, GNU Make special-cases exit code 127 (command not # found) by not capturing the output but instead passing it through. This is # not done for any other exit code. # # 2. Characters like '#' (from these programs' output) would end up in make # variables like build_id_string, which would be wrongly interpreted by make # when these variables were used. # # Therefore, we should avoid having arbitrary strings in make variables where # possible. The gen_id script used here hashes the output to construct a # "make-safe" id. # # Also note that these lines need to be: # # 1. After including {hosts,builders}/*.mk, since they rely on the tool # variables (e.g. build_CC, host_STRIP, etc.) to be set. # # 2. Before including packages/*.mk (excluding packages/packages.mk), since # they rely on the build_id variables # build_id:=$(shell env CC='$(build_CC)' CXX='$(build_CXX)' AR='$(build_AR)' RANLIB='$(build_RANLIB)' STRIP='$(build_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(BUILD_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') $(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' CXX='$(host_CXX)' AR='$(host_AR)' RANLIB='$(host_RANLIB)' STRIP='$(host_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(HOST_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') qrencode_packages_$(NO_QR) = $(qrencode_packages) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_) bdb_packages_$(NO_BDB) = $(bdb_packages) sqlite_packages_$(NO_SQLITE) = $(sqlite_packages) wallet_packages_$(NO_WALLET) = $(bdb_packages_) $(sqlite_packages_) upnp_packages_$(NO_UPNP) = $(upnp_packages) natpmp_packages_$(NO_NATPMP) = $(natpmp_packages) zmq_packages_$(NO_ZMQ) = $(zmq_packages) protobuf_packages_$(NO_PROTOBUF) = $(protobuf_packages) jemalloc_packages_$(NO_JEMALLOC) = $(jemalloc_packages) packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) ifneq ($(protobuf_packages_),) native_packages += $(protobuf_native_packages) packages += $(protobuf_packages) endif ifneq ($(zmq_packages_),) packages += $(zmq_packages) endif ifneq ($(jemalloc_packages_),) packages += $(jemalloc_packages) endif all_packages = $(packages) $(native_packages) meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk $(host_arch)_$(host_os)_native_binutils?=$($(host_os)_native_binutils) $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain) include funcs.mk final_build_id_long+=$(shell $(build_SHA256SUM) config.sub) final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) rm -rf $(@D) mkdir -p $(@D) echo copying packages: $^ echo to: $(@D) cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); ) touch $@ define check_or_remove_cached mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \ $(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \ ( rm -f $($(package)_cached_checksum); \ if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); fi ) endef define check_or_remove_sources mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \ test -f $($(package)_fetched) && ( $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \ ( echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; \ rm -f $($(package)_all_sources) $($(1)_fetched))) || true endef check-packages: @$(foreach package,$(all_packages),$(call check_or_remove_cached,$(package));) check-sources: @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));) check-packages: check-sources clean-all: clean @rm -rf $(SOURCES_PATH) x86_64* i686* arm* aarch64* clean: @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) install: check-packages $(host_prefix)/.stamp_$(final_build_id) download-one: check-sources $(all_sources) download-osx: - @$(MAKE) -s HOST=x86_64-apple-darwin19 download-one + @$(MAKE) -s HOST=x86_64-apple-darwin download-one download-linux: @$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one download-win: @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one download: download-osx download-linux download-win build-linux64: download-linux @$(MAKE) -s HOST=x86_64-linux-gnu install build-linux32: download-linux @$(MAKE) -s HOST=i686-pc-linux-gnu install build-linux-arm: download-linux @$(MAKE) -s HOST=arm-linux-gnueabihf install build-linux-aarch64: download-linux @$(MAKE) -s HOST=aarch64-linux-gnu install build-osx: download-osx - @$(MAKE) -s HOST=x86_64-apple-darwin19 install + @$(MAKE) -s HOST=x86_64-apple-darwin install build-win64: download-win @$(MAKE) -s HOST=x86_64-w64-mingw32 install build-all: build-linux64 build-linux32 build-linux-arm build-linux-aarch64 build-osx build-win64 $(foreach package,$(all_packages),$(eval $(call ext_add_stages,$(package)))) .PHONY: install cached clean clean-all download-one download-osx download-linux download-win download check-packages check-sources $(V).SILENT: