#:use-module (guix build-system trivial)
#:use-module (guix build-system gnu)
#:use-module ((gnu packages) #:select (search-patch))
- #:use-module ((gnu packages commencement) #:select (%final-inputs))
#:use-module (gnu packages base)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages bash)
#: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)
(cross-binutils target)
(cross-bootstrap-libc)))
("cross-binutils" ,(cross-binutils target))
- ,@%final-inputs))
+ ,@(%final-inputs)))
`(("libc" ,(glibc-for-bootstrap))
("gcc" ,(package (inherit gcc)
(outputs '("out")) ; all in one so libgcc_s is easily found
(inputs
`(("libc",(glibc-for-bootstrap))
,@(package-inputs gcc)))))
- ,@(fold alist-delete %final-inputs '("libc" "gcc")))))
+ ,@(fold alist-delete (%final-inputs) '("libc" "gcc")))))
(package-with-explicit-inputs p inputs
(current-source-location)
#:native-inputs native-inputs))
-(define %bash-static
- (static-package bash-minimal))
-
(define %static-inputs
;; Packages that are to be used as %BOOTSTRAP-INPUTS.
(let ((coreutils (package (inherit coreutils)
(("-Wl,-export-dynamic") "")))
,phases)))))
(inputs (if (%current-target-system)
- `(("bash" ,%bash-static))
+ `(("bash" ,static-bash))
'()))))
+ (tar (package (inherit tar)
+ (arguments
+ '(#:phases (modify-phases %standard-phases
+ (add-before 'build 'set-shell-file-name
+ (lambda _
+ ;; Do not use "/bin/sh" to run programs; see
+ ;; <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg02272.html>.
+ (substitute* "src/system.c"
+ (("/bin/sh") "sh")
+ (("execv ") "execvp "))
+ #t)))))))
(finalize (compose static-package
package-with-relocatable-glibc)))
`(,@(map (match-lambda
("sed" ,sed)
("grep" ,grep)
("gawk" ,gawk)))
- ("bash" ,%bash-static))))
+ ("bash" ,static-bash))))
(define %static-binaries
(package
#t))))
(inputs `(("binutils" ,%binutils-static)))))
-(define %glibc-stripped
+(define (%glibc-stripped)
;; 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.
(name "glibc-stripped")
(build-system trivial-build-system)
(arguments
- `(#:modules ((guix build utils))
+ `(#:modules ((guix build utils)
+ (guix build make-bootstrap))
#: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)))
+ (use-modules (guix build make-bootstrap))
+ (make-stripped-libc (assoc-ref %outputs "out")
+ (assoc-ref %build-inputs "libc")
+ (assoc-ref %build-inputs "kernel-headers")))))
+ (inputs `(("kernel-headers"
+ ,(if (or (and (%current-target-system)
+ (hurd-triplet? (%current-target-system)))
+ (string-suffix? "-hurd" (%current-system)))
+ gnumach-headers
+ linux-libre-headers))
+ ("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)))
+ glibc)))))
;; Only one output.
(outputs '("out")))))
(patches patches)))
(guile (package (inherit guile-2.0)
(name (string-append (package-name guile-2.0) "-static"))
+ (replacement #f)
(source source)
(synopsis "Statically-linked and relocatable Guile")
;; 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)))
(define %gcc-bootstrap-tarball
;; A tarball with a dynamic-linked GCC and its headers.
(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 "Tarballs containing all the bootstrap binaries")
(description synopsis)