guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

21/58: gnu: commencement: glibc-mesboot0: Use Gash instead of coretutils


From: guix-commits
Subject: 21/58: gnu: commencement: glibc-mesboot0: Use Gash instead of coretutils&co.
Date: Thu, 6 Feb 2020 17:52:17 -0500 (EST)

janneke pushed a commit to branch wip-bootstrap
in repository guix.

commit 7e12996bc9056efd6d55c17a93607ece4ed2c476
Author: Jan Nieuwenhuizen <address@hidden>
AuthorDate: Sun Oct 6 21:19:35 2019 +0200

    gnu: commencement: glibc-mesboot0: Use Gash instead of coretutils&co.
    
    * gnu/packages/commencement.scm (glibc-mesboot0): Use Gash instead of
    coretutils&co.
---
 gnu/packages/commencement.scm                      | 101 +++++++++++++--------
 .../patches/glibc-bootstrap-system-2.2.5.patch     |  30 ++++++
 2 files changed, 95 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 4902dea..c2d6d81 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1481,33 +1481,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="
@@ -1516,25 +1514,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
@@ -1542,18 +1546,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 0000000..d11fc00
--- /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);
+
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]