summaryrefslogtreecommitdiff
path: root/distro
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-12-20 00:49:06 +0100
committerLudovic Courtès <ludo@gnu.org>2012-12-20 01:38:56 +0100
commit6e32f6c019c35a8092f1285be67aaa7dd04c0f59 (patch)
tree4282762409624d059f61b53143607baee61a60a6 /distro
parentd6f80f187c4bc109dd4d8fc839cc376e7b11e593 (diff)
distro: glibc: Add a statically-linked Bash to $out/bin.
* distro/packages/base.scm (glibc): Pass `ac_cv_path_BASH_SHELL' in the configure flags. During the `pre-configure' phase, copy the "static-bash" input to $out/bin, and change `system' and `popen' to use it instead of /bin/sh. Add the "static-bash" input. Suggested by Shea Levy <shea@shealevy.com> and Lluís Batlle i Rossell <viric@viric.name>.
Diffstat (limited to 'distro')
-rw-r--r--distro/packages/base.scm35
1 files changed, 30 insertions, 5 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 58c39ce7cd..7cb2dc116e 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -499,12 +499,19 @@ used in the GNU system including the GNU/Linux variant.")
"--enable-kernel=2.6.30"
;; XXX: Work around "undefined reference to `__stack_chk_guard'".
- "libc_cv_ssp=no")
+ "libc_cv_ssp=no"
+
+ ;; Use our Bash instead of /bin/sh.
+ (string-append "ac_cv_path_BASH_SHELL="
+ (assoc-ref %build-inputs "bash")
+ "/bin/bash"))
+
#:tests? #f ; XXX
#:phases (alist-cons-before
'configure 'pre-configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin")))
;; Use `pwd', not `/bin/pwd'.
(substitute* "configure"
(("/bin/pwd") "pwd"))
@@ -522,10 +529,28 @@ used in the GNU system including the GNU/Linux variant.")
;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
;; linking against libgcc_s is not needed with GCC
;; 4.7.1.
- ((" -lgcc_s") ""))))
+ ((" -lgcc_s") ""))
+
+ ;; Copy a statically-linked Bash in the output.
+ (mkdir-p bin)
+ (copy-file (assoc-ref inputs "static-bash")
+ (string-append bin "/bash"))
+ (chmod (string-append bin "/bash") #o555)
+
+ ;; Have `system' use that Bash.
+ (substitute* "sysdeps/posix/system.c"
+ (("#define[[:blank:]]+SHELL_PATH.*$")
+ (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
+ out)))
+
+ ;; Same for `popen'.
+ (substitute* "libio/iopopen.c"
+ (("/bin/sh")
+ (string-append out "/bin/bash")))))
%standard-phases)))
(inputs `(("patch/ld.so.cache"
- ,(search-patch "glibc-no-ld-so-cache.patch"))))
+ ,(search-patch "glibc-no-ld-so-cache.patch"))
+ ("static-bash" ,(cut search-bootstrap-binary "bash" <>))))
(synopsis "The GNU C Library")
(description
"Any Unix-like operating system needs a C library: the library which