From cd3e947f50db7cfe05c05b368c25742193729a62 Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Fri, 12 Jul 2019 11:42:36 -0400 Subject: [PATCH] contrib: guix: Various improvements. - Clearer and more accurate prose - Pin `guix pull' to commit rather than branch - Just use `use-module' instead of `define-module' - Use `bash-minimal' instead of `bash' - Remove unneeded `tcsh' from manifest - Explicitly use `python-3.7' - Add comments about how {native,cross}-toolchains are produced and why --- contrib/guix/README.md | 5 +-- contrib/guix/guix-build.sh | 4 +-- contrib/guix/manifest.scm | 65 ++++++++++++++++++++------------------ 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/contrib/guix/README.md b/contrib/guix/README.md index 3e2fc53c8..70edb72f3 100644 --- a/contrib/guix/README.md +++ b/contrib/guix/README.md @@ -15,7 +15,8 @@ Conservatively, a x86_64 machine with: - 2 or more logical cores - 4GB of free disk space on the partition that /gnu/store will reside in -- 24GB of free disk space on the partition that the bitcoin repository resides in +- 24GB of free disk space on the partition that the Bitcoin Core git repository + resides in > Note: these requirements are slightly less onerous than those of Gitian builds @@ -43,7 +44,7 @@ profile. The changes there are slowly being upstreamed. ```sh guix pull --url=https://github.com/dongcarl/guix.git \ - --branch=2019-05-bitcoin-staging \ + --commit=82c77e52b8b46e0a3aad2cb12307c2e30547deec \ --max-jobs=4 # change accordingly ``` diff --git a/contrib/guix/guix-build.sh b/contrib/guix/guix-build.sh index 6ca4d45ac..f8ba8c7ed 100755 --- a/contrib/guix/guix-build.sh +++ b/contrib/guix/guix-build.sh @@ -19,8 +19,8 @@ for host in ${HOSTS=i686-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf aarch64- # Display proper warning when the user interrupts the build trap 'echo "** INT received while building ${host}, you may want to clean up the relevant output and distsrc-* directories before rebuilding"' INT - # Run the build script 'contrib/guix/build.sh' in the build container - # specified by 'contrib/guix/manifest.scm' + # Run the build script 'contrib/guix/libexec/build.sh' in the build + # container specified by 'contrib/guix/manifest.scm' # shellcheck disable=SC2086 guix environment --manifest="${PWD}/contrib/guix/manifest.scm" \ --container \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index e661480cd..ca11d7a0f 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -1,26 +1,25 @@ -(define-module (bitcoin) - #:use-module (gnu) - #:use-module (gnu packages) - #:use-module (gnu packages autotools) - #:use-module (gnu packages base) - #:use-module (gnu packages bash) - #:use-module (gnu packages check) - #:use-module (gnu packages commencement) - #:use-module (gnu packages compression) - #:use-module (gnu packages cross-base) - #:use-module (gnu packages file) - #:use-module (gnu packages gawk) - #:use-module (gnu packages gcc) - #:use-module (gnu packages linux) - #:use-module (gnu packages perl) - #:use-module (gnu packages pkg-config) - #:use-module (gnu packages python) - #:use-module (gnu packages shells) - #:use-module (guix build-system trivial) - #:use-module (guix gexp) - #:use-module (guix packages) - #:use-module (guix profiles) - #:use-module (guix utils)) +(use-modules (gnu) + (gnu packages) + (gnu packages autotools) + (gnu packages base) + (gnu packages bash) + (gnu packages check) + (gnu packages commencement) + (gnu packages compression) + (gnu packages cross-base) + (gnu packages file) + (gnu packages gawk) + (gnu packages gcc) + (gnu packages linux) + (gnu packages perl) + (gnu packages pkg-config) + (gnu packages python) + (gnu packages shells) + (guix build-system trivial) + (guix gexp) + (guix packages) + (guix profiles) + (guix utils)) (define (make-ssp-fixed-gcc xgcc) "Given a XGCC package, return a modified package that uses the SSP function @@ -101,7 +100,7 @@ chain for " target " development.")) (license (package-license xgcc))))) (define* (make-bitcoin-cross-toolchain target - #:optional + #:key (base-gcc-for-libc gcc-5) (base-kernel-headers linux-libre-headers-4.19) (base-libc glibc-2.27) @@ -117,8 +116,7 @@ desirable for building Bitcoin Core release binaries." (packages->manifest (list ;; The Basics - bash - tcsh + bash-minimal which coreutils util-linux @@ -145,11 +143,16 @@ desirable for building Bitcoin Core release binaries." pkg-config ;; Scripting perl - python - ;; Toolchains + python-3.7 + ;; Native gcc 9 toolchain targeting glibc 2.27 (make-gcc-toolchain gcc-9 glibc-2.27) - (make-bitcoin-cross-toolchain "riscv64-linux-gnu" gcc-8) - (make-bitcoin-cross-toolchain "x86_64-linux-gnu") + ;; Cross gcc 9 toolchains targeting glibc 2.27 (make-bitcoin-cross-toolchain "i686-linux-gnu") + (make-bitcoin-cross-toolchain "x86_64-linux-gnu") (make-bitcoin-cross-toolchain "aarch64-linux-gnu") - (make-bitcoin-cross-toolchain "arm-linux-gnueabihf" gcc-6))) + (make-bitcoin-cross-toolchain "arm-linux-gnueabihf") + ;; The glibc 2.27 for riscv64 needs gcc 7 to successfully build (see: + ;; https://www.gnu.org/software/gcc/gcc-7/changes.html#riscv). The final + ;; toolchain is still a gcc 9 toolchain targeting glibc 2.27. + (make-bitcoin-cross-toolchain "riscv64-linux-gnu" + #:base-gcc-for-libc gcc-7)))