You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

654 lines
27 KiB

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