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-21 17:52:56 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-21 22:00:38 +0200
commit80d09f7452a820e45bcfc5099a50fb14c38edda8 (patch)
tree81d58c2702ac28523a8a65b4b7cb8bd0bac82c64 /distro/packages/base.scm
parent592ef6c88fa8342d23142154c8392f6f1032275f (diff)
downloadguix-80d09f7452a820e45bcfc5099a50fb14c38edda8.tar.gz
distro: Add packages that get Coreutils, Binutils & co. from tarballs.
* distro/packages/base.scm (package-from-tarball): New procedure.
  (%bootstrap-base-url, %bootstrap-coreutils&co, %bootstrap-binutils):
  New variables.
Diffstat (limited to 'distro/packages/base.scm')
-rw-r--r--distro/packages/base.scm71
1 files changed, 71 insertions, 0 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 92c58e9d88..04f0ab375e 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -1443,6 +1443,77 @@ $out/bin/guile --version~%"
                      (boot ftp-fetch))
                     (else orig-method))))))
 
+(define (package-from-tarball name* source* program-to-test description*)
+  "Return a package that correspond to the extraction of SOURCE*.
+PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
+check whether everything is alright."
+  (package
+    (name name*)
+    (version "0")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#: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"))
+             (tarball (assoc-ref %build-inputs "tarball")))
+         (use-modules (guix build utils))
+
+         (mkdir out)
+         (copy-file tarball "binaries.tar.xz")
+         (system* xz "-d" "binaries.tar.xz")
+         (let ((builddir (getcwd)))
+           (with-directory-excursion out
+             (and (zero? (system* tar "xvf"
+                                  (string-append builddir "/binaries.tar")))
+                  (zero? (system* (string-append "bin/" ,program-to-test)
+                                  "--version"))))))))
+    (inputs
+     `(("tar" ,(lambda (system)
+                 (search-bootstrap-binary "tar" system)))
+       ("xz"  ,(lambda (system)
+                 (search-bootstrap-binary "xz" system)))
+       ("tarball" ,(lambda (system)
+                     (bootstrap-origin (source* system))))))
+    (description description*)
+    (long-description #f)
+    (home-page #f)))
+
+(define %bootstrap-base-url
+  ;; This is where the initial binaries come from.
+  "http://www.fdn.fr/~lcourtes/software/guix/packages")
+
+(define %bootstrap-coreutils&co
+  (package-from-tarball "bootstrap-binaries"
+                        (lambda (system)
+                          (origin
+                           (method http-fetch)
+                           (uri (string-append
+                                 %bootstrap-base-url "/"
+                                 system "/static-binaries.tar.xz"))
+                           (sha256
+                            (base32
+                             "0bvhkzahjgf6w5i3db5bjgq8kqm6xdr23lig0s1p8fgdqbfp0bzm"))))
+                        "true"                    ; the program to test
+                        "Bootstrap binaries of Coreutils, Awk, etc."))
+
+(define %bootstrap-binutils
+  (package-from-tarball "binutils-bootstrap"
+                        (lambda (system)
+                          (origin
+                           (method http-fetch)
+                           (uri (string-append
+                                 %bootstrap-base-url "/"
+                                 system "/binutils-static-2.22.tar.xz"))
+                           (sha256
+                            (base32
+                             "1cz1rwqhswgrr14kzbkaj3k32kzgv2b6mmzvc6ssbbz8k2m8jmqa"))))
+                        "ld"                      ; the program to test
+                        "Bootstrap binaries of the GNU Binutils"))
+
 (define package-with-bootstrap-guile
   (memoize
    (lambda (p)