aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2018-09-19 17:23:09 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2018-09-23 09:46:26 +0200
commiteb4434598cbf8d04a3e5b1995be50fe3b44f0507 (patch)
tree73ec77e12679d81a84f10ccf2db76a32ba861ed9
parenta243722c5b8d50b4f0e3f9717ca71aa43dfc56a3 (diff)
downloadguix-eb4434598cbf8d04a3e5b1995be50fe3b44f0507.tar
guix-eb4434598cbf8d04a3e5b1995be50fe3b44f0507.tar.gz
bootstrap: Reduced Binary Seed bootstrap for x86_64 too.
* gnu/packages/bootstrap.scm (%bootstrap-inputs): Replace %bootstrap-libc, %bootstrap-gcc, and %bootstrap-binutils with Mes seeds for x86_64 too. * gnu/packages/commencement.scm (tcc-boot0, tcc-boot, gcc-mesboot1, gcc-mesboot1-wrapper, m4-mesboot, %bootstrap-inputs+toolchain, libstdc++-boot0, gcc-boot0, bison-boot0): For x86_64-linux, use i686-linux glibc-dynamic-linker and Mes bootstrap settings. (gcc-boot0-intermediate-wrapped): New variable, extract from static-bash-for-glibc. (static-bash-for-glibc): Use it. (gcc-final): Copy gmp&co phase from gcc-boot0, inherit other arguments from gcc; avoid i686-linux impersonation from gcc-boot0. * doc/guix.texi (Bootstrapping, Reduced Binary Seed Bootstrap): Note x86_64-linux also as Reduced Binary Seed bootstrap.
-rw-r--r--doc/guix.texi12
-rw-r--r--gnu/packages/bootstrap.scm19
-rw-r--r--gnu/packages/commencement.scm112
3 files changed, 91 insertions, 52 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 55c1ac3102..a213a0324c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -23554,8 +23554,8 @@ Binutils, libc, and the other packages mentioned above---the
These bootstrap binaries are ``taken for granted'', though we can also
re-create them if needed (more on that later).
-For @code{i686-linux} the Guix bootstrap process is more elaborate,
-@pxref{Reduced Binary Seed Bootstrap}.
+For @code{i686-linux} and @code{x86_64-linux} the Guix bootstrap process is
+more elaborate, @pxref{Reduced Binary Seed Bootstrap}.
@unnumberedsubsec Preparing to Use the Bootstrap Binaries
@@ -23725,10 +23725,10 @@ problem: the current combined size of these bootstrap binaries is about 250MB
(@pxref{Bootstrappable Builds,,, mes, Mes Reference Manual}). Auditing or
even inspecting these is next to impossible.
-For @code{i686-linux}, Guix now features a ``Reduced Binary Seed'' bootstrap
-@footnote{We would like to say: ``Full Source Bootstrap'' and while we are
-working towards that goal it would be hyperbole to use that term for what we
-do now.}.
+For @code{i686-linux} and @code{x86_64-linux}, Guix now features a ``Reduced
+Binary Seed'' bootstrap @footnote{We would like to say: ``Full Source
+Bootstrap'' and while we are working towards that goal it would be hyperbole
+to use that term for what we do now.}.
The Reduced Binary Seed bootstrap removes the most critical tools---from a
trust perspective---from the bootstrap binaries: GCC, Binutils and the GNU C
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 83dd2f860f..c52b4302e1 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -656,15 +656,16 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
;; The initial, pre-built inputs. From now on, we can start building our
;; own packages.
`(,@(match (%current-system)
- ("i686-linux" `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
- ("mescc-tools-seed" ,%mescc-tools-seed)
- ("mes-seed" ,%mes-seed)
- ("srfi-43" ,%srfi-43 )
- ("tinycc-seed" ,%tinycc-seed)))
-
- (_ `(("libc" ,%bootstrap-glibc)
- ("gcc" ,%bootstrap-gcc)
- ("binutils" ,%bootstrap-binutils))))
+ ((or "i686-linux" "x86_64-linux")
+ `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
+ ("mescc-tools-seed" ,%mescc-tools-seed)
+ ("mes-seed" ,%mes-seed)
+ ("srfi-43" ,%srfi-43 )
+ ("tinycc-seed" ,%tinycc-seed)))
+ (_
+ `(("libc" ,%bootstrap-glibc)
+ ("gcc" ,%bootstrap-gcc)
+ ("binutils" ,%bootstrap-binutils))))
("coreutils&co" ,%bootstrap-coreutils&co)
;; In gnu-build-system.scm, we rely on the availability of Bash.
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 446129c4be..4c7a381349 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -383,7 +383,8 @@
(mescc-tools (assoc-ref %build-inputs "mescc-tools"))
(libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc
- (string-append libc ,(glibc-dynamic-linker))
+ ;; also for x86_64-linux, we are still on i686-linux
+ (string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader"))))
(setenv "PATH" (string-append
coreutils "/bin"
@@ -488,7 +489,8 @@
(tcc (assoc-ref %build-inputs "tcc"))
(libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc
- (string-append libc ,(glibc-dynamic-linker))
+ ;; also for x86_64-linux, we are still on i686-linux
+ (string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader"))))
;; unpack
(setenv "PATH" (string-append
@@ -510,7 +512,8 @@
(tcc (assoc-ref %build-inputs "tcc"))
(libc (assoc-ref %build-inputs "libc"))
(interpreter (if libc
- (string-append libc ,(glibc-dynamic-linker))
+ ;; also for x86_64-linux, we are still on i686-linux
+ (string-append libc ,(glibc-dynamic-linker "i686-linux"))
(string-append mes "/lib/mes-loader"))))
(invoke "tcc"
"-vvv"
@@ -1140,7 +1143,7 @@ ac_cv_c_float_format='IEEE (little-endian)'
"-B" libc "/lib "
"-Wl,-dynamic-linker "
"-Wl," libc
- ,(glibc-dynamic-linker))))
+ ,(glibc-dynamic-linker "i686-linux"))))
(list (string-append "LDFLAGS=" ldflags)
(string-append "LDFLAGS_FOR_TARGET=" ldflags))))
((#:phases phases)
@@ -1267,7 +1270,8 @@ ac_cv_c_float_format='IEEE (little-endian)'
(display (string-append "#! " bash "/bin/bash
exec " gcc "/bin/" program
" -Wl,--dynamic-linker"
-" -Wl," libc ,(glibc-dynamic-linker)
+;; also for x86_64-linux, we are still on i686-linux
+" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
" -Wl,--rpath"
" -Wl," libc "/lib"
" \"$@\"
@@ -1552,7 +1556,7 @@ exec " gcc "/bin/" program
(sha256
(base32
"1f9bxj176kf3pvs350w2dfs8jgwhminywri5pyn01b11yc4yhsjw"))))
- (supported-systems '("i686-linux"))
+ (supported-systems '("i686-linux" "x86_64-linux"))
(native-inputs `(("mes" ,mes-boot)
("tcc" ,tcc-boot)))
(arguments
@@ -1572,11 +1576,13 @@ exec " gcc "/bin/" program
;; The traditional bootstrap-inputs. For the i686-linux Reduced Binary Seed
;; the actual reduced set with bootstrapped toolchain.
(append (match (%current-system)
- ("i686-linux" `(("libc" ,glibc-mesboot)
- ("binutils" ,binutils-mesboot)
- ("gcc-wrapper" ,gcc-mesboot-wrapper)
- ("gcc" ,gcc-mesboot)))
- (_ '()))
+ ((or "i686-linux" "x86_64-linux")
+ `(("libc" ,glibc-mesboot)
+ ("binutils" ,binutils-mesboot)
+ ("gcc-wrapper" ,gcc-mesboot-wrapper)
+ ("gcc" ,gcc-mesboot)))
+ (_
+ '()))
(%bootstrap-inputs)))
(define gnu-make-boot0
@@ -1723,7 +1729,7 @@ exec " gcc "/bin/" program
#:validate-runpath? #f
,@(match (%current-system)
- ("i686-linux"
+ ((or "i686-linux" "x86_64-linux")
(substitute-keyword-arguments (package-arguments lib)
((#:phases phases)
`(modify-phases ,phases
@@ -1784,6 +1790,17 @@ exec " gcc "/bin/" program
(remove (cut string-match
"--(with-system-zlib|enable-languages.*)" <>)
,flags)))
+ ((#:make-flags flags)
+ `(let* ((libc (assoc-ref %build-inputs "libc"))
+ (libc-native (or (assoc-ref %build-inputs "libc-native")
+ libc)))
+ `(,(string-append "LDFLAGS="
+ "-Wl,-rpath=" libc-native "/lib "
+ "-Wl,-dynamic-linker "
+ "-Wl," libc-native ,(glibc-dynamic-linker
+ (match (%current-system)
+ ("x86_64-linux" "i686-linux")
+ (_ (%current-system))))))))
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'unpack-gmp&co
@@ -1809,7 +1826,7 @@ exec " gcc "/bin/" program
(list gmp-6.0 mpfr mpc))
#t)))
,(match (%current-system)
- ("i686-linux"
+ ((or "i686-linux" "x86_64-linux")
'(add-after 'build 'libtool-workaround
(lambda _
;; libtool: install: /gnu/store/7swwdnq02lqk4xkd8740fxdj1h4va38l-bootstrap-binaries-0/bin/install -c .libs/libcc1.so.0.0.0 /gnu/store/8qf47i99nxz9jvrmq5va0g3q1yvs3x74-gcc-cross-boot0-5.5.0-lib/lib/./libcc1.so.0.0.0
@@ -1817,7 +1834,7 @@ exec " gcc "/bin/" program
(system* "touch"
"libcc1/.libs/libcc1.so.0.0.0"
"libcc1/.libs/libcc1plugin.so.0.0.0"))))
- (_ 'identity))
+ (_ identity))
(add-after 'install 'symlink-libgcc_eh
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "lib")))
@@ -1903,9 +1920,11 @@ exec " gcc "/bin/" program
;; do that (default is "cru".)
#:make-flags `("ARFLAGS=crD"
,,(match (%current-system)
- ;; ranlib: '-D': No such file
- ("i686-linux" "RANLIB=ranlib")
- (_ "RANLIB=ranlib -D"))
+ ;; ranlib: '-D': No such file
+ ((or "i686-linux" "x86_64-linux")
+ "RANLIB=ranlib")
+ (_
+ "RANLIB=ranlib -D"))
"V=1"))))))
(package
(inherit (package-with-bootstrap-guile
@@ -2156,6 +2175,13 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
("bash" ,bash)))
(inputs '())))
+(define (gcc-boot0-intermediate-wrapped)
+ ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
+ ;; non-cross names.
+ (cross-gcc-wrapper gcc-boot0 binutils-boot0
+ glibc-final-with-bootstrap-bash
+ (car (assoc-ref (%boot1-inputs) "bash"))))
+
(define static-bash-for-glibc
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
(let ((bash (package
@@ -2177,14 +2203,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(package-with-explicit-inputs
bash
(lambda _
- (let ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
- glibc-final-with-bootstrap-bash
- (car (assoc-ref (%boot1-inputs) "bash")))))
- `(("gcc" ,gcc)
- ("libc" ,glibc-final-with-bootstrap-bash)
- ("libc:static" ,glibc-final-with-bootstrap-bash "static")
- ,@(fold alist-delete (%boot1-inputs)
- '("gcc" "libc")))))
+ `(("gcc" ,(gcc-boot0-intermediate-wrapped))
+ ("libc" ,glibc-final-with-bootstrap-bash)
+ ("libc:static" ,glibc-final-with-bootstrap-bash "static")
+ ,@(fold alist-delete (%boot1-inputs)
+ '("gcc" "libc"))))
(current-source-location)
#:guile %bootstrap-guile))))
@@ -2344,17 +2367,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
;; positive, so turn it off.
#:validate-runpath? #f
- ;; Build again GMP & co. within GCC's build process, because it's hard
- ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
- ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
- ,@(substitute-keyword-arguments (package-arguments gcc-boot0)
- ((#:configure-flags boot-flags)
- (let loop ((args (package-arguments gcc)))
- (match args
- ((#:configure-flags normal-flags _ ...)
- normal-flags)
- ((_ rest ...)
- (loop rest)))))
+ ,@(substitute-keyword-arguments (package-arguments gcc)
((#:make-flags flags)
;; Since $LIBRARY_PATH is not honored, add the relevant flags.
`(let ((zlib (assoc-ref %build-inputs "zlib")))
@@ -2366,8 +2379,33 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
zlib "/lib")
flag))
,flags)))
+ ;; Build again GMP & co. within GCC's build process, because it's hard
+ ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
+ ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
((#:phases phases)
- `(alist-delete 'symlink-libgcc_eh ,phases)))))
+ `(modify-phases ,phases
+ (add-after 'unpack 'unpack-gmp&co
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gmp (assoc-ref %build-inputs "gmp-source"))
+ (mpfr (assoc-ref %build-inputs "mpfr-source"))
+ (mpc (assoc-ref %build-inputs "mpc-source")))
+
+ ;; To reduce the set of pre-built bootstrap inputs, build
+ ;; GMP & co. from GCC.
+ (for-each (lambda (source)
+ (invoke "tar" "xvf" source))
+ (list gmp mpfr mpc))
+
+ ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+ ,@(map (lambda (lib)
+ ;; Drop trailing letters, as gmp-6.0.0a unpacks
+ ;; into gmp-6.0.0.
+ `(symlink ,(string-trim-right
+ (package-full-name lib "-")
+ char-set:letter)
+ ,(package-name lib)))
+ (list gmp-6.0 mpfr mpc))
+ #t))))))))
;; This time we want Texinfo, so we get the manual. Add
;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of