summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-09-07 15:49:48 +0200
committerLudovic Courtès <ludo@gnu.org>2012-09-07 15:49:48 +0200
commit3c0670e686b33b50f35811f1427bf0d3e1abce41 (patch)
tree960303b7ed844e6dc8c322fd15009108f4192ed9
parent2d14ef0f2ce486fceeeff69cc838c652bb5de9be (diff)
downloadguix-3c0670e686b33b50f35811f1427bf0d3e1abce41.tar.gz
distro: Reduce the bootstrap set.
* distro/base.scm (%bootstrap-inputs): Remove `gnumake', `diffutils',
  and `findutils'.
  (gnu-make-boot0, diffutils-boot0, findutils-boot0, %boot0-inputs): New
  variables.
  (binutils-boot0, gcc-boot0, linux-headers-boot0, %boot1-inputs):
  Replace %BOOTSTRAP-INPUTS by %BOOT0-INPUTS.

  (final-inputs): Remove now unneeded call to
  `source-properties->location'.
-rw-r--r--distro/base.scm64
1 files changed, 51 insertions, 13 deletions
diff --git a/distro/base.scm b/distro/base.scm
index 0aaa225b50..1c5a3d9085 100644
--- a/distro/base.scm
+++ b/distro/base.scm
@@ -1273,15 +1273,10 @@ with the Linux kernel.")
    `(("libc" ,(nixpkgs-derivation "glibc"))
      ,@(map (lambda (name)
               (list name (nixpkgs-derivation name)))
-
-            ;; TODO: Reduce the bootstrap set.  For instance, GNU Make can be
-            ;; built without a `make' instance; Findutils, bzip2, and xz can
-            ;; be built later.
-            '("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
+            '("gnutar" "gzip" "bzip2" "xz" "patch"
               "coreutils" "gnused" "gnugrep" "bash"
-              "findutils"                           ; used by `libtool'
               "gawk"                                ; used by `config.status'
-              "gcc" "binutils" "gnumake")))))
+              "gcc" "binutils")))))
 
 (define-syntax substitute-keyword-arguments
   (syntax-rules ()
@@ -1300,6 +1295,50 @@ previous value of the keyword argument."
          (()
           (reverse before)))))))
 
+(define gnu-make-boot0
+  (package (inherit gnu-make)
+    (name "make-boot0")
+    (location (source-properties->location (current-source-location)))
+    (arguments `(#:implicit-inputs? #f
+                 #:tests? #f                      ; cannot run "make check"
+                 #:phases
+                 (alist-replace
+                  'build (lambda _
+                           (zero? (system* "./build.sh")))
+                  (alist-replace
+                   'install (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (bin (string-append out "/bin")))
+                                (mkdir out)
+                                (mkdir bin)
+                                (copy-file "make"
+                                           (string-append bin "/make"))))
+                   %standard-phases))))
+    (inputs %bootstrap-inputs)))
+
+(define diffutils-boot0
+  (let ((p (package-with-explicit-inputs diffutils
+                                         `(("make" ,gnu-make-boot0)
+                                           ,@%bootstrap-inputs))))
+    (package (inherit p)
+      (location (source-properties->location (current-source-location)))
+      (arguments `(#:tests? #f               ; the test suite needs diffutils
+                   ,@(package-arguments p))))))
+
+(define findutils-boot0
+  (package-with-explicit-inputs findutils
+                                `(("make" ,gnu-make-boot0)
+                                  ("diffutils" ,diffutils-boot0) ; for tests
+                                  ,@%bootstrap-inputs)
+                                (current-source-location)))
+
+
+(define %boot0-inputs
+  `(("make" ,gnu-make-boot0)
+    ("diffutils" ,diffutils-boot0)
+    ("findutils" ,findutils-boot0)
+    ,@%bootstrap-inputs))
+
 (define gcc-boot0
   (package (inherit gcc-4.7)
     (name "gcc-boot0")
@@ -1370,7 +1409,7 @@ previous value of the keyword argument."
               ("gmp-source" ,(package-source gmp))
               ("mpfr-source" ,(package-source mpfr))
               ("mpc-source" ,(package-source mpc))
-              ,@%bootstrap-inputs))))
+              ,@%boot0-inputs))))
 
 (define binutils-boot0
   ;; Since Binutils in GCC-BOOT0 does not get installed, we need another one
@@ -1381,20 +1420,20 @@ previous value of the keyword argument."
      `(#:implicit-inputs? #f
        ,@(package-arguments binutils)))
     (inputs `(("gcc" ,gcc-boot0)
-              ,@(alist-delete "gcc" %bootstrap-inputs)))))
+              ,@(alist-delete "gcc" %boot0-inputs)))))
 
 (define linux-headers-boot0
   (package (inherit linux-headers)
     (arguments `(#:implicit-inputs? #f
                  ,@(package-arguments linux-headers)))
     (native-inputs `(("perl" ,(nixpkgs-derivation* "perl"))
-                     ,@%bootstrap-inputs))))
+                     ,@%boot0-inputs))))
 
 (define %boot1-inputs
   ;; 2nd stage inputs.
   `(("gcc" ,gcc-boot0)
     ("binutils" ,binutils-boot0)
-    ,@(fold alist-delete %bootstrap-inputs
+    ,@(fold alist-delete %boot0-inputs
             '("gcc" "binutils"))))
 
 (define-public glibc-final
@@ -1483,8 +1522,7 @@ previous value of the keyword argument."
 (define-public %final-inputs
   ;; Final derivations used as implicit inputs by `gnu-build-system'.
   (let ((finalize (cut package-with-explicit-inputs <> %boot4-inputs
-                       (source-properties->location
-                        (current-source-location)))))
+                       (current-source-location))))
     `(,@(map (match-lambda
               ((name package)
                (list name (finalize package))))