Skip to content

Commit

Permalink
Merge bitcoin#28294: guix: pre time-machine bump changes (Windows)
Browse files Browse the repository at this point in the history
51324c9 guix: pre time-machine bump changes (Windows) (fanquake)

Pull request description:

  This is some refactoring to the Windows 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 Windows GCC build into `mingw-w64-base-gcc`.
  Rename `gcc-10-remap-guix-store.patch` to avoid changing it whenever GCC changes.

  We move the old `building-on` inside `explicit-cross-configure`, so that non-windows builds continue to work. Note that `explicit-cross-configure` will be going away entirely (see bitcoin#27897), so this is only temporary duplication.

  Split out of bitcoin#27897. Most of the [[WIP] Windows commit](bitcoin@e50d5f8), minus the gcov change, as it's not-yet needed, and any gexp changes, which need the newer time-machine.

  I'll also be splitting out the other changes we can do pre-timemachine bump, for easier review.

  Guix Build:
  ```bash
  9cff4df245df0b8e92d102bda786eb13a1f10be58940b98a16e119d9d4859d7f  guix-build-51324c9517a2/output/aarch64-linux-gnu/SHA256SUMS.part
  dbe6a5fe2e6152cd114b1d549a383384cd3325ed4625ad93f8d824ba457ae9cd  guix-build-51324c9517a2/output/aarch64-linux-gnu/bitcoin-51324c9517a2-aarch64-linux-gnu-debug.tar.gz
  e36409cd7287e4da62806168ee21ef764e607a11685bb36b7642381060291789  guix-build-51324c9517a2/output/aarch64-linux-gnu/bitcoin-51324c9517a2-aarch64-linux-gnu.tar.gz
  0721a4b61ad991ec97d09281eda223ed7bad32cb2b4812e05bc5e64772756be7  guix-build-51324c9517a2/output/arm-linux-gnueabihf/SHA256SUMS.part
  f2aa9412ff77bfc3092404533ec669a610c3fa95711b514abd6cd8ae6918aca1  guix-build-51324c9517a2/output/arm-linux-gnueabihf/bitcoin-51324c9517a2-arm-linux-gnueabihf-debug.tar.gz
  cda70b7df940dcc1fdeb25e2d3cc6ecce45732fdd741881e2b0384e35897b6d5  guix-build-51324c9517a2/output/arm-linux-gnueabihf/bitcoin-51324c9517a2-arm-linux-gnueabihf.tar.gz
  15b5d30336bcaf75db4138c59716af93b9660511222c5f1ad814fc9d7c48c852  guix-build-51324c9517a2/output/arm64-apple-darwin/SHA256SUMS.part
  a29b327e4d869629af3625d6b7fe44e029e98ac4fedb265133e0d88e045ef933  guix-build-51324c9517a2/output/arm64-apple-darwin/bitcoin-51324c9517a2-arm64-apple-darwin-unsigned.dmg
  b1af35290051da64462987e32f215464c5e2376afbe5b5bff272f74f160a3461  guix-build-51324c9517a2/output/arm64-apple-darwin/bitcoin-51324c9517a2-arm64-apple-darwin-unsigned.tar.gz
  6c3815392377a8497cab15f534cfdb749dbe31e39ca2ae7e53a55b37acfe069d  guix-build-51324c9517a2/output/arm64-apple-darwin/bitcoin-51324c9517a2-arm64-apple-darwin.tar.gz
  efff276305c36ccf2e6eeca56928e6284965d0d08b05565b0bfc94a3dc30cec4  guix-build-51324c9517a2/output/dist-archive/bitcoin-51324c9517a2.tar.gz
  0d70106907ac873bd31603b58183ef2cd3b0820ce20b27e3a8d00044b876835c  guix-build-51324c9517a2/output/powerpc64-linux-gnu/SHA256SUMS.part
  9a6cbc010d08c26c5bc587ed9c42383a6d004ac20426508e67364848aa099154  guix-build-51324c9517a2/output/powerpc64-linux-gnu/bitcoin-51324c9517a2-powerpc64-linux-gnu-debug.tar.gz
  e39ca22d186bad00119a740279b046a0040628847bea76db0b5d5345efa2312d  guix-build-51324c9517a2/output/powerpc64-linux-gnu/bitcoin-51324c9517a2-powerpc64-linux-gnu.tar.gz
  945ab751f65d5333b259fd169b280a5fabd35cae89a8f777bc6019f2ac011073  guix-build-51324c9517a2/output/powerpc64le-linux-gnu/SHA256SUMS.part
  1c33b4385d5759e4a38cd42e6af99c1224788d03e15b8abd3df48caef3ebcb0a  guix-build-51324c9517a2/output/powerpc64le-linux-gnu/bitcoin-51324c9517a2-powerpc64le-linux-gnu-debug.tar.gz
  3b4d0f6d874d600095b90eb19ad568ab08c105762c4ba285c6b1a4dc8d9fc2db  guix-build-51324c9517a2/output/powerpc64le-linux-gnu/bitcoin-51324c9517a2-powerpc64le-linux-gnu.tar.gz
  6d4f508256747841f9b099370cc7da2a97687f7b182683fce0369b524388e952  guix-build-51324c9517a2/output/riscv64-linux-gnu/SHA256SUMS.part
  34a474abaf833664448f3643d572eef284037535685af3f3928d9f859e7353e6  guix-build-51324c9517a2/output/riscv64-linux-gnu/bitcoin-51324c9517a2-riscv64-linux-gnu-debug.tar.gz
  b91a2209d360fe97d3d04cee4ff52271d45c2e47044e4f196dde4585cf61a273  guix-build-51324c9517a2/output/riscv64-linux-gnu/bitcoin-51324c9517a2-riscv64-linux-gnu.tar.gz
  88a40ee878a6340a4c5dd4bb82effaff814328e6b6f1345c5824170ba7498279  guix-build-51324c9517a2/output/x86_64-apple-darwin/SHA256SUMS.part
  0714092f76e32a1e8484651aed349ccdb5acc38f54dc2ac3ae3031111b5050eb  guix-build-51324c9517a2/output/x86_64-apple-darwin/bitcoin-51324c9517a2-x86_64-apple-darwin-unsigned.dmg
  ab66d04ea3e9304155e66b0e2899b8325fd609c3fed27c74fe1b53f1b9efea15  guix-build-51324c9517a2/output/x86_64-apple-darwin/bitcoin-51324c9517a2-x86_64-apple-darwin-unsigned.tar.gz
  222b688ef72b657c0701c8b4660240833e7c516fbbdcc4df8e9a006f5aa9b3bb  guix-build-51324c9517a2/output/x86_64-apple-darwin/bitcoin-51324c9517a2-x86_64-apple-darwin.tar.gz
  340e73e1697ae5cc1984771ce6e5caf22361ba4d063cbc4073236b210f1754dc  guix-build-51324c9517a2/output/x86_64-linux-gnu/SHA256SUMS.part
  a967753c192b8cb28cc644ce9d239da88ef8faaebc2094e21b7580616a0b8415  guix-build-51324c9517a2/output/x86_64-linux-gnu/bitcoin-51324c9517a2-x86_64-linux-gnu-debug.tar.gz
  7d77b14a2c94091a2d68dd9cdb0d878348da323c67eeeb5600273814db1b0e10  guix-build-51324c9517a2/output/x86_64-linux-gnu/bitcoin-51324c9517a2-x86_64-linux-gnu.tar.gz
  fbfb10b13b7bc5a1ed33578dcdd9483360cad47fd744ac99a9aecdf2a8ac14c2  guix-build-51324c9517a2/output/x86_64-w64-mingw32/SHA256SUMS.part
  925bf5f88e907ddc4567acecfc634ef3570b0576499c6427225a52e1f6209d1e  guix-build-51324c9517a2/output/x86_64-w64-mingw32/bitcoin-51324c9517a2-win64-debug.zip
  b3d19a25df2dbd913814e74471da585e629187a19a6afede5890a7df2dd0101f  guix-build-51324c9517a2/output/x86_64-w64-mingw32/bitcoin-51324c9517a2-win64-setup-unsigned.exe
  96b03fa66e294e95c0cee5d4c9869ac377e739d2da2e87c0c9d35eddd25e6ceb  guix-build-51324c9517a2/output/x86_64-w64-mingw32/bitcoin-51324c9517a2-win64-unsigned.tar.gz
  95d7f52622c534e40dceb89f150b3f2e0061c56768bcf7399aac3f24b937983b  guix-build-51324c9517a2/output/x86_64-w64-mingw32/bitcoin-51324c9517a2-win64.zip
  ```

ACKs for top commit:
  TheCharlatan:
    ACK 51324c9

Tree-SHA512: 4d26ea2b587e4ea2bf76861925437b178376cda7373012f4a6d48ccb3606c20b035b94cba6248ac8d9e0c9e974e9eace818043d312c67d5c5e5771300a839c44
  • Loading branch information
fanquake committed Aug 22, 2023
2 parents 03a536f + 51324c9 commit 8372ab0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ FILE-NAME found in ./patches relative to the current file."
((%patch-path (list (string-append (dirname (current-filename)) "/patches"))))
(list (search-patch file-name) ...)))

(define (make-ssp-fixed-gcc xgcc)
"Given a XGCC package, return a modified package that uses the SSP function
from glibc instead of from libssp.so. Our `symbol-check' script will complain if
we link against libssp.so, and thus will ensure that this works properly.

Taken from:
http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html"
(package
(inherit xgcc)
(arguments
(substitute-keyword-arguments (package-arguments xgcc)
((#:make-flags flags)
`(cons "gcc_cv_libc_provides_ssp=yes" ,flags))))))

(define (make-gcc-rpath-link xgcc)
"Given a XGCC package, return a modified package that replace each instance of
-rpath in the default system spec that's inserted by Guix with -rpath-link"
Expand All @@ -71,9 +57,10 @@ http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html"
(("-rpath=") "-rpath-link="))
#t))))))))

(define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
(define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))

(define (explicit-cross-configure package)
(define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
(package-with-extra-configure-variable package "--build" building-on))

(define (make-cross-toolchain target
Expand Down Expand Up @@ -153,26 +140,20 @@ desirable for building Bitcoin Core release binaries."
base-libc
base-gcc))

(define (make-gcc-with-pthreads gcc)
(package-with-extra-configure-variable
(package-with-extra-patches gcc
(search-our-patches "gcc-10-remap-guix-store.patch"))
"--enable-threads" "posix"))

(define (make-mingw-w64-cross-gcc cross-gcc)
(package-with-extra-patches cross-gcc
(search-our-patches "vmov-alignment.patch"
(define (gcc-mingw-patches gcc)
(package-with-extra-patches gcc
(search-our-patches "gcc-remap-guix-store.patch"
"vmov-alignment.patch"
"gcc-broken-longjmp.patch")))

(define (make-mingw-pthreads-cross-toolchain target)
"Create a cross-compilation toolchain package for TARGET"
(let* ((xbinutils (cross-binutils target))
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
(pthreads-xgcc (make-gcc-with-pthreads
(cross-gcc target
#:xgcc (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc base-gcc))
(pthreads-xgcc (cross-gcc target
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
#:xbinutils xbinutils
#:libc pthreads-xlibc))))
#:libc pthreads-xlibc)))
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
;; XGCC
(package
Expand Down Expand Up @@ -543,6 +524,22 @@ inspecting signatures in Mach-O binaries.")
"--enable-stack-protector" "all")
"--enable-bind-now" "yes"))

(define-public mingw-w64-base-gcc
(package
(inherit base-gcc)
(arguments
(substitute-keyword-arguments (package-arguments base-gcc)
((#:configure-flags flags)
`(append ,flags
;; https://gcc.gnu.org/install/configure.html
(list "--enable-threads=posix",
building-on)))
((#:make-flags flags)
;; Uses the SSP functions from glibc instead of from libssp.so.
;; Our 'symbol-check' script will complain if we link against libssp.so,
;; and thus will ensure that this works properly.
`(cons "gcc_cv_libc_provides_ssp=yes" ,flags))))))

(define-public glibc-2.27
(package
(inherit glibc-2.31)
Expand Down

0 comments on commit 8372ab0

Please sign in to comment.