bootstrap.scm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages bootstrap)
  21. #:use-module (guix licenses)
  22. #:use-module (gnu packages)
  23. #:use-module (guix packages)
  24. #:use-module (guix download)
  25. #:use-module (guix build-system)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix build-system trivial)
  28. #:use-module ((guix store)
  29. #:select (run-with-store add-to-store add-text-to-store))
  30. #:use-module ((guix derivations)
  31. #:select (derivation derivation->output-path))
  32. #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
  33. #:use-module (guix memoization)
  34. #:use-module (srfi srfi-1)
  35. #:use-module (srfi srfi-26)
  36. #:use-module (ice-9 match)
  37. #:export (bootstrap-origin
  38. package-with-bootstrap-guile
  39. glibc-dynamic-linker
  40. bootstrap-guile-origin
  41. %bootstrap-guile
  42. %bootstrap-coreutils&co
  43. %bootstrap-binutils
  44. %bootstrap-gcc
  45. %bootstrap-glibc
  46. %bootstrap-inputs))
  47. ;;; Commentary:
  48. ;;;
  49. ;;; Pre-built packages that are used to bootstrap the
  50. ;;; distribution--i.e., to build all the core packages from scratch.
  51. ;;;
  52. ;;; Code:
  53. ;;;
  54. ;;; Helper procedures.
  55. ;;;
  56. (define (bootstrap-origin source)
  57. "Return a variant of SOURCE, an <origin> instance, whose method uses
  58. %BOOTSTRAP-GUILE to do its job."
  59. (define (boot fetch)
  60. (lambda* (url hash-algo hash
  61. #:optional name #:key system)
  62. (fetch url hash-algo hash name
  63. #:guile %bootstrap-guile
  64. #:system system)))
  65. (define %bootstrap-patch-inputs
  66. ;; Packages used when an <origin> has a non-empty 'patches' field.
  67. `(("tar" ,%bootstrap-coreutils&co)
  68. ("xz" ,%bootstrap-coreutils&co)
  69. ("bzip2" ,%bootstrap-coreutils&co)
  70. ("gzip" ,%bootstrap-coreutils&co)
  71. ("patch" ,%bootstrap-coreutils&co)))
  72. (let ((orig-method (origin-method source)))
  73. (origin (inherit source)
  74. (method (cond ((eq? orig-method url-fetch)
  75. (boot url-fetch))
  76. (else orig-method)))
  77. (patch-guile %bootstrap-guile)
  78. (patch-inputs %bootstrap-patch-inputs)
  79. ;; Patches can be origins as well, so process them.
  80. (patches (map (match-lambda
  81. ((? origin? patch)
  82. (bootstrap-origin patch))
  83. (patch patch))
  84. (origin-patches source))))))
  85. (define* (package-from-tarball name source program-to-test description
  86. #:key snippet)
  87. "Return a package that correspond to the extraction of SOURCE.
  88. PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to check
  89. whether everything is alright. If SNIPPET is provided, it is evaluated after
  90. extracting SOURCE. SNIPPET should raise an exception to signal an error; its
  91. return value is ignored."
  92. (package
  93. (name name)
  94. (version "0")
  95. (build-system trivial-build-system)
  96. (arguments
  97. `(#:guile ,%bootstrap-guile
  98. #:modules ((guix build utils))
  99. #:builder
  100. (let ((out (assoc-ref %outputs "out"))
  101. (tar (assoc-ref %build-inputs "tar"))
  102. (xz (assoc-ref %build-inputs "xz"))
  103. (tarball (assoc-ref %build-inputs "tarball")))
  104. (use-modules (guix build utils))
  105. (mkdir out)
  106. (copy-file tarball "binaries.tar.xz")
  107. (invoke xz "-d" "binaries.tar.xz")
  108. (let ((builddir (getcwd)))
  109. (with-directory-excursion out
  110. (invoke tar "xvf"
  111. (string-append builddir "/binaries.tar"))
  112. ,@(if snippet (list snippet) '())
  113. (invoke (string-append "bin/" ,program-to-test)
  114. "--version"))))))
  115. (inputs
  116. `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
  117. ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
  118. ("tarball" ,(bootstrap-origin (source (%current-system))))))
  119. (source #f)
  120. (synopsis description)
  121. (description description)
  122. (home-page #f)
  123. (license gpl3+)))
  124. (define package-with-bootstrap-guile
  125. (mlambdaq (p)
  126. "Return a variant of P such that all its origins are fetched with
  127. %BOOTSTRAP-GUILE."
  128. (define rewritten-input
  129. (match-lambda
  130. ((name (? origin? o))
  131. `(,name ,(bootstrap-origin o)))
  132. ((name (? package? p) sub-drvs ...)
  133. `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
  134. (x x)))
  135. (package (inherit p)
  136. (source (match (package-source p)
  137. ((? origin? o) (bootstrap-origin o))
  138. (s s)))
  139. (inputs (map rewritten-input
  140. (package-inputs p)))
  141. (native-inputs (map rewritten-input
  142. (package-native-inputs p)))
  143. (propagated-inputs (map rewritten-input
  144. (package-propagated-inputs p)))
  145. (replacement (and=> (package-replacement p)
  146. package-with-bootstrap-guile)))))
  147. (define* (glibc-dynamic-linker
  148. #:optional (system (or (and=> (%current-target-system)
  149. gnu-triplet->nix-system)
  150. (%current-system))))
  151. "Return the name of Glibc's dynamic linker for SYSTEM."
  152. ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
  153. (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
  154. ((string=? system "i686-linux") "/lib/ld-linux.so.2")
  155. ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
  156. ((string=? system "mips64el-linux") "/lib/ld.so.1")
  157. ((string=? system "i586-gnu") "/lib/ld.so.1")
  158. ((string=? system "i686-gnu") "/lib/ld.so.1")
  159. ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
  160. ((string=? system "powerpc-linux") "/lib/ld.so.1")
  161. ((string=? system "powerpc64le-linux") "/lib/ld64.so.2")
  162. ((string=? system "alpha-linux") "/lib/ld-linux.so.2")
  163. ((string=? system "s390x-linux") "/lib/ld64.so.1")
  164. ;; XXX: This one is used bare-bones, without a libc, so add a case
  165. ;; here just so we can keep going.
  166. ((string=? system "arm-elf") "no-ld.so")
  167. ((string=? system "arm-eabi") "no-ld.so")
  168. ((string=? system "xtensa-elf") "no-ld.so")
  169. ((string=? system "avr") "no-ld.so")
  170. ((string=? system "propeller-elf") "no-ld.so")
  171. ((string=? system "i686-mingw") "no-ld.so")
  172. ((string=? system "vc4-elf") "no-ld.so")
  173. (else (error "dynamic linker name not known for this system"
  174. system))))
  175. ;;;
  176. ;;; Bootstrap packages.
  177. ;;;
  178. (define %bootstrap-base-urls
  179. ;; This is where the initial binaries come from.
  180. '("https://alpha.gnu.org/gnu/guix/bootstrap"
  181. "http://alpha.gnu.org/gnu/guix/bootstrap"
  182. "ftp://alpha.gnu.org/gnu/guix/bootstrap"
  183. "http://www.fdn.fr/~lcourtes/software/guix/packages"
  184. "http://flashner.co.il/guix/bootstrap"))
  185. (define (bootstrap-guile-url-path system)
  186. "Return the URI for FILE."
  187. (string-append "/" system
  188. (match system
  189. ("aarch64-linux"
  190. "/20170217/guile-2.0.14.tar.xz")
  191. ("armhf-linux"
  192. "/20150101/guile-2.0.11.tar.xz")
  193. (_
  194. "/20131110/guile-2.0.9.tar.xz"))))
  195. (define (bootstrap-guile-hash system)
  196. "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
  197. (match system
  198. ("x86_64-linux"
  199. (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
  200. ("i686-linux"
  201. (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
  202. ("mips64el-linux"
  203. (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
  204. ("armhf-linux"
  205. (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
  206. ("aarch64-linux"
  207. (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))))
  208. (define (bootstrap-guile-origin system)
  209. "Return an <origin> object for the Guile tarball of SYSTEM."
  210. (origin
  211. (method url-fetch)
  212. (uri (map (cute string-append <> (bootstrap-guile-url-path system))
  213. %bootstrap-base-urls))
  214. (sha256 (bootstrap-guile-hash system))))
  215. (define (download-bootstrap-guile store system)
  216. "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
  217. (let* ((path (bootstrap-guile-url-path system))
  218. (base (basename path))
  219. (urls (map (cut string-append <> path) %bootstrap-base-urls)))
  220. (run-with-store store
  221. (url-fetch urls 'sha256 (bootstrap-guile-hash system)
  222. #:system system))))
  223. (define* (raw-build store name inputs
  224. #:key outputs system search-paths
  225. #:allow-other-keys)
  226. (define (->store file)
  227. (add-to-store store file #t "sha256"
  228. (or (search-bootstrap-binary file
  229. system)
  230. (error "bootstrap binary not found"
  231. file system))))
  232. (let* ((tar (->store "tar"))
  233. (xz (->store "xz"))
  234. (mkdir (->store "mkdir"))
  235. (bash (->store "bash"))
  236. (guile (download-bootstrap-guile store system))
  237. ;; The following code, run by the bootstrap guile after it is
  238. ;; unpacked, creates a wrapper for itself to set its load path.
  239. ;; This replaces the previous non-portable method based on
  240. ;; reading the /proc/self/exe symlink.
  241. (make-guile-wrapper
  242. '(begin
  243. (use-modules (ice-9 match))
  244. (match (command-line)
  245. ((_ out bash)
  246. (let ((bin-dir (string-append out "/bin"))
  247. (guile (string-append out "/bin/guile"))
  248. (guile-real (string-append out "/bin/.guile-real"))
  249. ;; We must avoid using a bare dollar sign in this code,
  250. ;; because it would be interpreted by the shell.
  251. (dollar (string (integer->char 36))))
  252. (chmod bin-dir #o755)
  253. (rename-file guile guile-real)
  254. (call-with-output-file guile
  255. (lambda (p)
  256. (format p "\
  257. #!~a
  258. export GUILE_SYSTEM_PATH=~a/share/guile/2.0
  259. export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
  260. exec -a \"~a0\" ~a \"~a@\"\n"
  261. bash out out dollar guile-real dollar)))
  262. (chmod guile #o555)
  263. (chmod bin-dir #o555))))))
  264. (builder
  265. (add-text-to-store store
  266. "build-bootstrap-guile.sh"
  267. (format #f "
  268. echo \"unpacking bootstrap Guile to '$out'...\"
  269. ~a $out
  270. cd $out
  271. ~a -dc < $GUILE_TARBALL | ~a xv
  272. # Use the bootstrap guile to create its own wrapper to set the load path.
  273. GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
  274. GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
  275. $out/bin/guile -c ~s $out ~a
  276. # Sanity check.
  277. $out/bin/guile --version~%"
  278. mkdir xz tar
  279. (format #f "~s" make-guile-wrapper)
  280. bash)
  281. (list mkdir xz tar bash))))
  282. (derivation store name
  283. bash `(,builder)
  284. #:system system
  285. #:inputs `((,bash) (,builder) (,guile))
  286. #:env-vars `(("GUILE_TARBALL"
  287. . ,(derivation->output-path guile))))))
  288. (define* (make-raw-bag name
  289. #:key source inputs native-inputs outputs
  290. system target)
  291. (bag
  292. (name name)
  293. (system system)
  294. (build-inputs inputs)
  295. (build raw-build)))
  296. (define %bootstrap-guile
  297. ;; The Guile used to run the build scripts of the initial derivations.
  298. ;; It is just unpacked from a tarball containing a pre-built binary.
  299. ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
  300. ;;
  301. ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
  302. ;; support (for /etc/services).
  303. (let ((raw (build-system
  304. (name 'raw)
  305. (description "Raw build system with direct store access")
  306. (lower make-raw-bag))))
  307. (package
  308. (name "guile-bootstrap")
  309. (version "2.0")
  310. (source #f)
  311. (build-system raw)
  312. (synopsis "Bootstrap Guile")
  313. (description "Pre-built Guile for bootstrapping purposes.")
  314. (home-page #f)
  315. (license lgpl3+))))
  316. (define %bootstrap-coreutils&co
  317. (package-from-tarball "bootstrap-binaries"
  318. (lambda (system)
  319. (origin
  320. (method url-fetch)
  321. (uri (map (cut string-append <> "/" system
  322. (match system
  323. ("armhf-linux"
  324. "/20150101/static-binaries.tar.xz")
  325. ("aarch64-linux"
  326. "/20170217/static-binaries.tar.xz")
  327. (_
  328. "/20131110/static-binaries.tar.xz")))
  329. %bootstrap-base-urls))
  330. (sha256
  331. (match system
  332. ("x86_64-linux"
  333. (base32
  334. "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
  335. ("i686-linux"
  336. (base32
  337. "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
  338. ("armhf-linux"
  339. (base32
  340. "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
  341. ("aarch64-linux"
  342. (base32
  343. "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh"))
  344. ("mips64el-linux"
  345. (base32
  346. "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
  347. "fgrep" ; the program to test
  348. "Bootstrap binaries of Coreutils, Awk, etc."
  349. #:snippet
  350. '(let ((path (list (string-append (getcwd) "/bin"))))
  351. (chmod "bin" #o755)
  352. (patch-shebang "bin/egrep" path)
  353. (patch-shebang "bin/fgrep" path)
  354. ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files
  355. ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep'
  356. ;; are not binaries then patch them to execute 'grep' via its
  357. ;; absolute file name instead of searching for it in $PATH.
  358. (if (not (elf-file? "bin/egrep"))
  359. (substitute* '("bin/egrep" "bin/fgrep")
  360. (("^exec grep") (string-append (getcwd) "/bin/grep"))))
  361. (chmod "bin" #o555))))
  362. (define %bootstrap-binutils
  363. (package-from-tarball "binutils-bootstrap"
  364. (lambda (system)
  365. (origin
  366. (method url-fetch)
  367. (uri (map (cut string-append <> "/" system
  368. (match system
  369. ("armhf-linux"
  370. "/20150101/binutils-2.25.tar.xz")
  371. ("aarch64-linux"
  372. "/20170217/binutils-2.27.tar.xz")
  373. (_
  374. "/20131110/binutils-2.23.2.tar.xz")))
  375. %bootstrap-base-urls))
  376. (sha256
  377. (match system
  378. ("x86_64-linux"
  379. (base32
  380. "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20"))
  381. ("i686-linux"
  382. (base32
  383. "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
  384. ("armhf-linux"
  385. (base32
  386. "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
  387. ("aarch64-linux"
  388. (base32
  389. "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n"))
  390. ("mips64el-linux"
  391. (base32
  392. "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
  393. "ld" ; the program to test
  394. "Bootstrap binaries of the GNU Binutils"))
  395. (define %bootstrap-glibc
  396. ;; The initial libc.
  397. (package
  398. (name "glibc-bootstrap")
  399. (version "0")
  400. (source #f)
  401. (build-system trivial-build-system)
  402. (arguments
  403. `(#:guile ,%bootstrap-guile
  404. #:modules ((guix build utils))
  405. #:builder
  406. (let ((out (assoc-ref %outputs "out"))
  407. (tar (assoc-ref %build-inputs "tar"))
  408. (xz (assoc-ref %build-inputs "xz"))
  409. (tarball (assoc-ref %build-inputs "tarball")))
  410. (use-modules (guix build utils))
  411. (mkdir out)
  412. (copy-file tarball "binaries.tar.xz")
  413. (invoke xz "-d" "binaries.tar.xz")
  414. (let ((builddir (getcwd)))
  415. (with-directory-excursion out
  416. (invoke tar "xvf"
  417. (string-append builddir
  418. "/binaries.tar"))
  419. (chmod "lib" #o755)
  420. ;; Patch libc.so so it refers to the right path.
  421. (substitute* "lib/libc.so"
  422. (("/[^ ]+/lib/(libc|ld)" _ prefix)
  423. (string-append out "/lib/" prefix)))
  424. #t)))))
  425. (inputs
  426. `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
  427. ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
  428. ("tarball" ,(bootstrap-origin
  429. (origin
  430. (method url-fetch)
  431. (uri (map (cut string-append <> "/" (%current-system)
  432. (match (%current-system)
  433. ("armhf-linux"
  434. "/20150101/glibc-2.20.tar.xz")
  435. ("aarch64-linux"
  436. "/20170217/glibc-2.25.tar.xz")
  437. (_
  438. "/20131110/glibc-2.18.tar.xz")))
  439. %bootstrap-base-urls))
  440. (sha256
  441. (match (%current-system)
  442. ("x86_64-linux"
  443. (base32
  444. "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v"))
  445. ("i686-linux"
  446. (base32
  447. "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
  448. ("armhf-linux"
  449. (base32
  450. "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
  451. ("aarch64-linux"
  452. (base32
  453. "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c"))
  454. ("mips64el-linux"
  455. (base32
  456. "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
  457. (synopsis "Bootstrap binaries and headers of the GNU C Library")
  458. (description synopsis)
  459. (home-page #f)
  460. (license lgpl2.1+)))
  461. (define %bootstrap-gcc
  462. ;; The initial GCC. Uses binaries from a tarball typically built by
  463. ;; %GCC-BOOTSTRAP-TARBALL.
  464. (package
  465. (name "gcc-bootstrap")
  466. (version "0")
  467. (source #f)
  468. (build-system trivial-build-system)
  469. (arguments
  470. `(#:guile ,%bootstrap-guile
  471. #:modules ((guix build utils))
  472. #:builder
  473. (let ((out (assoc-ref %outputs "out"))
  474. (tar (assoc-ref %build-inputs "tar"))
  475. (xz (assoc-ref %build-inputs "xz"))
  476. (bash (assoc-ref %build-inputs "bash"))
  477. (libc (assoc-ref %build-inputs "libc"))
  478. (tarball (assoc-ref %build-inputs "tarball")))
  479. (use-modules (guix build utils)
  480. (ice-9 popen))
  481. (mkdir out)
  482. (copy-file tarball "binaries.tar.xz")
  483. (invoke xz "-d" "binaries.tar.xz")
  484. (let ((builddir (getcwd))
  485. (bindir (string-append out "/bin")))
  486. (with-directory-excursion out
  487. (invoke tar "xvf"
  488. (string-append builddir "/binaries.tar")))
  489. (with-directory-excursion bindir
  490. (chmod "." #o755)
  491. (rename-file "gcc" ".gcc-wrapped")
  492. (call-with-output-file "gcc"
  493. (lambda (p)
  494. (format p "#!~a
  495. exec ~a/bin/.gcc-wrapped -B~a/lib \
  496. -Wl,-rpath -Wl,~a/lib \
  497. -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
  498. bash
  499. out libc libc libc
  500. ,(glibc-dynamic-linker))))
  501. (chmod "gcc" #o555)
  502. #t)))))
  503. (inputs
  504. `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
  505. ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
  506. ("bash" ,(search-bootstrap-binary "bash" (%current-system)))
  507. ("libc" ,%bootstrap-glibc)
  508. ("tarball" ,(bootstrap-origin
  509. (origin
  510. (method url-fetch)
  511. (uri (map (cut string-append <> "/" (%current-system)
  512. (match (%current-system)
  513. ("armhf-linux"
  514. "/20150101/gcc-4.8.4.tar.xz")
  515. ("aarch64-linux"
  516. "/20170217/gcc-5.4.0.tar.xz")
  517. (_
  518. "/20131110/gcc-4.8.2.tar.xz")))
  519. %bootstrap-base-urls))
  520. (sha256
  521. (match (%current-system)
  522. ("x86_64-linux"
  523. (base32
  524. "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
  525. ("i686-linux"
  526. (base32
  527. "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
  528. ("armhf-linux"
  529. (base32
  530. "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
  531. ("aarch64-linux"
  532. (base32
  533. "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
  534. ("mips64el-linux"
  535. (base32
  536. "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
  537. (native-search-paths
  538. (list (search-path-specification
  539. (variable "CPATH")
  540. (files '("include")))
  541. (search-path-specification
  542. (variable "LIBRARY_PATH")
  543. (files '("lib" "lib64")))))
  544. (synopsis "Bootstrap binaries of the GNU Compiler Collection")
  545. (description synopsis)
  546. (home-page #f)
  547. (license gpl3+)))
  548. (define %bootstrap-inputs
  549. ;; The initial, pre-built inputs. From now on, we can start building our
  550. ;; own packages.
  551. `(("libc" ,%bootstrap-glibc)
  552. ("gcc" ,%bootstrap-gcc)
  553. ("binutils" ,%bootstrap-binutils)
  554. ("coreutils&co" ,%bootstrap-coreutils&co)
  555. ;; In gnu-build-system.scm, we rely on the availability of Bash.
  556. ("bash" ,%bootstrap-coreutils&co)))
  557. ;;; bootstrap.scm ends here