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 15:00:44 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-21 15:26:46 +0200
commit58a7891ccf5e9eb5b1c8373b2336ef55c3a97ee3 (patch)
treec4ac61f94c748b8244aa7b5b938cbfb24627579e /distro/packages/base.scm
parent17ff4ccdf51bb584cbc9139011393a4a028d6749 (diff)
downloadguix-58a7891ccf5e9eb5b1c8373b2336ef55c3a97ee3.tar.gz
distro: Add a bootstrap glibc tarball.
* distro/packages/base.scm (%glibc-stripped, %glibc-bootstrap-tarball):
  New variables.
Diffstat (limited to 'distro/packages/base.scm')
-rw-r--r--distro/packages/base.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/distro/packages/base.scm b/distro/packages/base.scm
index 29ef2748fd..e153077424 100644
--- a/distro/packages/base.scm
+++ b/distro/packages/base.scm
@@ -2138,6 +2138,37 @@ store.")
            #t))))
     (inputs `(("binutils" ,%binutils-static)))))
 
+(define %glibc-stripped
+  ;; GNU libc's essential shared libraries, dynamic linker, and headers,
+  ;; with all references to store directories stripped.  As a result,
+  ;; libc.so is unusable and need to be patched for proper relocation.
+  (package (inherit glibc-final)
+    (name "glibc-stripped")
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+
+         (setvbuf (current-output-port) _IOLBF)
+         (let* ((out    (assoc-ref %outputs "out"))
+                (libdir (string-append out "/lib"))
+                (incdir (string-append out "/include"))
+                (libc   (assoc-ref %build-inputs "libc")))
+           (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 libc "/lib")
+                                 "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so|libc_nonshared\\.a)$"))
+
+           (copy-recursively (string-append libc "/include") incdir)
+           #t))))
+    (inputs `(("libc" ,glibc-final)))))
+
 (define %guile-static
   ;; A statically-linked Guile that is relocatable--i.e., it can search
   ;; .scm and .go files relative to its installation directory, rather
@@ -2248,6 +2279,10 @@ store.")
   ;; A tarball with the statically-linked Binutils programs.
   (tarball-package %binutils-static-stripped))
 
+(define %glibc-bootstrap-tarball
+  ;; A tarball with GNU libc's shared libraries, dynamic linker, and headers.
+  (tarball-package %glibc-stripped))
+
 (define %guile-bootstrap-tarball
   ;; A tarball with the statically-linked, relocatable Guile.
   (tarball-package %guile-static-stripped))