mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
gnu: glibc: Do not copy static Bash binary to bin/.
This avoids problems when installing 'glibc' in a profile, where glibc's limited 'bash' would take precedence over the valid 'bash'. * gnu/packages/base.scm (glibc)[arguments]: Do not copy STATIC-BASH to OUT/bin. Instead, simply refer to it directly. [inputs]: Use STATIC-BASH instead of BASH-LIGHT. * gnu/packages/commencement.scm (static-bash-for-glibc): Likewise. (glibc-final)[arguments]: Add STATIC-BASH-FOR-GLIBC to #:allowed-references. (gcc-final)[arguments]: Likewise. [native-inputs]: Add "static-bash".
This commit is contained in:
parent
aad5df4058
commit
90d891fc6c
2 changed files with 20 additions and 29 deletions
|
@ -517,7 +517,11 @@ (define-public glibc
|
||||||
(lambda* (#:key inputs native-inputs outputs
|
(lambda* (#:key inputs native-inputs outputs
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(bin (string-append out "/bin")))
|
(bin (string-append out "/bin"))
|
||||||
|
;; FIXME: Normally we would look it up only in INPUTS
|
||||||
|
;; but cross-base uses it as a native input.
|
||||||
|
(bash (or (assoc-ref inputs "static-bash")
|
||||||
|
(assoc-ref native-inputs "static-bash"))))
|
||||||
;; Use `pwd', not `/bin/pwd'.
|
;; Use `pwd', not `/bin/pwd'.
|
||||||
(substitute* "configure"
|
(substitute* "configure"
|
||||||
(("/bin/pwd") "pwd"))
|
(("/bin/pwd") "pwd"))
|
||||||
|
@ -537,34 +541,16 @@ (define-public glibc
|
||||||
;; 4.7.1.
|
;; 4.7.1.
|
||||||
((" -lgcc_s") ""))
|
((" -lgcc_s") ""))
|
||||||
|
|
||||||
;; Copy a statically-linked Bash in the output, with
|
|
||||||
;; no references to other store paths.
|
|
||||||
;; FIXME: Normally we would look it up only in INPUTS but
|
|
||||||
;; cross-base uses it as a native input.
|
|
||||||
(mkdir-p bin)
|
|
||||||
(copy-file (string-append (or (assoc-ref inputs
|
|
||||||
"static-bash")
|
|
||||||
(assoc-ref native-inputs
|
|
||||||
"static-bash"))
|
|
||||||
"/bin/bash")
|
|
||||||
(string-append bin "/bash"))
|
|
||||||
(remove-store-references (string-append bin "/bash"))
|
|
||||||
(chmod (string-append bin "/bash") #o555)
|
|
||||||
|
|
||||||
;; Keep a symlink, for `patch-shebang' resolution.
|
|
||||||
(with-directory-excursion bin
|
|
||||||
(symlink "bash" "sh"))
|
|
||||||
|
|
||||||
;; Have `system' use that Bash.
|
;; Have `system' use that Bash.
|
||||||
(substitute* "sysdeps/posix/system.c"
|
(substitute* "sysdeps/posix/system.c"
|
||||||
(("#define[[:blank:]]+SHELL_PATH.*$")
|
(("#define[[:blank:]]+SHELL_PATH.*$")
|
||||||
(format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
|
(format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
|
||||||
out)))
|
bash)))
|
||||||
|
|
||||||
;; Same for `popen'.
|
;; Same for `popen'.
|
||||||
(substitute* "libio/iopopen.c"
|
(substitute* "libio/iopopen.c"
|
||||||
(("/bin/sh")
|
(("/bin/sh")
|
||||||
(string-append out "/bin/bash")))
|
(string-append bash "/bin/bash")))
|
||||||
|
|
||||||
;; Make sure we don't retain a reference to the
|
;; Make sure we don't retain a reference to the
|
||||||
;; bootstrap Perl.
|
;; bootstrap Perl.
|
||||||
|
@ -577,7 +563,7 @@ (define-public glibc
|
||||||
"exec perl"))))
|
"exec perl"))))
|
||||||
%standard-phases)))
|
%standard-phases)))
|
||||||
|
|
||||||
(inputs `(("static-bash" ,(static-package bash-light))))
|
(inputs `(("static-bash" ,static-bash)))
|
||||||
|
|
||||||
;; To build the manual, we need Texinfo and Perl. Gettext is needed to
|
;; To build the manual, we need Texinfo and Perl. Gettext is needed to
|
||||||
;; install the message catalogs, with 'msgfmt'.
|
;; install the message catalogs, with 'msgfmt'.
|
||||||
|
|
|
@ -419,18 +419,17 @@ (define bison-boot1
|
||||||
#:guile %bootstrap-guile))))
|
#:guile %bootstrap-guile))))
|
||||||
|
|
||||||
(define static-bash-for-glibc
|
(define static-bash-for-glibc
|
||||||
;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by
|
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
|
||||||
;; system(3) & co.
|
|
||||||
(let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
|
(let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
|
||||||
glibc-final-with-bootstrap-bash
|
glibc-final-with-bootstrap-bash
|
||||||
(car (assoc-ref %boot1-inputs "bash"))))
|
(car (assoc-ref %boot1-inputs "bash"))))
|
||||||
(bash (package (inherit bash-light)
|
(bash (package (inherit static-bash)
|
||||||
(native-inputs `(("bison" ,bison-boot1)))
|
(native-inputs `(("bison" ,bison-boot1)))
|
||||||
(arguments
|
(arguments
|
||||||
`(#:guile ,%bootstrap-guile
|
`(#:guile ,%bootstrap-guile
|
||||||
,@(package-arguments bash-light))))))
|
,@(package-arguments static-bash))))))
|
||||||
(package-with-bootstrap-guile
|
(package-with-bootstrap-guile
|
||||||
(package-with-explicit-inputs (static-package bash)
|
(package-with-explicit-inputs bash
|
||||||
`(("gcc" ,gcc)
|
`(("gcc" ,gcc)
|
||||||
("libc" ,glibc-final-with-bootstrap-bash)
|
("libc" ,glibc-final-with-bootstrap-bash)
|
||||||
,@(fold alist-delete %boot1-inputs
|
,@(fold alist-delete %boot1-inputs
|
||||||
|
@ -490,6 +489,7 @@ (define glibc-final
|
||||||
(arguments
|
(arguments
|
||||||
`(#:allowed-references
|
`(#:allowed-references
|
||||||
,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0)
|
,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0)
|
||||||
|
static-bash-for-glibc
|
||||||
(package-outputs glibc-final-with-bootstrap-bash))
|
(package-outputs glibc-final-with-bootstrap-bash))
|
||||||
|
|
||||||
,@(package-arguments glibc-final-with-bootstrap-bash)))))
|
,@(package-arguments glibc-final-with-bootstrap-bash)))))
|
||||||
|
@ -562,7 +562,8 @@ (define gcc-final
|
||||||
`(#:guile ,%bootstrap-guile
|
`(#:guile ,%bootstrap-guile
|
||||||
#:implicit-inputs? #f
|
#:implicit-inputs? #f
|
||||||
|
|
||||||
#:allowed-references ("out" "lib" ,glibc-final)
|
#:allowed-references ("out" "lib"
|
||||||
|
,glibc-final ,static-bash-for-glibc)
|
||||||
|
|
||||||
;; Things like libasan.so and libstdc++.so NEED ld.so for some
|
;; Things like libasan.so and libstdc++.so NEED ld.so for some
|
||||||
;; reason, but it is not in their RUNPATH. This is a false
|
;; reason, but it is not in their RUNPATH. This is a false
|
||||||
|
@ -596,8 +597,12 @@ (define gcc-final
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(alist-delete 'symlink-libgcc_eh ,phases)))))
|
`(alist-delete 'symlink-libgcc_eh ,phases)))))
|
||||||
|
|
||||||
;; This time we want Texinfo, so we get the manual.
|
;; This time we want Texinfo, so we get the manual. Add
|
||||||
|
;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
|
||||||
|
;; scripts such as 'mkheaders' and 'fixinc.sh' (XXX: who cares about these
|
||||||
|
;; scripts?).
|
||||||
(native-inputs `(("texinfo" ,texinfo-boot0)
|
(native-inputs `(("texinfo" ,texinfo-boot0)
|
||||||
|
("static-bash" ,static-bash-for-glibc)
|
||||||
,@(package-native-inputs gcc-boot0)))
|
,@(package-native-inputs gcc-boot0)))
|
||||||
|
|
||||||
(inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp)))
|
(inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp)))
|
||||||
|
|
Loading…
Reference in a new issue