guix-commits
[Top][All Lists]
Advanced

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

31/63: bootstrap: glibc-mesboot0: Scheme-only bootstrap.


From: guix-commits
Subject: 31/63: bootstrap: glibc-mesboot0: Scheme-only bootstrap.
Date: Sun, 24 Nov 2019 05:56:34 -0500 (EST)

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

commit be4c2a4b1e9c61bd17659d9f594f659148df94ed
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Sun Oct 6 21:19:35 2019 +0200

    bootstrap: glibc-mesboot0: Scheme-only bootstrap.
    
    * gnu/packages/commencement.scm (glibc-mesboot0): Scheme-only bootstrap.
---
 gnu/packages/commencement.scm                      | 92 ++++++++++++++++------
 .../patches/glibc-bootstrap-system-2.2.5.patch     | 30 +++++++
 2 files changed, 96 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index bc9e74a..8bcd325 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1239,27 +1239,36 @@ ac_cv_c_float_format='IEEE (little-endian)'
                (uri (string-append "mirror://gnu/glibc/glibc-"
                                    version
                                    ".tar.gz"))
-               (patches (search-patches "glibc-boot-2.2.5.patch"))
+               ;; 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)
+    (native-inputs `(("boot-patch" ,(search-patch "glibc-boot-2.2.5.patch"))
+                     ("system-patch" ,(search-patch 
"glibc-bootstrap-system-2.2.5.patch"))
+                     ("bash" ,bash-mesboot0)
+                     ("binutils" ,binutils-mesboot0)
                      ("diffutils" ,diffutils-mesboot)
+                     ("gawk" ,gawk-mesboot0)
+                     ("gcc" ,gcc-core-mesboot0)
+                     ("gzip" ,gzip-mesboot0)
                      ("headers" ,mesboot-headers)
-                     ("make" ,make-mesboot0)))
+                     ("make" ,make-mesboot0)
+                     ("patch" ,patch-mesboot0)
+                     ("sed" ,sed-mesboot0)
+
+                     ("gash" ,%bootstrap-gash)
+                     ("guile" ,%bootstrap-guile)))
     (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="
@@ -1268,25 +1277,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
@@ -1294,18 +1309,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)))))
     (native-search-paths
      ;; Use the language-specific variables rather than 'CPATH' because they
      ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
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]