aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2019-10-06 21:19:35 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2020-02-17 23:16:42 +0100
commitf6b911fb5f99b0677c0f94b195b140e464195e9b (patch)
treed6e3c54a39bfeba93a55c5801f30ee14a2f8a476
parent562c6e3c52863a15bc22f57d2cea323fc39b452e (diff)
downloadguix-f6b911fb5f99b0677c0f94b195b140e464195e9b.tar.gz
guix-f6b911fb5f99b0677c0f94b195b140e464195e9b.zip
gnu: commencement: glibc-mesboot0: Use Gash instead of coretutils&co.
* gnu/packages/commencement.scm (glibc-mesboot0): Use Gash instead of coretutils&co.
-rw-r--r--gnu/packages/commencement.scm101
-rw-r--r--gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch30
2 files changed, 95 insertions, 36 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 2542231b82..1ee974840b 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1482,33 +1482,31 @@ ac_cv_c_float_format='IEEE (little-endian)'
(inherit glibc)
(name "glibc-mesboot0")
(version "2.2.5")
- (source (bootstrap-origin
- (origin
- (method url-fetch)
- (uri (string-append "mirror://gnu/glibc/glibc-"
- version
- ".tar.gz"))
- (patches (search-patches "glibc-boot-2.2.5.patch"))
- (sha256
- (base32
- "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q")))))
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/glibc/glibc-"
+ version
+ ".tar.gz"))
+ ;; Patch needs XZ
+ ;; (patches (search-patches "glibc-boot-2.2.5.patch"))
+ (sha256
+ (base32
+ "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q"))))
(supported-systems '("i686-linux" "x86_64-linux"))
(inputs '())
(propagated-inputs '())
- (native-inputs `(("binutils" ,binutils-mesboot0)
- ("gcc" ,gcc-core-mesboot0)
-
- ("bash" ,%bootstrap-coreutils&co)
- ("coreutils" ,%bootstrap-coreutils&co)
- ("diffutils" ,diffutils-mesboot)
+ (native-inputs `(("boot-patch" ,(search-patch "glibc-boot-2.2.5.patch"))
+ ("system-patch" ,(search-patch "glibc-bootstrap-system-2.2.5.patch"))
("headers" ,mesboot-headers)
- ("make" ,make-mesboot0)))
+ ,@(%boot-mesboot-core-inputs)
+ ("gash" ,gash-boot)))
(outputs '("out"))
(arguments
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile
#:tests? #f
#:strip-binaries? #f
+ #:validate-runpath? #f ; no dynamic executables
#:parallel-build? #f ; gcc-2.95.3 ICEs on massively parallel builds
#:make-flags (list (string-append
"SHELL="
@@ -1517,25 +1515,31 @@ ac_cv_c_float_format='IEEE (little-endian)'
#:configure-flags
(let ((out (assoc-ref %outputs "out"))
(headers (assoc-ref %build-inputs "headers")))
- (list
- "--disable-shared"
- "--enable-static"
- "--disable-sanity-checks"
- "--build=i686-unknown-linux-gnu"
- "--host=i686-unknown-linux-gnu"
- (string-append "--with-headers=" headers "/include")
- "--enable-static-nss"
- "--without-__thread"
- "--without-cvs"
- "--without-gd"
- "--without-tls"
- (string-append "--prefix=" out)))
+ `("--disable-shared"
+ "--enable-static"
+ "--disable-sanity-checks"
+ "--build=i686-unknown-linux-gnu"
+ "--host=i686-unknown-linux-gnu"
+ ,(string-append "--with-headers=" headers "/include")
+ "--enable-static-nss"
+ "--without-__thread"
+ "--without-cvs"
+ "--without-gd"
+ "--without-tls"
+ ,(string-append "--prefix=" out)))
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'apply-boot-patch
+ (lambda* (#:key inputs #:allow-other-keys)
+ (and (let ((patch (assoc-ref inputs "boot-patch")))
+ (invoke "patch" "--force" "-p1" "-i" patch))
+ (let ((patch (assoc-ref inputs "system-patch")))
+ (invoke "patch" "--force" "-p1" "-i" patch)))))
(add-before 'configure 'setenv
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bash (assoc-ref %build-inputs "bash"))
+ (shell (string-append bash "/bin/bash"))
(gcc (assoc-ref %build-inputs "gcc"))
(headers (assoc-ref %build-inputs "headers"))
(cppflags (string-append
@@ -1543,18 +1547,43 @@ ac_cv_c_float_format='IEEE (little-endian)'
" -D MES_BOOTSTRAP=1"
" -D BOOTSTRAP_GLIBC=1"))
(cflags (string-append " -L " (getcwd))))
- (setenv "CONFIG_SHELL" (string-append bash "/bin/sh"))
- (setenv "SHELL" (getenv "CONFIG_SHELL"))
+ (setenv "CONFIG_SHELL" shell)
+ (setenv "SHELL" shell)
(setenv "CPP" (string-append gcc "/bin/gcc -E " cppflags))
(setenv "CC" (string-append gcc "/bin/gcc " cppflags cflags))
#t)))
- ;; glibc-2.2.5 needs a more classic invocation of configure
- ;; configure: warning: CONFIG_SHELL=/gnu/store/…-bash-minimal-4.4.12/bin/bash: invalid host type
- (replace 'configure
+ (replace 'configure ; needs classic invocation of configure
(lambda* (#:key configure-flags #:allow-other-keys)
(format (current-error-port)
"running ./configure ~a\n" (string-join configure-flags))
- (apply invoke "./configure" configure-flags))))))))
+ (apply invoke "./configure" configure-flags)))
+ (add-after 'configure 'fixup-configure
+ (lambda _
+ (let* ((out (assoc-ref %outputs "out"))
+ (bash (assoc-ref %build-inputs "bash"))
+ (shell (string-append bash "/bin/bash"))
+ (gash (assoc-ref %build-inputs "gash"))
+ (gash (string-append gash "/bin/gash")))
+ (substitute* "config.make"
+ (("INSTALL = scripts/") "INSTALL = $(..)./scripts/"))
+ (substitute* "config.make"
+ (("INSTALL = scripts/") "INSTALL = $(..)./scripts/")
+ (("BASH = ") (string-append
+ "SHELL = " shell "
+BASH = ")))
+ ;; XXX: make-syscalls.sh does not run correctly with
+ ;; bash-mesboot0, producing a wrong sysd-syscalls.
+
+ ;; This leads to posix/uname.c getting compiled where it
+ ;; shouldn't:
+
+ ;; ../sysdeps/generic/uname.c:25: config-name.h: error 02
+ (substitute* "sysdeps/unix/make-syscalls.sh"
+ (("#!/gnu/store.*/bin/bash") (string-append "#! " gash)))
+
+ (substitute* "sysdeps/unix/Makefile"
+ ((" [{] [$][(]SHELL[)]") (string-append " { " gash))))
+ #t)))))))
(define gcc-mesboot0
(package
diff --git a/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch b/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch
new file mode 100644
index 0000000000..d11fc00c75
--- /dev/null
+++ b/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch
@@ -0,0 +1,30 @@
+We want to allow builds in chroots that lack /bin/sh. Thus, system(3)
+and popen(3) need to be tweaked to use the right shell. For the bootstrap
+glibc, we just use whatever `sh' can be found in $PATH. The final glibc
+instead uses the hard-coded absolute file name of `bash'.
+
+--- a/sysdeps/posix/system.c
++++ b/sysdeps/posix/system.c
+@@ -106,8 +106,8 @@ do_system (const char *line)
+ (void) UNBLOCK;
+
+ /* Exec the shell. */
+- (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
++ (void) execvp (SHELL_NAME, (char *const *) new_argv);
+ _exit (127);
+ }
+ else if (pid < (pid_t) 0)
+ /* The fork failed. */
+--- a/libio/iopopen.c
++++ b/libio/iopopen.c
+@@ -170,7 +170,7 @@ _IO_new_proc_open (fp, command, mode)
+ for (p = proc_file_chain; p; p = p->next)
+ _IO_close (_IO_fileno ((_IO_FILE *) p));
+
+- _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
++ execlp ("sh", "sh", "-c", command, (char *) 0);
+ _IO__exit (127);
+ }
+ _IO_close (child_end);
+
+