summary refs log tree commit diff
path: root/distro/packages/base.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-22 22:22:37 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-22 22:22:37 +0200
commit5155fb89b27d5eaf12a9e4a650dbf5bae2d332fb (patch)
tree4689a871f800b90be85e0dd319d3ad7a1dffe484 /distro/packages/base.scm
parent83ce0cf1f15cbeba13b30fc19ce5368eef370bf5 (diff)
downloadguix-5155fb89b27d5eaf12a9e4a650dbf5bae2d332fb.tar.gz
distro: Add a statically-linked GCC for bootstrapping.
* distro/packages/base.scm (%gcc-static): New variable.
  (%gcc-stripped): Use it.
Diffstat (limited to 'distro/packages/base.scm')
-rw-r--r--distro/packages/base.scm55
1 files changed, 45 insertions, 10 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 7c9d2927c5..6847564159 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -2288,15 +2288,53 @@ store.")
            #t))))
     (inputs `(("libc" ,glibc-final)))))
 
-(define %gcc-stripped
+(define %gcc-static
+  ;; A statically-linked GCC, with stripped-down functionality.
   (package (inherit gcc-final)
+    (name "gcc-static")
+    (arguments
+     (lambda (system)
+       `(#:modules ((guix build utils)
+                    (guix build gnu-build-system)
+                    (srfi srfi-1)
+                    (srfi srfi-26)
+                    (ice-9 regex))
+         ,@(substitute-keyword-arguments ((package-arguments gcc-final) system)
+             ((#:guile _) #f)
+             ((#:implicit-inputs? _) #t)
+             ((#:configure-flags flags)
+              `(append (list
+                        "--disable-shared"
+                        "--disable-plugin"
+                        "--enable-languages=c"
+                        "--disable-libmudflap"
+                        "--disable-libgomp"
+                        "--disable-libssp"
+                        "--disable-libquadmath"
+                        "--disable-decimal-float")
+                       (remove (cut string-match "--(.*plugin|enable-languages)" <>)
+                               ,flags)))
+             ((#:make-flags flags)
+              `(cons "BOOT_LDFLAGS=-static" ,flags))))))
+    (inputs `(("gmp-source" ,(package-source gmp))
+              ("mpfr-source" ,(package-source mpfr))
+              ("mpc-source" ,(package-source mpc))
+              ("binutils" ,binutils-final)
+              ,@(package-inputs gcc-4.7)))))
+
+(define %gcc-stripped
+  ;; The subset of GCC files needed for bootstrap.
+  (package (inherit gcc-4.7)
     (name "gcc-stripped")
     (build-system trivial-build-system)
+    (source #f)
     (arguments
      `(#:modules ((guix build utils))
        #:builder
        (begin
-         (use-modules (guix build utils))
+         (use-modules (srfi srfi-1)
+                      (srfi srfi-26)
+                      (guix build utils))
 
          (setvbuf (current-output-port) _IOLBF)
          (let* ((out    (assoc-ref %outputs "out"))
@@ -2307,15 +2345,12 @@ store.")
            (for-each remove-store-references
                      (find-files bindir ".*"))
 
-           (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 gcc "/lib") "^libgcc_s.*"))
+           (copy-recursively (string-append gcc "/lib") libdir)
+           (for-each remove-store-references
+                     (remove (cut string-suffix? ".h" <>)
+                             (find-files libdir ".*")))
            #t))))
-    (inputs `(("gcc" ,gcc-final)))))
+    (inputs `(("gcc" ,%gcc-static)))))
 
 (define %guile-static
   ;; A statically-linked Guile that is relocatable--i.e., it can search