Skip to content

Commit

Permalink
contrib: guix: Various improvements.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dongcarl committed Jul 12, 2019
1 parent 8dff3e4 commit cd3e947
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
5 changes: 3 additions & 2 deletions contrib/guix/README.md
Expand Up @@ -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
Expand Down Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions contrib/guix/guix-build.sh
Expand Up @@ -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 \
Expand Down
65 changes: 34 additions & 31 deletions 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
Expand Down Expand Up @@ -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)
Expand All @@ -117,8 +116,7 @@ desirable for building Bitcoin Core release binaries."

(packages->manifest
(list ;; The Basics
bash
tcsh
bash-minimal
which
coreutils
util-linux
Expand All @@ -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)))

0 comments on commit cd3e947

Please sign in to comment.