Skip to content

Commit f3cc29f

Browse files
committed
Merge bitcoin/bitcoin#28324: guix: pre time-machine bump changes (Linux)
806b75b guix: consolidate Linux GCC package (fanquake) 4415275 guix: consolidate glibc 2.27 package (fanquake) Pull request description: This is some refactoring to the Linux Guix build that facilitates bumping our Guix time-machine. Namely, avoiding `package-with-extra-configure-variable`, which is non-functional in the newer time-machine, see https://issues.guix.gnu.org/64436. At the same time, consolidate our Linux GCC build into `linux-base-gcc`. Now that we only use `building-on`, remove `explicit-cross-configure`. Split out of bitcoin/bitcoin#27897. Most of the [[WIP] Linux commit](bitcoin/bitcoin@8335fc4), minus anything GCC 12 related. I'll also be splitting out the other changes we can do pre-timemachine bump, for easier review. Similar/followup to #28294. Requirement for #28328. Guix Build: ```bash 17463110d4b4721a7c188e71b1fc00c9b5b82227aa8342471390c17678e04a9a guix-build-806b75b21340/output/aarch64-linux-gnu/SHA256SUMS.part 0ca919ce568e7d4ffe44dda871d48963ca2988516068e75b1f30ca342d853d20 guix-build-806b75b21340/output/aarch64-linux-gnu/bitcoin-806b75b21340-aarch64-linux-gnu-debug.tar.gz 134afa263e4da6c8d7df79a7dd8e59911c1e643b53b7c285de9418d97fb06d5f guix-build-806b75b21340/output/aarch64-linux-gnu/bitcoin-806b75b21340-aarch64-linux-gnu.tar.gz 22ce318241084829e57f064bf47de57752151863aac545e643eea5dd8eee96fe guix-build-806b75b21340/output/arm-linux-gnueabihf/SHA256SUMS.part a26fecfeb821040704ca70ea056bff796789ed9500d9575d8fa13a85b32143f6 guix-build-806b75b21340/output/arm-linux-gnueabihf/bitcoin-806b75b21340-arm-linux-gnueabihf-debug.tar.gz 213c84494835c81a40ebc5d38a62bb19cbee5b214b2a8aaed6d28746b245108e guix-build-806b75b21340/output/arm-linux-gnueabihf/bitcoin-806b75b21340-arm-linux-gnueabihf.tar.gz ce1efcf6d3ca0e7422c5ce35f5e45e0770a3ae48173e061137daa7dc551e9d48 guix-build-806b75b21340/output/arm64-apple-darwin/SHA256SUMS.part fc01aaeb4e4722d21fd60c78f1b5322c9875ec6fb4d244f4547a354e91a33ed7 guix-build-806b75b21340/output/arm64-apple-darwin/bitcoin-806b75b21340-arm64-apple-darwin-unsigned.dmg 632e4a243d3e4144313f53047499f91b7c9380a1a50f5846e1635d0a00fd202a guix-build-806b75b21340/output/arm64-apple-darwin/bitcoin-806b75b21340-arm64-apple-darwin-unsigned.tar.gz 8e694e4cd1bf45e6a586a0d8c19b675014f168f342f881a9ae0c4fbbda796914 guix-build-806b75b21340/output/arm64-apple-darwin/bitcoin-806b75b21340-arm64-apple-darwin.tar.gz dad6e8475f13dac6c4f0b182f53dc330997e9e1e5cf4d46413655f319dcd9bff guix-build-806b75b21340/output/dist-archive/bitcoin-806b75b21340.tar.gz 32e8b6c7e7a7561e132c5f15e2151a51aad1c5004ab90a36a7e80f92c200ef6f guix-build-806b75b21340/output/powerpc64-linux-gnu/SHA256SUMS.part 9033e85e03bd12a3a19599735cfd44fcfdfb1bf1b632733341cec6a4f75ff86f guix-build-806b75b21340/output/powerpc64-linux-gnu/bitcoin-806b75b21340-powerpc64-linux-gnu-debug.tar.gz 72698691b27ec0ac17f21dce8551de0ca683dd00b5b9442ea7616fb56cca8c6b guix-build-806b75b21340/output/powerpc64-linux-gnu/bitcoin-806b75b21340-powerpc64-linux-gnu.tar.gz ef7c6d7184249eb59fa67d6df91d1a567570b9fb026dbb8682763029decaacca guix-build-806b75b21340/output/powerpc64le-linux-gnu/SHA256SUMS.part fc6bb5619ee76899a88c1dd62640b429ad8957bbdf821238038b41fc87d18eca guix-build-806b75b21340/output/powerpc64le-linux-gnu/bitcoin-806b75b21340-powerpc64le-linux-gnu-debug.tar.gz 0eceb969f41f6b8dba88f641e268590de7edf0008318c8051d9cb208fb15e7f7 guix-build-806b75b21340/output/powerpc64le-linux-gnu/bitcoin-806b75b21340-powerpc64le-linux-gnu.tar.gz 6f51a4791d87a610abd81cee83efa7f469e905829797bc2edac4fb95a2e0f3e4 guix-build-806b75b21340/output/riscv64-linux-gnu/SHA256SUMS.part c978706988f31e65a7991ff7582d79b3d1df44249c14d9807d93c01bf3f5080d guix-build-806b75b21340/output/riscv64-linux-gnu/bitcoin-806b75b21340-riscv64-linux-gnu-debug.tar.gz 93aefe058025067550692adae59ead14228ac252a9e7cf8b55c8fb4189ece545 guix-build-806b75b21340/output/riscv64-linux-gnu/bitcoin-806b75b21340-riscv64-linux-gnu.tar.gz 862a53f6023bd1ca98a078ea540bba8ca9bfa335a9560f3d8d62ac873c2d5848 guix-build-806b75b21340/output/x86_64-apple-darwin/SHA256SUMS.part 8f632b42c94d061fa30364087e75bb8b04eb2ac5a0a988eacc37c5983669f01b guix-build-806b75b21340/output/x86_64-apple-darwin/bitcoin-806b75b21340-x86_64-apple-darwin-unsigned.dmg ce62e76ca446a6316b31490e12463c0a641e15beef9bdae7acc8e5db057b433a guix-build-806b75b21340/output/x86_64-apple-darwin/bitcoin-806b75b21340-x86_64-apple-darwin-unsigned.tar.gz f57b014818e3b1ec07d27c8224ec4ac0e5786dacd00639513b599c6138790ece guix-build-806b75b21340/output/x86_64-apple-darwin/bitcoin-806b75b21340-x86_64-apple-darwin.tar.gz 70e75f6f13795f968f91719d221673b687bf747f90d77912cbcb2c1ee45ec623 guix-build-806b75b21340/output/x86_64-linux-gnu/SHA256SUMS.part 30dec525364bb21a26cfe8bfff061d013c4ce849165aa67b06eb154019444862 guix-build-806b75b21340/output/x86_64-linux-gnu/bitcoin-806b75b21340-x86_64-linux-gnu-debug.tar.gz d8b3a996f25fb948b3555d5750852aaf82f7051848586b9ba0f4d0d223226e4b guix-build-806b75b21340/output/x86_64-linux-gnu/bitcoin-806b75b21340-x86_64-linux-gnu.tar.gz 4259adec77912bab6494f71a2a95d98093b116c05fc9ad03069e92de4ce0248c guix-build-806b75b21340/output/x86_64-w64-mingw32/SHA256SUMS.part 0a2d5cab3fe94a86def0cc1b6efe9ac871839cbcdc05ad92686df1d2bdd154ea guix-build-806b75b21340/output/x86_64-w64-mingw32/bitcoin-806b75b21340-win64-debug.zip d2a1876333bdb1cd5b8b1d4a52bccd756ea2e992c291dac233e65beeb0c905fd guix-build-806b75b21340/output/x86_64-w64-mingw32/bitcoin-806b75b21340-win64-setup-unsigned.exe 192ea38d70e12c23327ff811ea930b50ac31c9fb2bc8dcc9391ad585112322ff guix-build-806b75b21340/output/x86_64-w64-mingw32/bitcoin-806b75b21340-win64-unsigned.tar.gz 474f88a1f4cc8900a7d8967909336d4122e449ce98cacaf2cacec340780ede0b guix-build-806b75b21340/output/x86_64-w64-mingw32/bitcoin-806b75b21340-win64.zip ``` ACKs for top commit: TheCharlatan: Nice cleanups, ACK 806b75b Tree-SHA512: cede797c3b9b88cc1588d0ff7ff9b2908316a8ba384d9087b16466aceeb2e0c194aa56e3023f6b6ce7ca8896a1b87ef56b966db198cc1712cb6ddc37fe684567
2 parents 23f3f40 + 806b75b commit f3cc29f

File tree

1 file changed

+61
-57
lines changed

1 file changed

+61
-57
lines changed

contrib/guix/manifest.scm

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,8 @@ FILE-NAME found in ./patches relative to the current file."
4040
((%patch-path (list (string-append (dirname (current-filename)) "/patches"))))
4141
(list (search-patch file-name) ...)))
4242

43-
(define (make-gcc-rpath-link xgcc)
44-
"Given a XGCC package, return a modified package that replace each instance of
45-
-rpath in the default system spec that's inserted by Guix with -rpath-link"
46-
(package
47-
(inherit xgcc)
48-
(arguments
49-
(substitute-keyword-arguments (package-arguments xgcc)
50-
((#:phases phases)
51-
`(modify-phases ,phases
52-
(add-after 'pre-configure 'replace-rpath-with-rpath-link
53-
(lambda _
54-
(substitute* (cons "gcc/config/rs6000/sysv4.h"
55-
(find-files "gcc/config"
56-
"^gnu-user.*\\.h$"))
57-
(("-rpath=") "-rpath-link="))
58-
#t))))))))
59-
6043
(define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
6144

62-
(define (explicit-cross-configure package)
63-
(define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
64-
(package-with-extra-configure-variable package "--build" building-on))
65-
6645
(define (make-cross-toolchain target
6746
base-gcc-for-libc
6847
base-kernel-headers
@@ -72,9 +51,9 @@ FILE-NAME found in ./patches relative to the current file."
7251
(let* ((xbinutils (cross-binutils target))
7352
;; 1. Build a cross-compiling gcc without targeting any libc, derived
7453
;; from BASE-GCC-FOR-LIBC
75-
(xgcc-sans-libc (explicit-cross-configure (cross-gcc target
76-
#:xgcc base-gcc-for-libc
77-
#:xbinutils xbinutils)))
54+
(xgcc-sans-libc (cross-gcc target
55+
#:xgcc base-gcc-for-libc
56+
#:xbinutils xbinutils))
7857
;; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived
7958
;; from BASE-KERNEL-HEADERS
8059
(xkernel (cross-kernel-headers target
@@ -83,17 +62,17 @@ FILE-NAME found in ./patches relative to the current file."
8362
xbinutils))
8463
;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
8564
;; derived from BASE-LIBC
86-
(xlibc (explicit-cross-configure (cross-libc target
87-
base-libc
88-
xgcc-sans-libc
89-
xbinutils
90-
xkernel)))
65+
(xlibc (cross-libc target
66+
base-libc
67+
xgcc-sans-libc
68+
xbinutils
69+
xkernel))
9170
;; 4. Build a cross-compiling gcc targeting XLIBC, derived from
9271
;; BASE-GCC
93-
(xgcc (explicit-cross-configure (cross-gcc target
94-
#:xgcc base-gcc
95-
#:xbinutils xbinutils
96-
#:libc xlibc))))
72+
(xgcc (cross-gcc target
73+
#:xgcc base-gcc
74+
#:xbinutils xbinutils
75+
#:libc xlibc)))
9776
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
9877
;; XGCC
9978
(package
@@ -117,21 +96,12 @@ chain for " target " development."))
11796
(define base-gcc gcc-10)
11897
(define base-linux-kernel-headers linux-libre-headers-5.15)
11998

120-
;; https://gcc.gnu.org/install/configure.html
121-
(define (hardened-gcc gcc)
122-
(package-with-extra-configure-variable (
123-
package-with-extra-configure-variable (
124-
package-with-extra-configure-variable gcc
125-
"--enable-initfini-array" "yes")
126-
"--enable-default-ssp" "yes")
127-
"--enable-default-pie" "yes"))
128-
12999
(define* (make-bitcoin-cross-toolchain target
130100
#:key
131-
(base-gcc-for-libc base-gcc)
101+
(base-gcc-for-libc linux-base-gcc)
132102
(base-kernel-headers base-linux-kernel-headers)
133-
(base-libc (hardened-glibc glibc-2.27))
134-
(base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc))))
103+
(base-libc glibc-2.27)
104+
(base-gcc linux-base-gcc))
135105
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
136106
desirable for building Bitcoin Core release binaries."
137107
(make-cross-toolchain target
@@ -513,17 +483,6 @@ and endian independent.")
513483
inspecting signatures in Mach-O binaries.")
514484
(license license:expat))))
515485

516-
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
517-
;; We don't use --disable-werror directly, as that would be passed through to bash,
518-
;; and cause it's build to fail.
519-
(define (hardened-glibc glibc)
520-
(package-with-extra-configure-variable (
521-
package-with-extra-configure-variable (
522-
package-with-extra-configure-variable glibc
523-
"enable_werror" "no")
524-
"--enable-stack-protector" "all")
525-
"--enable-bind-now" "yes"))
526-
527486
(define-public mingw-w64-base-gcc
528487
(package
529488
(inherit base-gcc)
@@ -540,6 +499,30 @@ inspecting signatures in Mach-O binaries.")
540499
;; and thus will ensure that this works properly.
541500
`(cons "gcc_cv_libc_provides_ssp=yes" ,flags))))))
542501

502+
(define-public linux-base-gcc
503+
(package
504+
(inherit base-gcc)
505+
(arguments
506+
(substitute-keyword-arguments (package-arguments base-gcc)
507+
((#:configure-flags flags)
508+
`(append ,flags
509+
;; https://gcc.gnu.org/install/configure.html
510+
(list "--enable-initfini-array=yes",
511+
"--enable-default-ssp=yes",
512+
"--enable-default-pie=yes",
513+
building-on)))
514+
((#:phases phases)
515+
`(modify-phases ,phases
516+
;; Given a XGCC package, return a modified package that replace each instance of
517+
;; -rpath in the default system spec that's inserted by Guix with -rpath-link
518+
(add-after 'pre-configure 'replace-rpath-with-rpath-link
519+
(lambda _
520+
(substitute* (cons "gcc/config/rs6000/sysv4.h"
521+
(find-files "gcc/config"
522+
"^gnu-user.*\\.h$"))
523+
(("-rpath=") "-rpath-link="))
524+
#t))))))))
525+
543526
(define-public glibc-2.27
544527
(package
545528
(inherit glibc-2.31)
@@ -556,7 +539,28 @@ inspecting signatures in Mach-O binaries.")
556539
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
557540
"glibc-2.27-fcommon.patch"
558541
"glibc-2.27-guix-prefix.patch"
559-
"glibc-2.27-no-librt.patch"))))))
542+
"glibc-2.27-no-librt.patch"))))
543+
(arguments
544+
(substitute-keyword-arguments (package-arguments glibc)
545+
((#:configure-flags flags)
546+
`(append ,flags
547+
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
548+
(list "--enable-stack-protector=all",
549+
"--enable-bind-now",
550+
"--disable-werror",
551+
building-on)))
552+
((#:phases phases)
553+
`(modify-phases ,phases
554+
(add-before 'configure 'set-etc-rpc-installation-directory
555+
(lambda* (#:key outputs #:allow-other-keys)
556+
;; Install the rpc data base file under `$out/etc/rpc'.
557+
;; Otherwise build will fail with "Permission denied."
558+
(let ((out (assoc-ref outputs "out")))
559+
(substitute* "sunrpc/Makefile"
560+
(("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
561+
(string-append out "/etc/rpc" suffix "\n"))
562+
(("^install-others =.*$")
563+
(string-append "install-others = " out "/etc/rpc\n"))))))))))))
560564

561565
(packages->manifest
562566
(append

0 commit comments

Comments
 (0)