Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
4050e5d6 | 2 | ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> |
8ba60d7b | 3 | ;;; |
233e7676 | 4 | ;;; This file is part of GNU Guix. |
8ba60d7b | 5 | ;;; |
233e7676 | 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
8ba60d7b LC |
7 | ;;; under the terms of the GNU General Public License as published by |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
233e7676 | 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
8ba60d7b LC |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
8ba60d7b | 18 | |
1ffa7090 | 19 | (define-module (gnu packages make-bootstrap) |
8ba60d7b LC |
20 | #:use-module (guix utils) |
21 | #:use-module (guix packages) | |
312543dc | 22 | #:use-module (guix licenses) |
8ba60d7b | 23 | #:use-module (guix build-system trivial) |
4d058c67 | 24 | #:use-module (guix build-system gnu) |
59a43334 | 25 | #:use-module ((gnu packages) #:select (search-patch)) |
1ffa7090 LC |
26 | #:use-module (gnu packages base) |
27 | #:use-module (gnu packages bash) | |
28 | #:use-module (gnu packages compression) | |
29 | #:use-module (gnu packages gawk) | |
30 | #:use-module (gnu packages guile) | |
31 | #:use-module (gnu packages linux) | |
32 | #:use-module (gnu packages multiprecision) | |
8ba60d7b | 33 | #:use-module (ice-9 match) |
5d4fd267 | 34 | #:use-module (srfi srfi-1) |
8ba60d7b LC |
35 | #:export (%bootstrap-binaries-tarball |
36 | %binutils-bootstrap-tarball | |
37 | %glibc-bootstrap-tarball | |
38 | %gcc-bootstrap-tarball | |
312543dc LC |
39 | %guile-bootstrap-tarball |
40 | %bootstrap-tarballs)) | |
8ba60d7b LC |
41 | |
42 | ;;; Commentary: | |
43 | ;;; | |
44 | ;;; This modules provides tools to build tarballs of the "bootstrap binaries" | |
1ffa7090 | 45 | ;;; used in (gnu packages bootstrap). These statically-linked binaries are |
8ba60d7b LC |
46 | ;;; taken for granted and used as the root of the whole bootstrap procedure. |
47 | ;;; | |
48 | ;;; Code: | |
49 | ||
d3b59727 LC |
50 | (define %glibc-for-bootstrap |
51 | ;; A libc whose `system' and `popen' functions looks for `sh' in $PATH, | |
52 | ;; without nscd, and with static NSS modules. | |
5d4fd267 LC |
53 | (package (inherit glibc-final) |
54 | (arguments | |
55 | (lambda (system) | |
56 | (substitute-keyword-arguments ((package-arguments glibc-final) system) | |
57 | ((#:patches patches) | |
58 | `(cons (assoc-ref %build-inputs "patch/system") | |
d3b59727 LC |
59 | ,patches)) |
60 | ((#:configure-flags flags) | |
61 | ;; Arrange so that getaddrinfo & co. do not contact the nscd, | |
62 | ;; and can use statically-linked NSS modules. | |
63 | `(cons* "--disable-nscd" "--disable-build-nscd" | |
64 | "--enable-static-nss" | |
65 | ,flags))))) | |
5d4fd267 LC |
66 | (inputs |
67 | `(("patch/system" ,(search-patch "glibc-bootstrap-system.patch")) | |
68 | ,@(package-inputs glibc-final))))) | |
69 | ||
70 | (define %standard-inputs-with-relocatable-glibc | |
71 | ;; Standard inputs with the above libc and corresponding GCC. | |
d3b59727 | 72 | `(("libc", %glibc-for-bootstrap) |
5d4fd267 LC |
73 | ("gcc" ,(package-with-explicit-inputs |
74 | gcc-4.7 | |
d3b59727 | 75 | `(("libc",%glibc-for-bootstrap) |
5d4fd267 LC |
76 | ,@(alist-delete "libc" %final-inputs)) |
77 | (current-source-location))) | |
78 | ,@(fold alist-delete %final-inputs '("libc" "gcc")))) | |
79 | ||
8ba60d7b | 80 | (define %bash-static |
450fb5a6 | 81 | (static-package bash-light)) |
8ba60d7b LC |
82 | |
83 | (define %static-inputs | |
84 | ;; Packages that are to be used as %BOOTSTRAP-INPUTS. | |
85 | (let ((coreutils (package (inherit coreutils) | |
86 | (arguments | |
87 | `(#:configure-flags | |
88 | '("--disable-nls" | |
89 | "--disable-silent-rules" | |
90 | "--enable-no-install-program=stdbuf,libstdbuf.so" | |
c2d771fd | 91 | "CFLAGS=-Os -g0" ; smaller, please |
8ba60d7b | 92 | "LDFLAGS=-static -pthread") |
c2d771fd LC |
93 | #:tests? #f ; signal-related Gnulib tests fail |
94 | ,@(package-arguments coreutils))) | |
95 | ||
96 | ;; Remove optional dependencies such as GMP. | |
97 | (inputs `(,(assoc "perl" (package-inputs coreutils)))))) | |
8ba60d7b LC |
98 | (bzip2 (package (inherit bzip2) |
99 | (arguments | |
100 | (substitute-keyword-arguments (package-arguments bzip2) | |
101 | ((#:phases phases) | |
102 | `(alist-cons-before | |
103 | 'build 'dash-static | |
104 | (lambda _ | |
105 | (substitute* "Makefile" | |
106 | (("^LDFLAGS[[:blank:]]*=.*$") | |
107 | "LDFLAGS = -static"))) | |
108 | ,phases)))))) | |
109 | (xz (package (inherit xz) | |
110 | (arguments | |
111 | `(#:strip-flags '("--strip-all") | |
112 | #:phases (alist-cons-before | |
113 | 'configure 'static-executable | |
114 | (lambda _ | |
115 | ;; Ask Libtool for a static executable. | |
116 | (substitute* "src/xz/Makefile.in" | |
117 | (("^xz_LDADD =") | |
118 | "xz_LDADD = -all-static"))) | |
119 | %standard-phases))))) | |
120 | (gawk (package (inherit gawk) | |
121 | (arguments | |
122 | (lambda (system) | |
5d4fd267 | 123 | `(#:patches (list (assoc-ref %build-inputs "patch/sh")) |
fdc78b72 LC |
124 | ,@(substitute-keyword-arguments |
125 | ((package-arguments gawk) system) | |
126 | ((#:phases phases) | |
127 | `(alist-cons-before | |
128 | 'configure 'no-export-dynamic | |
129 | (lambda _ | |
130 | ;; Since we use `-static', remove | |
131 | ;; `-export-dynamic'. | |
132 | (substitute* "configure" | |
133 | (("-export-dynamic") ""))) | |
134 | ,phases)))))) | |
5d4fd267 LC |
135 | (inputs `(("patch/sh" ,(search-patch "gawk-shell.patch")))))) |
136 | (finalize (lambda (p) | |
137 | (static-package (package-with-explicit-inputs | |
138 | p | |
139 | %standard-inputs-with-relocatable-glibc) | |
140 | (current-source-location))))) | |
8ba60d7b LC |
141 | `(,@(map (match-lambda |
142 | ((name package) | |
5d4fd267 | 143 | (list name (finalize package)))) |
8ba60d7b LC |
144 | `(("tar" ,tar) |
145 | ("gzip" ,gzip) | |
146 | ("bzip2" ,bzip2) | |
147 | ("xz" ,xz) | |
148 | ("patch" ,patch) | |
149 | ("coreutils" ,coreutils) | |
150 | ("sed" ,sed) | |
151 | ("grep" ,grep) | |
152 | ("gawk" ,gawk))) | |
153 | ("bash" ,%bash-static) | |
154 | ;; ("ld-wrapper" ,ld-wrapper) | |
155 | ;; ("binutils" ,binutils-final) | |
156 | ;; ("gcc" ,gcc-final) | |
157 | ;; ("libc" ,glibc-final) | |
158 | ))) | |
159 | ||
160 | (define %static-binaries | |
161 | (package | |
162 | (name "static-binaries") | |
163 | (version "0") | |
164 | (build-system trivial-build-system) | |
165 | (source #f) | |
166 | (inputs %static-inputs) | |
167 | (arguments | |
168 | `(#:modules ((guix build utils)) | |
169 | #:builder | |
170 | (begin | |
171 | (use-modules (ice-9 ftw) | |
172 | (ice-9 match) | |
173 | (srfi srfi-1) | |
174 | (srfi srfi-26) | |
175 | (guix build utils)) | |
176 | ||
177 | (let () | |
178 | (define (directory-contents dir) | |
179 | (map (cut string-append dir "/" <>) | |
180 | (scandir dir (negate (cut member <> '("." "..")))))) | |
181 | ||
182 | (define (copy-directory source destination) | |
183 | (for-each (lambda (file) | |
184 | (format #t "copying ~s...~%" file) | |
185 | (copy-file file | |
186 | (string-append destination "/" | |
187 | (basename file)))) | |
188 | (directory-contents source))) | |
189 | ||
190 | (let* ((out (assoc-ref %outputs "out")) | |
191 | (bin (string-append out "/bin"))) | |
192 | (mkdir-p bin) | |
193 | ||
194 | ;; Copy Coreutils binaries. | |
195 | (let* ((coreutils (assoc-ref %build-inputs "coreutils")) | |
196 | (source (string-append coreutils "/bin"))) | |
197 | (copy-directory source bin)) | |
198 | ||
199 | ;; For the other inputs, copy just one binary, which has the | |
200 | ;; same name as the input. | |
201 | (for-each (match-lambda | |
202 | ((name . dir) | |
203 | (let ((source (string-append dir "/bin/" name))) | |
204 | (format #t "copying ~s...~%" source) | |
205 | (copy-file source | |
206 | (string-append bin "/" name))))) | |
207 | (alist-delete "coreutils" %build-inputs)) | |
208 | ||
209 | ;; But of course, there are exceptions to this rule. | |
210 | (let ((grep (assoc-ref %build-inputs "grep"))) | |
211 | (copy-file (string-append grep "/bin/fgrep") | |
212 | (string-append bin "/fgrep")) | |
213 | (copy-file (string-append grep "/bin/egrep") | |
214 | (string-append bin "/egrep"))) | |
215 | ||
216 | ;; Clear references to the store path. | |
217 | (for-each remove-store-references | |
218 | (directory-contents bin)) | |
219 | ||
220 | (with-directory-excursion bin | |
221 | ;; Programs such as Perl's build system want these aliases. | |
222 | (symlink "bash" "sh") | |
223 | (symlink "gawk" "awk")) | |
224 | ||
225 | #t))))) | |
226 | (synopsis "Statically-linked bootstrap binaries") | |
227 | (description | |
228 | "Binaries used to bootstrap the distribution.") | |
229 | (license #f) | |
230 | (home-page #f))) | |
231 | ||
232 | (define %binutils-static | |
233 | ;; Statically-linked Binutils. | |
234 | (package (inherit binutils) | |
235 | (name "binutils-static") | |
236 | (arguments | |
01d45404 | 237 | `(#:configure-flags '("--disable-gold" "--with-lib-path=/no-ld-lib-path") |
8ba60d7b LC |
238 | #:strip-flags '("--strip-all") |
239 | #:phases (alist-cons-before | |
240 | 'configure 'all-static | |
241 | (lambda _ | |
242 | ;; The `-all-static' libtool flag can only be passed | |
243 | ;; after `configure', since configure tests don't use | |
244 | ;; libtool, and only for executables built with libtool. | |
245 | (substitute* '("binutils/Makefile.in" | |
246 | "gas/Makefile.in" | |
247 | "ld/Makefile.in") | |
248 | (("^LDFLAGS =(.*)$" line) | |
249 | (string-append line | |
250 | "\nAM_LDFLAGS = -static -all-static\n")))) | |
251 | %standard-phases))))) | |
252 | ||
253 | (define %binutils-static-stripped | |
254 | ;; The subset of Binutils that we need. | |
255 | (package (inherit %binutils-static) | |
256 | (build-system trivial-build-system) | |
257 | (arguments | |
258 | `(#:modules ((guix build utils)) | |
259 | #:builder | |
260 | (begin | |
261 | (use-modules (guix build utils)) | |
262 | ||
263 | (setvbuf (current-output-port) _IOLBF) | |
264 | (let* ((in (assoc-ref %build-inputs "binutils")) | |
265 | (out (assoc-ref %outputs "out")) | |
266 | (bin (string-append out "/bin"))) | |
267 | (mkdir-p bin) | |
268 | (for-each (lambda (file) | |
269 | (let ((target (string-append bin "/" file))) | |
270 | (format #t "copying `~a'...~%" file) | |
271 | (copy-file (string-append in "/bin/" file) | |
272 | target) | |
273 | (remove-store-references target))) | |
274 | '("ar" "as" "ld" "nm" "objcopy" "objdump" | |
275 | "ranlib" "readelf" "size" "strings" "strip")) | |
276 | #t)))) | |
277 | (inputs `(("binutils" ,%binutils-static))))) | |
278 | ||
279 | (define %glibc-stripped | |
280 | ;; GNU libc's essential shared libraries, dynamic linker, and headers, | |
281 | ;; with all references to store directories stripped. As a result, | |
282 | ;; libc.so is unusable and need to be patched for proper relocation. | |
d3b59727 | 283 | (let ((glibc %glibc-for-bootstrap)) |
5d4fd267 LC |
284 | (package (inherit glibc) |
285 | (name "glibc-stripped") | |
286 | (build-system trivial-build-system) | |
287 | (arguments | |
288 | `(#:modules ((guix build utils)) | |
289 | #:builder | |
290 | (begin | |
291 | (use-modules (guix build utils)) | |
292 | ||
293 | (setvbuf (current-output-port) _IOLBF) | |
294 | (let* ((out (assoc-ref %outputs "out")) | |
295 | (libdir (string-append out "/lib")) | |
296 | (incdir (string-append out "/include")) | |
297 | (libc (assoc-ref %build-inputs "libc")) | |
298 | (linux (assoc-ref %build-inputs "linux-headers"))) | |
299 | (mkdir-p libdir) | |
300 | (for-each (lambda (file) | |
301 | (let ((target (string-append libdir "/" | |
302 | (basename file)))) | |
303 | (copy-file file target) | |
304 | (remove-store-references target))) | |
305 | (find-files (string-append libc "/lib") | |
306 | "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$")) | |
307 | ||
308 | (copy-recursively (string-append libc "/include") incdir) | |
309 | ||
310 | ;; Copy some of the Linux-Libre headers that glibc headers | |
311 | ;; refer to. | |
312 | (mkdir (string-append incdir "/linux")) | |
313 | (for-each (lambda (file) | |
314 | (copy-file (string-append linux "/include/linux/" file) | |
315 | (string-append incdir "/linux/" | |
316 | (basename file)))) | |
317 | '("limits.h" "errno.h" "socket.h" "kernel.h" | |
318 | "sysctl.h" "param.h" "ioctl.h" "types.h" | |
319 | "posix_types.h" "stddef.h")) | |
320 | ||
321 | (copy-recursively (string-append linux "/include/asm") | |
322 | (string-append incdir "/asm")) | |
323 | (copy-recursively (string-append linux "/include/asm-generic") | |
324 | (string-append incdir "/asm-generic")) | |
325 | #t)))) | |
326 | (inputs `(("libc" ,glibc) | |
327 | ("linux-headers" ,linux-libre-headers)))))) | |
8ba60d7b LC |
328 | |
329 | (define %gcc-static | |
330 | ;; A statically-linked GCC, with stripped-down functionality. | |
5d4fd267 LC |
331 | (package-with-explicit-inputs |
332 | (package (inherit gcc-final) | |
333 | (name "gcc-static") | |
334 | (arguments | |
335 | (lambda (system) | |
336 | `(#:modules ((guix build utils) | |
337 | (guix build gnu-build-system) | |
338 | (srfi srfi-1) | |
339 | (srfi srfi-26) | |
340 | (ice-9 regex)) | |
341 | ,@(substitute-keyword-arguments ((package-arguments gcc-final) system) | |
342 | ((#:guile _) #f) | |
343 | ((#:implicit-inputs? _) #t) | |
344 | ((#:configure-flags flags) | |
345 | `(append (list | |
346 | "--disable-shared" | |
347 | "--disable-plugin" | |
348 | "--enable-languages=c" | |
349 | "--disable-libmudflap" | |
350 | "--disable-libgomp" | |
351 | "--disable-libssp" | |
352 | "--disable-libquadmath" | |
353 | "--disable-decimal-float") | |
354 | (remove (cut string-match "--(.*plugin|enable-languages)" <>) | |
355 | ,flags))) | |
356 | ((#:make-flags flags) | |
357 | `(cons "BOOT_LDFLAGS=-static" ,flags)))))) | |
358 | (inputs `(("gmp-source" ,(package-source gmp)) | |
359 | ("mpfr-source" ,(package-source mpfr)) | |
360 | ("mpc-source" ,(package-source mpc)) | |
361 | ("binutils" ,binutils-final) | |
362 | ,@(package-inputs gcc-4.7)))) | |
363 | %standard-inputs-with-relocatable-glibc)) | |
8ba60d7b LC |
364 | |
365 | (define %gcc-stripped | |
366 | ;; The subset of GCC files needed for bootstrap. | |
367 | (package (inherit gcc-4.7) | |
368 | (name "gcc-stripped") | |
369 | (build-system trivial-build-system) | |
370 | (source #f) | |
371 | (arguments | |
372 | `(#:modules ((guix build utils)) | |
373 | #:builder | |
374 | (begin | |
375 | (use-modules (srfi srfi-1) | |
376 | (srfi srfi-26) | |
377 | (guix build utils)) | |
378 | ||
379 | (setvbuf (current-output-port) _IOLBF) | |
380 | (let* ((out (assoc-ref %outputs "out")) | |
381 | (bindir (string-append out "/bin")) | |
382 | (libdir (string-append out "/lib")) | |
383 | (libexecdir (string-append out "/libexec")) | |
384 | (gcc (assoc-ref %build-inputs "gcc"))) | |
385 | (copy-recursively (string-append gcc "/bin") bindir) | |
386 | (for-each remove-store-references | |
387 | (find-files bindir ".*")) | |
388 | ||
389 | (copy-recursively (string-append gcc "/lib") libdir) | |
390 | (for-each remove-store-references | |
391 | (remove (cut string-suffix? ".h" <>) | |
392 | (find-files libdir ".*"))) | |
393 | ||
394 | (copy-recursively (string-append gcc "/libexec") | |
395 | libexecdir) | |
396 | (for-each remove-store-references | |
397 | (find-files libexecdir ".*")) | |
398 | #t)))) | |
399 | (inputs `(("gcc" ,%gcc-static))))) | |
400 | ||
401 | (define %guile-static | |
402 | ;; A statically-linked Guile that is relocatable--i.e., it can search | |
403 | ;; .scm and .go files relative to its installation directory, rather | |
404 | ;; than in hard-coded configure-time paths. | |
405 | (let ((guile (package (inherit guile-2.0) | |
406 | (inputs | |
407 | `(("patch/relocatable" | |
408 | ,(search-patch "guile-relocatable.patch")) | |
409 | ("patch/utf8" | |
410 | ,(search-patch "guile-default-utf8.patch")) | |
411 | ,@(package-inputs guile-2.0))) | |
412 | (arguments | |
413 | `(;; When `configure' checks for ltdl availability, it | |
414 | ;; doesn't try to link using libtool, and thus fails | |
415 | ;; because of a missing -ldl. Work around that. | |
416 | #:configure-flags '("LDFLAGS=-ldl") | |
417 | ||
418 | #:phases (alist-cons-before | |
419 | 'configure 'static-guile | |
420 | (lambda _ | |
421 | (substitute* "libguile/Makefile.in" | |
422 | ;; Create a statically-linked `guile' | |
423 | ;; executable. | |
424 | (("^guile_LDFLAGS =") | |
425 | "guile_LDFLAGS = -all-static") | |
426 | ||
427 | ;; Add `-ldl' *after* libguile-2.0.la. | |
428 | (("^guile_LDADD =(.*)$" _ ldadd) | |
429 | (string-append "guile_LDADD = " | |
430 | (string-trim-right ldadd) | |
431 | " -ldl\n")))) | |
432 | %standard-phases) | |
433 | ||
434 | ;; Allow Guile to be relocated, as is needed during | |
435 | ;; bootstrap. | |
436 | #:patches | |
437 | (list (assoc-ref %build-inputs "patch/relocatable") | |
438 | (assoc-ref %build-inputs "patch/utf8")) | |
439 | ||
440 | ;; There are uses of `dynamic-link' in | |
441 | ;; {foreign,coverage}.test that don't fly here. | |
442 | #:tests? #f))))) | |
5d4fd267 LC |
443 | (package-with-explicit-inputs (static-package guile) |
444 | %standard-inputs-with-relocatable-glibc | |
445 | (current-source-location)))) | |
8ba60d7b LC |
446 | |
447 | (define %guile-static-stripped | |
448 | ;; A stripped static Guile binary, for use during bootstrap. | |
449 | (package (inherit %guile-static) | |
450 | (name "guile-static-stripped") | |
451 | (build-system trivial-build-system) | |
452 | (arguments | |
453 | `(#:modules ((guix build utils)) | |
454 | #:builder | |
455 | (let () | |
456 | (use-modules (guix build utils)) | |
457 | ||
458 | (let ((in (assoc-ref %build-inputs "guile")) | |
459 | (out (assoc-ref %outputs "out"))) | |
460 | (mkdir-p (string-append out "/share/guile/2.0")) | |
461 | (copy-recursively (string-append in "/share/guile/2.0") | |
462 | (string-append out "/share/guile/2.0")) | |
463 | ||
464 | (mkdir-p (string-append out "/lib/guile/2.0/ccache")) | |
465 | (copy-recursively (string-append in "/lib/guile/2.0/ccache") | |
466 | (string-append out "/lib/guile/2.0/ccache")) | |
467 | ||
468 | (mkdir (string-append out "/bin")) | |
469 | (copy-file (string-append in "/bin/guile") | |
470 | (string-append out "/bin/guile")) | |
471 | (remove-store-references (string-append out "/bin/guile")) | |
472 | #t)))) | |
473 | (inputs `(("guile" ,%guile-static))))) | |
474 | ||
475 | (define (tarball-package pkg) | |
476 | "Return a package containing a tarball of PKG." | |
477 | (package (inherit pkg) | |
478 | (location (source-properties->location (current-source-location))) | |
479 | (name (string-append (package-name pkg) "-tarball")) | |
480 | (build-system trivial-build-system) | |
481 | (inputs `(("tar" ,tar) | |
482 | ("xz" ,xz) | |
483 | ("input" ,pkg))) | |
484 | (arguments | |
485 | (lambda (system) | |
486 | (let ((name (package-name pkg)) | |
487 | (version (package-version pkg))) | |
488 | `(#:modules ((guix build utils)) | |
489 | #:builder | |
490 | (begin | |
491 | (use-modules (guix build utils)) | |
492 | (let ((out (assoc-ref %outputs "out")) | |
493 | (input (assoc-ref %build-inputs "input")) | |
494 | (tar (assoc-ref %build-inputs "tar")) | |
495 | (xz (assoc-ref %build-inputs "xz"))) | |
496 | (mkdir out) | |
497 | (set-path-environment-variable "PATH" '("bin") (list tar xz)) | |
498 | (with-directory-excursion input | |
499 | (zero? (system* "tar" "cJvf" | |
500 | (string-append out "/" | |
501 | ,name "-" ,version | |
502 | "-" ,system ".tar.xz") | |
503 | "."))))))))))) | |
504 | ||
505 | (define %bootstrap-binaries-tarball | |
506 | ;; A tarball with the statically-linked bootstrap binaries. | |
507 | (tarball-package %static-binaries)) | |
508 | ||
509 | (define %binutils-bootstrap-tarball | |
510 | ;; A tarball with the statically-linked Binutils programs. | |
511 | (tarball-package %binutils-static-stripped)) | |
512 | ||
513 | (define %glibc-bootstrap-tarball | |
514 | ;; A tarball with GNU libc's shared libraries, dynamic linker, and headers. | |
515 | (tarball-package %glibc-stripped)) | |
516 | ||
517 | (define %gcc-bootstrap-tarball | |
518 | ;; A tarball with a dynamic-linked GCC and its headers. | |
519 | (tarball-package %gcc-stripped)) | |
520 | ||
521 | (define %guile-bootstrap-tarball | |
522 | ;; A tarball with the statically-linked, relocatable Guile. | |
523 | (tarball-package %guile-static-stripped)) | |
524 | ||
312543dc LC |
525 | (define %bootstrap-tarballs |
526 | ;; A single derivation containing all the bootstrap tarballs, for | |
527 | ;; convenience. | |
528 | (package | |
529 | (name "bootstrap-tarballs") | |
530 | (version "0") | |
531 | (source #f) | |
532 | (build-system trivial-build-system) | |
533 | (arguments | |
534 | `(#:modules ((guix build utils)) | |
535 | #:builder | |
536 | (let ((out (assoc-ref %outputs "out"))) | |
537 | (use-modules (guix build utils) | |
538 | (ice-9 match) | |
539 | (srfi srfi-26)) | |
540 | ||
541 | (setvbuf (current-output-port) _IOLBF) | |
542 | (mkdir out) | |
543 | (chdir out) | |
544 | (for-each (match-lambda | |
545 | ((name . directory) | |
546 | (for-each (lambda (file) | |
547 | (format #t "~a -> ~a~%" file out) | |
548 | (symlink file (basename file))) | |
549 | (find-files directory "\\.tar\\.")))) | |
550 | %build-inputs) | |
551 | #t))) | |
552 | (inputs `(("guile-tarball" ,%guile-bootstrap-tarball) | |
553 | ("gcc-tarball" ,%gcc-bootstrap-tarball) | |
554 | ("binutils-tarball" ,%binutils-bootstrap-tarball) | |
555 | ("glibc-tarball" ,%glibc-bootstrap-tarball) | |
556 | ("coreutils&co-tarball" ,%bootstrap-binaries-tarball))) | |
557 | (synopsis #f) | |
558 | (description #f) | |
559 | (home-page #f) | |
560 | (license gpl3+))) | |
561 | ||
8ba60d7b | 562 | ;;; make-bootstrap.scm ends here |