summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-24 21:07:52 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-25 00:58:39 +0200
commit5ab57a13ddaafb89cec1b887797953d430e13948 (patch)
tree1f6f3d99f239ff4c382925690f61e69e5e909f79
parentc52a5bf09a5eea8fa4f75f979f5349b743c73d25 (diff)
downloadguix-5ab57a13ddaafb89cec1b887797953d430e13948.tar.gz
distro: Add a bootstrap GCC that uses binaries from the tarball.
* distro/packages/base.scm (%bootstrap-gcc): New variable.
-rw-r--r--distro/packages/base.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 107ca55098..84de5281c4 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -1563,6 +1563,72 @@ check whether everything is alright."
     (long-description #f)
     (home-page #f)))
 
+(define %bootstrap-gcc
+  ;; The initial GCC.  Uses binaries from a tarball typically built by
+  ;; %GCC-BOOTSTRAP-TARBALL.
+  (package
+    (name "gcc-bootstrap")
+    (version "0")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     (lambda (system)
+       `(#:guile ,%bootstrap-guile
+         #:modules ((guix build utils))
+         #:builder
+         (let ((out     (assoc-ref %outputs "out"))
+               (tar     (assoc-ref %build-inputs "tar"))
+               (xz      (assoc-ref %build-inputs "xz"))
+               (bash    (assoc-ref %build-inputs "bash"))
+               (libc    (assoc-ref %build-inputs "libc"))
+               (tarball (assoc-ref %build-inputs "tarball")))
+           (use-modules (guix build utils)
+                        (ice-9 popen))
+
+           (mkdir out)
+           (copy-file tarball "binaries.tar.xz")
+           (system* xz "-d" "binaries.tar.xz")
+           (let ((builddir (getcwd))
+                 (bindir   (string-append out "/bin")))
+             (with-directory-excursion out
+               (system* tar "xvf"
+                        (string-append builddir "/binaries.tar")))
+
+             (with-directory-excursion bindir
+               (chmod "." #o755)
+               (rename-file "gcc" ".gcc-wrapped")
+               (call-with-output-file "gcc"
+                 (lambda (p)
+                   (format p "#!~a
+exec ~a/bin/.gcc-wrapped -B~a/lib \
+     -Wl,-rpath -Wl,~a/lib \
+     -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
+                           bash
+                           out libc libc libc
+                           ,(glibc-dynamic-linker system))))
+
+               (chmod "gcc" #o555)))))))
+    (inputs
+     `(("tar" ,(lambda (system)
+                 (search-bootstrap-binary "tar" system)))
+       ("xz"  ,(lambda (system)
+                 (search-bootstrap-binary "xz" system)))
+       ("bash" ,(lambda (system)
+                  (search-bootstrap-binary "bash" system)))
+       ("libc" ,%bootstrap-glibc)
+       ("tarball" ,(lambda (system)
+                     (bootstrap-origin
+                      (origin
+                       (method http-fetch)
+                       (uri (string-append %bootstrap-base-url "/"
+                                           system "/gcc-4.7.2.tar.xz"))
+                       (sha256
+                        (base32
+                         "07piqzcdaksjbcj037y5gdbh9dfqwzjivg6fkhgg8kif82ibwxxr"))))))))
+    (description "Bootstrap binaries of the GNU Compiler Collection")
+    (long-description #f)
+    (home-page #f)))
+
 (define package-with-bootstrap-guile
   (memoize
    (lambda (p)