commit 3e8578b7899454645072594fdc392c872e8947c0 (HEAD, refs/heads/wip-glibc-bash) Author: Ludovic Courtès Date: Mon Mar 24 00:53:16 2014 +0100 gnu: glibc: Move stand-alone Bash to $libexecdir. * gnu/packages/base.scm (glibc)[arguments] : Install 'static-bash' to $out/libexec/glibc-2.19 instead of $out/bin. Adjust system.c and iopopen.c substitutions accordingly. (gcc-final)[arguments] : Add 'libc-bash-first' phase. * gnu/packages/ncurses.scm (ncurses) : Search the 'bash' executable under $libc/libexec. Set $PATH. Modified gnu/packages/base.scm diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index bf1ebfa..888c20a 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -431,8 +431,9 @@ library for working with executable and object formats is also included.") #:phases (alist-cons-before 'configure 'pre-configure (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin"))) + (let* ((out (assoc-ref outputs "out")) + (libexec (string-append out "/libexec/" ,name + "-" ,version))) ;; Use `pwd', not `/bin/pwd'. (substitute* "configure" (("/bin/pwd") "pwd")) @@ -454,27 +455,29 @@ library for working with executable and object formats is also included.") ;; Copy a statically-linked Bash in the output, with ;; no references to other store paths. - (mkdir-p bin) + (mkdir-p libexec) (copy-file (string-append (assoc-ref 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 + (string-append libexec "/bash")) + (remove-store-references (string-append libexec "/bash")) + (chmod (string-append libexec "/bash") #o555) + + ;; Keep a symlink and augment $PATH, for `patch-shebang' + ;; resolution for $bin/sotruss, etc. + (setenv "PATH" (string-append libexec ":" (getenv "PATH"))) + (with-directory-excursion libexec (symlink "bash" "sh")) ;; Have `system' use that Bash. (substitute* "sysdeps/posix/system.c" (("#define[[:blank:]]+SHELL_PATH.*$") - (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" - out))) + (format #f "#define SHELL_PATH \"~a/bash\"\n" + libexec))) ;; Same for `popen'. (substitute* "libio/iopopen.c" (("/bin/sh") - (string-append out "/bin/bash"))) + (string-append libexec "/bash"))) ;; Make sure we don't retain a reference to the ;; bootstrap Perl. @@ -1000,7 +1003,21 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" flag)) ,flags))) ((#:phases phases) - `(alist-delete 'symlink-libgcc_eh ,phases))))) + `(alist-delete + 'symlink-libgcc_eh + (alist-cons-before + 'configure 'libc-bash-first + (lambda* (#:key inputs #:allow-other-keys) + ;; Arrange so that the shebangs of 'mkheaders', 'fixinc.sh', + ;; etc. refer to libc's bash rather than to the bootstrap + ;; bash. + (let* ((libc (assoc-ref inputs "libc")) + (bash (car (find-files (string-append libc "/libexec") + "^bash$")))) + (setenv "PATH" + (string-append (dirname bash) ":" + (getenv "PATH"))))) + ,phases)))))) (inputs `(("gmp-source" ,(package-source gmp)) ("mpfr-source" ,(package-source mpfr)) Modified gnu/packages/ncurses.scm diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm index b8f6bc8..8e75cdb 100644 --- a/gnu/packages/ncurses.scm +++ b/gnu/packages/ncurses.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014 Ludovic Courtès ;;; Copyright © 2014 Mark H Weaver ;;; ;;; This file is part of GNU Guix. @@ -35,8 +35,15 @@ ;; it to point to libc's embedded Bash, to avoid retaining a ;; reference to the bootstrap Bash. (let* ((libc (assoc-ref inputs "libc")) - (bash (string-append libc "/bin/bash")) + (bash (car (find-files (string-append libc "/libexec") + "^bash$"))) (out (assoc-ref outputs "out"))) + ;; The post-installation 'patch-shebangs' phase patches + ;; according to what's in $PATH, so make sure libc's bash comes + ;; first. + (setenv "PATH" + (string-append (dirname bash) ":" (getenv "PATH"))) + (format #t "configure flags: ~s~%" configure-flags) (zero? (apply system* bash "./configure" (string-append "SHELL=" bash)