gnu: guix: Cross-build fixup for wrap-program.

This allows running:

    guix build hello

* gnu/packages/package-management.scm (guix)[arguments]: When cross-compiling,
fixup the shebang generated by wrap-program.
[inputs]: When cross-compiling, include bash-minimal.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-04-08 09:43:51 +02:00 committed by Jan Nieuwenhuizen
parent 0c5d974fa1
commit 38b9af7c92
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -37,6 +37,7 @@ (define-module (gnu packages package-management)
#:use-module (gnu packages autotools) #:use-module (gnu packages autotools)
#:use-module (gnu packages backup) #:use-module (gnu packages backup)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bdw-gc) #:use-module (gnu packages bdw-gc)
#:use-module (gnu packages bison) #:use-module (gnu packages bison)
#:use-module (gnu packages bootstrap) ;for 'bootstrap-guile-origin' #:use-module (gnu packages bootstrap) ;for 'bootstrap-guile-origin'
@ -259,7 +260,8 @@ (define code
(setenv "SHELL" (which "sh")) (setenv "SHELL" (which "sh"))
#t)) #t))
(add-after 'install 'wrap-program (add-after 'install 'wrap-program
(lambda* (#:key inputs native-inputs outputs #:allow-other-keys) (lambda* (#:key inputs native-inputs outputs target
#:allow-other-keys)
;; Make sure the 'guix' command finds GnuTLS, ;; Make sure the 'guix' command finds GnuTLS,
;; Guile-JSON, and Guile-Git automatically. ;; Guile-JSON, and Guile-Git automatically.
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
@ -301,6 +303,11 @@ (define code
`("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath)) `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath))
`("GUIX_LOCPATH" ":" suffix (,locpath))) `("GUIX_LOCPATH" ":" suffix (,locpath)))
(when target
;; XXX Touching wrap-program rebuilds world
(let ((bash (assoc-ref inputs "bash")))
(substitute* (string-append out "/bin/guix")
(("^#!.*/bash") (string-append "#! " bash "/bin/bash")))))
#t)))))) #t))))))
(native-inputs `(("pkg-config" ,pkg-config) (native-inputs `(("pkg-config" ,pkg-config)
@ -346,7 +353,8 @@ (define code
`(("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux"))) `(("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux")))
'()) '())
,@(if (%current-target-system) ,@(if (%current-target-system)
`(("xz" ,xz)) `(("bash" ,bash-minimal)
("xz" ,xz))
'()) '())
;; Tests also rely on these bootstrap executables. ;; Tests also rely on these bootstrap executables.