From 5ab57a13ddaafb89cec1b887797953d430e13948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 24 Oct 2012 21:07:52 +0200 Subject: [PATCH] distro: Add a bootstrap GCC that uses binaries from the tarball. * distro/packages/base.scm (%bootstrap-gcc): New variable. --- distro/packages/base.scm | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) 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)