From fa84fdeb8a479f3b59b38f762f551d744def2e5f Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 30 Jun 2015 12:53:24 +0300 Subject: [PATCH] gnu: make-bootstrap: Produce the correct %glibc-bootstrap-tarball for Hurd systems. * gnu/packages/make-bootstrap.scm (%glibc-bootstrap-tarball): Make it a procedure. (%glibc-stripped): Make it a procedure that produces the correct %glibc-stripped depending on the target system. --- gnu/packages/make-bootstrap.scm | 164 +++++++++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 62 deletions(-) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 3d43421..f9b8026 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -33,6 +33,7 @@ #:use-module (gnu packages guile) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages linux) + #:use-module (gnu packages hurd) #:use-module (gnu packages multiprecision) #:use-module (ice-9 match) #:use-module (srfi srfi-1) @@ -327,68 +328,107 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." #t)))) (inputs `(("binutils" ,%binutils-static))))) -(define %glibc-stripped +(define (%glibc-stripped target) ;; GNU libc's essential shared libraries, dynamic linker, and headers, ;; with all references to store directories stripped. As a result, ;; libc.so is unusable and need to be patched for proper relocation. - (let ((glibc (glibc-for-bootstrap))) - (package (inherit glibc) - (name "glibc-stripped") - (build-system trivial-build-system) - (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - - (setvbuf (current-output-port) _IOLBF) - (let* ((out (assoc-ref %outputs "out")) - (libdir (string-append out "/lib")) - (incdir (string-append out "/include")) - (libc (assoc-ref %build-inputs "libc")) - (linux (assoc-ref %build-inputs "linux-headers"))) - (mkdir-p libdir) - (for-each (lambda (file) - (let ((target (string-append libdir "/" - (basename file)))) - (copy-file file target) - (remove-store-references target))) - (find-files (string-append libc "/lib") - "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) - - (copy-recursively (string-append libc "/include") incdir) - - ;; Copy some of the Linux-Libre headers that glibc headers - ;; refer to. - (mkdir (string-append incdir "/linux")) - (for-each (lambda (file) - (copy-file (string-append linux "/include/linux/" file) - (string-append incdir "/linux/" - (basename file)))) - '("limits.h" "errno.h" "socket.h" "kernel.h" - "sysctl.h" "param.h" "ioctl.h" "types.h" - "posix_types.h" "stddef.h")) - - (copy-recursively (string-append linux "/include/asm") - (string-append incdir "/asm")) - (copy-recursively (string-append linux "/include/asm-generic") - (string-append incdir "/asm-generic")) - - ;; Remove the '.install' and '..install.cmd' files; the latter - ;; contains store paths, which prevents bit reproducibility. - (for-each delete-file (find-files incdir "\\.install")) - - #t)))) - (inputs `(("libc" ,(let ((target (%current-target-system))) - (if target - (glibc-for-bootstrap - (parameterize ((%current-target-system #f)) - (cross-libc target))) - glibc))) - ("linux-headers" ,linux-libre-headers))) - - ;; Only one output. - (outputs '("out"))))) + (match target + ("i586-pc-gnu" + (let ((glibc (glibc-for-bootstrap))) + (package (inherit glibc/hurd) + (name "glibc-stripped") + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + + (setvbuf (current-output-port) _IOLBF) + (let* ((out (assoc-ref %outputs "out")) + (libdir (string-append out "/lib")) + (incdir (string-append out "/include")) + (libc (assoc-ref %build-inputs "libc")) + (mach (assoc-ref %build-inputs "gnumach-headers"))) + (mkdir-p libdir) + (for-each (lambda (file) + (let ((target (string-append libdir "/" + (basename file)))) + (copy-file file target) + (remove-store-references target))) + (find-files (string-append libc "/lib") + "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) + + (copy-recursively (string-append libc "/include") incdir) + + (copy-recursively (string-append mach "/include/mach") + (string-append incdir "/mach")) + #t)))) + (inputs `(("libc" ,(let ((target (%current-target-system))) + (if target + (glibc-for-bootstrap + (parameterize ((%current-target-system #f)) + (cross-libc target))) + glibc))) + ("gnumach-headers" ,gnumach-headers))) + + ;; Only one output. + (outputs '("out"))))) + (_ + (let ((glibc (glibc-for-bootstrap))) + (package (inherit glibc/linux) + (name "glibc-stripped") + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + + (setvbuf (current-output-port) _IOLBF) + (let* ((out (assoc-ref %outputs "out")) + (libdir (string-append out "/lib")) + (incdir (string-append out "/include")) + (libc (assoc-ref %build-inputs "libc")) + (linux (assoc-ref %build-inputs "linux-headers"))) + (mkdir-p libdir) + (for-each (lambda (file) + (let ((target (string-append libdir "/" + (basename file)))) + (copy-file file target) + (remove-store-references target))) + (find-files (string-append libc "/lib") + "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) + + (copy-recursively (string-append libc "/include") incdir) + + ;; Copy some of the Linux-Libre headers that glibc headers + ;; refer to. + (mkdir (string-append incdir "/linux")) + (for-each (lambda (file) + (copy-file (string-append linux "/include/linux/" file) + (string-append incdir "/linux/" + (basename file)))) + '("limits.h" "errno.h" "socket.h" "kernel.h" + "sysctl.h" "param.h" "ioctl.h" "types.h" + "posix_types.h" "stddef.h")) + + (copy-recursively (string-append linux "/include/asm") + (string-append incdir "/asm")) + (copy-recursively (string-append linux "/include/asm-generic") + (string-append incdir "/asm-generic")) + + #t)))) + (inputs `(("libc" ,(let ((target (%current-target-system))) + (if target + (glibc-for-bootstrap + (parameterize ((%current-target-system #f)) + (cross-libc target))) + glibc))) + ("linux-headers" ,linux-libre-headers))) + + ;; Only one output. + (outputs '("out"))))))) (define %gcc-static ;; A statically-linked GCC, with stripped-down functionality. @@ -641,9 +681,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; A tarball with the statically-linked Binutils programs. (tarball-package %binutils-static-stripped)) -(define %glibc-bootstrap-tarball +(define (%glibc-bootstrap-tarball) ;; A tarball with GNU libc's shared libraries, dynamic linker, and headers. - (tarball-package %glibc-stripped)) + (tarball-package (%glibc-stripped (or (%current-target-system) (%current-system))))) (define %gcc-bootstrap-tarball ;; A tarball with a dynamic-linked GCC and its headers. @@ -683,7 +723,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (inputs `(("guile-tarball" ,%guile-bootstrap-tarball) ("gcc-tarball" ,%gcc-bootstrap-tarball) ("binutils-tarball" ,%binutils-bootstrap-tarball) - ("glibc-tarball" ,%glibc-bootstrap-tarball) + ("glibc-tarball" ,(%glibc-bootstrap-tarball)) ("coreutils&co-tarball" ,%bootstrap-binaries-tarball))) (synopsis #f) (description #f) -- 2.4.4