diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-12-09 20:14:43 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2024-08-31 10:42:47 +0200 |
commit | 4a4508c241c22a52dd14cb3f26fd47f59a90d631 (patch) | |
tree | ccb20cbe913896c10e947a693cde931c2d912cdc /gnu/packages | |
parent | 7c575fac52305fbeaa8c5cc2681a990d40646148 (diff) | |
download | guix-4a4508c241c22a52dd14cb3f26fd47f59a90d631.tar.gz guix-4a4508c241c22a52dd14cb3f26fd47f59a90d631.zip |
gnu: cross-base: Let glibc use the right Binutils programs.
This replaces ‘glibc-cross-objdump.patch’ and
‘glibc-cross-objcopy.patch’ (not applied to glibc@2.38): these patches
were committed upstream and later reverted on the grounds that ‘gcc
-print-prog-name=objdump’ should find the cross ‘objdump’:
https://inbox.sourceware.org/libc-alpha/d72f5f6f-cc3a-bd89-0800-ffb068928e0f@linaro.org/t/
* gnu/packages/cross-base.scm (cross-libc*): Add
‘add-cross-binutils-to-PATH’ phase.
Change-Id: I38dc7a6134177ec73313c0a9c8b0a12c85c60e26
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/cross-base.scm | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 7d152b3270..22f0b2590a 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -698,35 +698,51 @@ returned." (guix build utils) (srfi srfi-26)) - ,@(package-arguments libc)) - ((#:configure-flags flags) - `(cons ,(string-append "--host=" target) - ,(if (target-hurd? target) - `(append (list "--disable-werror" - ,@%glibc/hurd-configure-flags) - ,flags) - flags))) - ((#:phases phases) - `(modify-phases ,phases - (add-before 'configure 'set-cross-kernel-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((kernel (assoc-ref inputs "kernel-headers")) - (cpath (string-append kernel "/include"))) - (for-each (cut setenv <> cpath) - ',%gcc-cross-include-paths) - (setenv "CROSS_LIBRARY_PATH" - (string-append kernel "/lib")) ; for Hurd's libihash - #t))) - ,@(if (target-hurd? target) - '((add-after 'install 'augment-libc.so - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (substitute* (string-append out "/lib/libc.so") - (("/[^ ]+/lib/libc.so.0.3") - (string-append out "/lib/libc.so.0.3" - " libmachuser.so libhurduser.so")))) - #t))) - '()))))) + ,@(package-arguments libc)) + ((#:configure-flags flags) + `(cons ,(string-append "--host=" target) + ,(if (target-hurd? target) + `(append (list "--disable-werror" + ,@%glibc/hurd-configure-flags) + ,flags) + flags))) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'configure 'set-cross-kernel-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((kernel (assoc-ref inputs "kernel-headers")) + (cpath (string-append kernel "/include"))) + (for-each (cut setenv <> cpath) + ',%gcc-cross-include-paths) + (setenv "CROSS_LIBRARY_PATH" + (string-append kernel "/lib")) ; for Hurd's libihash + #t))) + (add-before 'configure 'add-cross-binutils-to-PATH + (lambda* (#:key inputs #:allow-other-keys) + ;; Add BINUTILS/TARGET/bin to $PATH so that 'gcc + ;; -print-prog-name=objdump' returns the correct name. See + ;; <https://inbox.sourceware.org/libc-alpha/d72f5f6f-cc3a-bd89-0800-ffb068928e0f@linaro.org/t/>. + (define cross-objdump + (search-input-file + inputs + (string-append ,target "/bin/objdump"))) + + (define cross-binutils + (dirname cross-objdump)) + + (format #t "adding '~a' to the front of 'PATH'~%" + cross-binutils) + (setenv "PATH" (string-append cross-binutils ":" (getenv "PATH"))))) + ,@(if (target-hurd? target) + '((add-after 'install 'augment-libc.so + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (substitute* (string-append out "/lib/libc.so") + (("/[^ ]+/lib/libc.so.0.3") + (string-append out "/lib/libc.so.0.3" + " libmachuser.so libhurduser.so")))) + #t))) + '()))))) ;; Shadow the native "kernel-headers" because glibc's recipe expects the ;; "kernel-headers" input to point to the right thing. |