~ruther/guix-local

83ce0cf1f15cbeba13b30fc19ce5368eef370bf5 — Ludovic Courtès 13 years ago 80d09f7
distro: Add a package that gets the bootstrap glibc from a tarball.

* distro/packages/base.scm (%bootstrap-glibc): New variable.
1 files changed, 48 insertions(+), 0 deletions(-)

M distro/packages/base.scm
M distro/packages/base.scm => distro/packages/base.scm +48 -0
@@ 1514,6 1514,54 @@ check whether everything is alright."
                        "ld"                      ; the program to test
                        "Bootstrap binaries of the GNU Binutils"))

(define %bootstrap-glibc
  ;; The initial libc.
  (package
    (name "glibc-bootstrap")
    (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
             (system* tar "xvf"
                      (string-append builddir
                                     "/binaries.tar"))
             (chmod "lib" #o755)

             ;; Patch libc.so so it refers to the right path.
             (substitute* "lib/libc.so"
               (("/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-glibc([^/]+)/")
                (string-append "/" (basename out) "/"))))))))
    (inputs
     `(("tar" ,(lambda (system)
                 (search-bootstrap-binary "tar" system)))
       ("xz"  ,(lambda (system)
                 (search-bootstrap-binary "xz" system)))
       ("tarball" ,(lambda (system)
                     (bootstrap-origin
                      (origin
                       (method http-fetch)
                       (uri (string-append %bootstrap-base-url "/"
                                           system "/glibc-2.16.0.tar.xz"))
                       (sha256
                        (base32 "1qbqmzjxsda74qmzl2rb7049iajary7lvznbym8m2xvqvyid8r2l"))))))))
    (description "Bootstrap binaries and headers of the GNU C Library")
    (long-description #f)
    (home-page #f)))

(define package-with-bootstrap-guile
  (memoize
   (lambda (p)