Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
ce0be567 | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
7f1d2dd3 | 3 | ;;; Copyright © 2014, 2015, 2018, 2019 Mark H Weaver <mhw@netris.org> |
6741f543 EF |
4 | ;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il> |
5 | ;;; Copyright © 2018, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | |
67dac6b8 | 6 | ;;; Copyright © 2019 Carl Dong <contact@carldong.me> |
8159ce19 | 7 | ;;; Copyright © 2019 Léo Le Bouter <lle-bout@zaclys.net> |
8a1118a9 CM |
8 | ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> |
9 | ;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com> | |
18633d4f | 10 | ;;; |
233e7676 | 11 | ;;; This file is part of GNU Guix. |
18633d4f | 12 | ;;; |
233e7676 | 13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
18633d4f LC |
14 | ;;; under the terms of the GNU General Public License as published by |
15 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
16 | ;;; your option) any later version. | |
17 | ;;; | |
233e7676 | 18 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
18633d4f LC |
19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;;; GNU General Public License for more details. | |
22 | ;;; | |
23 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
18633d4f | 25 | |
1ffa7090 | 26 | (define-module (gnu packages bootstrap) |
4a44e743 | 27 | #:use-module (guix licenses) |
59a43334 | 28 | #:use-module (gnu packages) |
18633d4f | 29 | #:use-module (guix packages) |
62cab99c | 30 | #:use-module (guix download) |
18633d4f LC |
31 | #:use-module (guix build-system) |
32 | #:use-module (guix build-system gnu) | |
33 | #:use-module (guix build-system trivial) | |
5c93d233 LC |
34 | #:use-module ((guix store) |
35 | #:select (run-with-store add-to-store add-text-to-store)) | |
36 | #:use-module ((guix derivations) | |
266e54e2 | 37 | #:select (derivation derivation-input derivation->output-path)) |
958dd3ce | 38 | #:use-module ((guix utils) #:select (gnu-triplet->nix-system)) |
ac199505 | 39 | #:use-module ((guix gexp) #:select (lower-object)) |
f9704f17 | 40 | #:use-module (guix memoization) |
836a85da | 41 | #:use-module (guix i18n) |
18633d4f LC |
42 | #:use-module (srfi srfi-1) |
43 | #:use-module (srfi srfi-26) | |
836a85da LC |
44 | #:use-module (srfi srfi-34) |
45 | #:use-module (srfi srfi-35) | |
18633d4f LC |
46 | #:use-module (ice-9 match) |
47 | #:export (bootstrap-origin | |
48 | package-with-bootstrap-guile | |
49 | glibc-dynamic-linker | |
50 | ||
1ba0b1e6 | 51 | bootstrap-executable |
3e5750af LC |
52 | bootstrap-guile-origin |
53 | ||
18633d4f LC |
54 | %bootstrap-guile |
55 | %bootstrap-coreutils&co | |
aec77e86 | 56 | %bootstrap-linux-libre-headers |
18633d4f LC |
57 | %bootstrap-binutils |
58 | %bootstrap-gcc | |
59 | %bootstrap-glibc | |
aec77e86 | 60 | %bootstrap-inputs |
b00a95be | 61 | %bootstrap-mescc-tools |
03d76577 LC |
62 | %bootstrap-mes |
63 | ||
64 | %bootstrap-inputs-for-tests)) | |
18633d4f LC |
65 | |
66 | ;;; Commentary: | |
67 | ;;; | |
68 | ;;; Pre-built packages that are used to bootstrap the | |
69 | ;;; distribution--i.e., to build all the core packages from scratch. | |
70 | ;;; | |
71 | ;;; Code: | |
72 | ||
73 | ||
74 | \f | |
836a85da LC |
75 | ;;; |
76 | ;;; The bootstrap executables: 'bash', 'mkdir', 'tar', 'xz'. They allow us to | |
77 | ;;; extract the very first tarball. | |
78 | ;;; | |
79 | ||
80 | (define %bootstrap-executables | |
81 | ;; List of bootstrap executables and their recursive hashes (as per 'guix | |
82 | ;; hash -r'), taking their executable bit into account. | |
83 | `(("aarch64-linux" | |
84 | ("bash" | |
85 | ,(base32 "13aqhqb8nydlwq1ah9974q0iadx1pb95v13wzzyf7vgv6nasrwzr")) | |
86 | ("mkdir" | |
87 | ,(base32 "1pxhdp7ldwavmm71xbh9wc197cb2nr66acjn26yjx3732cixh9ws")) | |
88 | ("tar" | |
89 | ,(base32 "1j51gv08sfg277yxj73xd564wjq3f8xwd6s9rbcg8v9gms47m4cx")) | |
90 | ("xz" | |
91 | ,(base32 "1d779rwsrasphg5g3r37qppcqy3p7ay1jb1y83w7x4i3qsc7zjy2"))) | |
92 | ("armhf-linux" | |
93 | ("bash" | |
94 | ,(base32 "0s6f1s26g4dsrrkl39zblvwpxmbzi6n9mgqf6vxsqz42gik6bgyn")) | |
95 | ("mkdir" | |
96 | ,(base32 "1r5rcp35niyxfkrdf00y2ba8ifrq9bi76cr63lwjf2l655j1i5p7")) | |
97 | ("tar" | |
98 | ,(base32 "0dksx5im3fv8ximz7368bsax9f26nn47ds74298flm5lnvpv9xly")) | |
99 | ("xz" | |
100 | ,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3"))) | |
101 | ("i686-linux" | |
102 | ("bash" | |
103 | ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g")) | |
104 | ("mkdir" | |
105 | ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w")) | |
106 | ("tar" | |
107 | ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms")) | |
108 | ("xz" | |
109 | ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k"))) | |
6741f543 EF |
110 | ("i586-gnu" |
111 | ("bash" | |
112 | ,(base32 "1as8649aqaibahhhrvkj10ci8shpi4hq5n7gnik8rhhy0dc1jarg")) | |
113 | ("mkdir" | |
114 | ,(base32 "1snqgpfrl00hfn82lm29jqylzjsfb9jd6ha74dp12phwb8fpbmb9")) | |
115 | ("tar" | |
116 | ,(base32 "0nq2c1zb3wv5bf7kd83sziaashydazrn7xgq6kijlk0zj2syzc2m")) | |
117 | ("xz" | |
118 | ,(base32 "033rhpk6zrpxpd6ffjyg5y2zwq9x9cnq0zljb7k8jlncbalsayq5"))) | |
836a85da LC |
119 | ("mips64el-linux" |
120 | ("bash" | |
121 | ,(base32 "1aw046dhda240k9pb9iaj5aqkm23gkvxa9j82n4k7fk87nbrixw6")) | |
122 | ("mkdir" | |
123 | ,(base32 "0c9j6qgyw84zxbry3ypifzll13gy8ax71w40kdk1h11jbgla3f5k")) | |
124 | ("tar" | |
125 | ,(base32 "06gmqdjq3rl8lr47b9fyx4ifnm5x56ymc8lyryp1ax1j2s4y5jb4")) | |
126 | ("xz" | |
8a1118a9 CM |
127 | ,(base32 "09j1d69qr0hhhx4k4ih8wp00dfc9y4rp01hfg3vc15yxd0jxabh5"))) |
128 | ("powerpc64le-linux" | |
129 | ("bash" | |
130 | ,(base32 "1kiw7n6mkdy2x9in97646nb7aiayxr090ws1hbrlazah3fjqi6nj")) | |
131 | ("mkdir" | |
132 | ,(base32 "04dpvi231zcl40ig048vqqnyvmnkw1byrm1q1qqvs1f0g16yhrrk")) | |
133 | ("tar" | |
134 | ,(base32 "150c8948cz8r208g6qgn2dn4f4zs5kpgbpbg6bwag6yw42rapw2l")) | |
135 | ("xz" | |
136 | ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh"))))) | |
836a85da | 137 | |
fef77109 JN |
138 | (define %bootstrap-executable-base-urls |
139 | ;; This is where the bootstrap executables come from. | |
140 | '("https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/" | |
8a1118a9 | 141 | "https://alpha.gnu.org/gnu/guix/bootstrap/" |
fef77109 JN |
142 | "http://lilypond.org/janneke/guix/")) |
143 | ||
144 | (define (bootstrap-executable-file-name system program) | |
145 | "Return the FILE-NAME part of url where PROGRAM can be found for SYSTEM." | |
146 | (match system | |
8a1118a9 | 147 | ("powerpc64le-linux" (string-append system "/20210106/" program)) |
6741f543 | 148 | ("i586-gnu" (string-append system "/20200326/" program)) |
fef77109 JN |
149 | (_ (string-append system "/" program |
150 | "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e")))) | |
836a85da LC |
151 | |
152 | (define bootstrap-executable | |
153 | (mlambda (program system) | |
154 | "Return an origin for PROGRAM, a statically-linked bootstrap executable | |
155 | built for SYSTEM." | |
156 | (let ((system (if (string=? system "x86_64-linux") | |
157 | "i686-linux" | |
158 | system))) | |
159 | (match (assoc-ref (assoc-ref %bootstrap-executables system) | |
160 | program) | |
161 | (#f | |
162 | (raise (condition | |
163 | (&message | |
164 | (message | |
165 | (format #f (G_ "could not find bootstrap binary '~a' \ | |
166 | for system '~a'") | |
167 | program system)))))) | |
ce0be567 | 168 | ((bv) |
836a85da LC |
169 | (origin |
170 | (method url-fetch/executable) | |
fef77109 JN |
171 | (uri (map (cute string-append <> |
172 | (bootstrap-executable-file-name system program)) | |
173 | %bootstrap-executable-base-urls)) | |
836a85da | 174 | (file-name program) |
ce0be567 | 175 | (hash (content-hash bv sha256)))))))) |
836a85da LC |
176 | |
177 | \f | |
18633d4f LC |
178 | ;;; |
179 | ;;; Helper procedures. | |
180 | ;;; | |
181 | ||
7e1a74da LC |
182 | (define bootstrap-origin |
183 | (mlambdaq (source) | |
184 | "Return a variant of SOURCE, an <origin> instance, whose method uses | |
18633d4f | 185 | %BOOTSTRAP-GUILE to do its job." |
7e1a74da LC |
186 | (define (boot fetch) |
187 | (lambda* (url hash-algo hash | |
188 | #:optional name #:key system) | |
189 | (fetch url hash-algo hash name | |
190 | #:guile %bootstrap-guile | |
191 | #:system system))) | |
192 | ||
193 | (define %bootstrap-patch-inputs | |
194 | ;; Packages used when an <origin> has a non-empty 'patches' field. | |
195 | `(("tar" ,%bootstrap-coreutils&co) | |
196 | ("xz" ,%bootstrap-coreutils&co) | |
197 | ("bzip2" ,%bootstrap-coreutils&co) | |
198 | ("gzip" ,%bootstrap-coreutils&co) | |
199 | ("patch" ,%bootstrap-coreutils&co))) | |
200 | ||
201 | (let ((orig-method (origin-method source))) | |
202 | (if (or (not (null? (origin-patches source))) | |
203 | (origin-snippet source)) | |
204 | (origin (inherit source) | |
205 | (method (if (eq? orig-method url-fetch) | |
206 | (boot url-fetch) | |
207 | orig-method)) | |
208 | (patch-guile %bootstrap-guile) | |
209 | (patch-inputs %bootstrap-patch-inputs) | |
210 | ||
211 | ;; Patches can be origins as well, so process them. | |
212 | (patches (map (match-lambda | |
213 | ((? origin? patch) | |
214 | (bootstrap-origin patch)) | |
215 | (patch patch)) | |
216 | (origin-patches source)))) | |
217 | source)))) | |
18633d4f | 218 | |
2959dbe9 MW |
219 | (define* (package-from-tarball name source program-to-test description |
220 | #:key snippet) | |
dfb52abb | 221 | "Return a package that correspond to the extraction of SOURCE. |
dbabfc47 JN |
222 | PROGRAM-TO-TEST is #f or a string: the program to run after extraction of |
223 | SOURCE to check whether everything is alright. If SNIPPET is provided, it is | |
224 | evaluated after extracting SOURCE. SNIPPET should return true if successful, | |
225 | or false to signal an error." | |
18633d4f | 226 | (package |
dfb52abb | 227 | (name name) |
18633d4f | 228 | (version "0") |
18633d4f LC |
229 | (build-system trivial-build-system) |
230 | (arguments | |
231 | `(#:guile ,%bootstrap-guile | |
232 | #:modules ((guix build utils)) | |
233 | #:builder | |
668ffe1e | 234 | (begin |
18633d4f LC |
235 | (use-modules (guix build utils)) |
236 | ||
668ffe1e JN |
237 | (let ((out (assoc-ref %outputs "out")) |
238 | (tar (assoc-ref %build-inputs "tar")) | |
239 | (xz (assoc-ref %build-inputs "xz")) | |
240 | (tarball (assoc-ref %build-inputs "tarball"))) | |
241 | ||
242 | (mkdir out) | |
243 | (copy-file tarball "binaries.tar.xz") | |
244 | (invoke xz "-d" "binaries.tar.xz") | |
245 | (let ((builddir (getcwd))) | |
246 | (with-directory-excursion out | |
247 | (invoke tar "xvf" | |
248 | (string-append builddir "/binaries.tar")) | |
249 | ,@(if snippet (list snippet) '()) | |
250 | (or (not ,program-to-test) | |
251 | (invoke (string-append "bin/" ,program-to-test) | |
252 | "--version")))))))) | |
18633d4f | 253 | (inputs |
836a85da LC |
254 | `(("tar" ,(bootstrap-executable "tar" (%current-system))) |
255 | ("xz" ,(bootstrap-executable "xz" (%current-system))) | |
dfb52abb LC |
256 | ("tarball" ,(bootstrap-origin (source (%current-system)))))) |
257 | (source #f) | |
258 | (synopsis description) | |
7de1f103 | 259 | (description description) |
1fb78cb2 | 260 | (home-page #f) |
90f2801e | 261 | (license gpl3+))) |
18633d4f LC |
262 | |
263 | (define package-with-bootstrap-guile | |
6d7b26a3 | 264 | (mlambdaq (p) |
18633d4f LC |
265 | "Return a variant of P such that all its origins are fetched with |
266 | %BOOTSTRAP-GUILE." | |
267 | (define rewritten-input | |
268 | (match-lambda | |
55b2d921 LC |
269 | ((name (? origin? o)) |
270 | `(,name ,(bootstrap-origin o))) | |
271 | ((name (? package? p) sub-drvs ...) | |
272 | `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs)) | |
273 | (x x))) | |
18633d4f LC |
274 | |
275 | (package (inherit p) | |
55b2d921 LC |
276 | (source (match (package-source p) |
277 | ((? origin? o) (bootstrap-origin o)) | |
278 | (s s))) | |
279 | (inputs (map rewritten-input | |
280 | (package-inputs p))) | |
281 | (native-inputs (map rewritten-input | |
282 | (package-native-inputs p))) | |
283 | (propagated-inputs (map rewritten-input | |
284 | (package-propagated-inputs p))) | |
285 | (replacement (and=> (package-replacement p) | |
286 | package-with-bootstrap-guile))))) | |
18633d4f | 287 | |
e7133c76 LC |
288 | (define* (glibc-dynamic-linker |
289 | #:optional (system (or (and=> (%current-target-system) | |
290 | gnu-triplet->nix-system) | |
291 | (%current-system)))) | |
18633d4f | 292 | "Return the name of Glibc's dynamic linker for SYSTEM." |
c89e2107 | 293 | ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc. |
18633d4f LC |
294 | (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2") |
295 | ((string=? system "i686-linux") "/lib/ld-linux.so.2") | |
3f00ff8b | 296 | ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3") |
827d2891 | 297 | ((string=? system "mips64el-linux") "/lib/ld.so.1") |
66feaa32 MB |
298 | ((string=? system "i586-gnu") "/lib/ld.so.1") |
299 | ((string=? system "i686-gnu") "/lib/ld.so.1") | |
19c444f4 | 300 | ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1") |
4a6f099e | 301 | ((string=? system "powerpc-linux") "/lib/ld.so.1") |
8159ce19 | 302 | ((string=? system "powerpc64-linux") "/lib/ld64.so.1") |
c89e2107 | 303 | ((string=? system "powerpc64le-linux") "/lib/ld64.so.2") |
605fec78 | 304 | ((string=? system "alpha-linux") "/lib/ld-linux.so.2") |
b91004c2 | 305 | ((string=? system "s390x-linux") "/lib/ld64.so.1") |
7180dd67 | 306 | ((string=? system "riscv64-linux") "/lib/ld-linux-riscv64-lp64d.so.1") |
9d307460 LC |
307 | |
308 | ;; XXX: This one is used bare-bones, without a libc, so add a case | |
309 | ;; here just so we can keep going. | |
7f2d67c8 | 310 | ((string=? system "arm-elf") "no-ld.so") |
35a37efb | 311 | ((string=? system "arm-eabi") "no-ld.so") |
9d307460 | 312 | ((string=? system "xtensa-elf") "no-ld.so") |
a5b60e3c | 313 | ((string=? system "avr") "no-ld.so") |
6f5b1c91 | 314 | ((string=? system "propeller-elf") "no-ld.so") |
3135b95f | 315 | ((string=? system "i686-mingw") "no-ld.so") |
67dac6b8 | 316 | ((string=? system "x86_64-mingw") "no-ld.so") |
7cf06d62 | 317 | ((string=? system "vc4-elf") "no-ld.so") |
9d307460 | 318 | |
18633d4f LC |
319 | (else (error "dynamic linker name not known for this system" |
320 | system)))) | |
321 | ||
322 | \f | |
323 | ;;; | |
324 | ;;; Bootstrap packages. | |
325 | ;;; | |
326 | ||
5c93d233 LC |
327 | (define %bootstrap-base-urls |
328 | ;; This is where the initial binaries come from. | |
f32c3d4d LC |
329 | '("https://ftp.gnu.org/gnu/guix/bootstrap" |
330 | "https://alpha.gnu.org/gnu/guix/bootstrap" | |
331 | "http://ftp.gnu.org/gnu/guix/bootstrap" | |
5c93d233 | 332 | "http://alpha.gnu.org/gnu/guix/bootstrap" |
894fc4e9 | 333 | "ftp://alpha.gnu.org/gnu/guix/bootstrap" |
5c93d233 | 334 | "http://www.fdn.fr/~lcourtes/software/guix/packages" |
6fc09bd7 JN |
335 | "http://flashner.co.il/guix/bootstrap" |
336 | "http://lilypond.org/janneke/guix/")) | |
5c93d233 LC |
337 | |
338 | (define (bootstrap-guile-url-path system) | |
339 | "Return the URI for FILE." | |
340 | (string-append "/" system | |
341 | (match system | |
342 | ("aarch64-linux" | |
343 | "/20170217/guile-2.0.14.tar.xz") | |
344 | ("armhf-linux" | |
345 | "/20150101/guile-2.0.11.tar.xz") | |
6741f543 EF |
346 | ("i586-gnu" |
347 | "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz") | |
8a1118a9 CM |
348 | ("powerpc64le-linux" |
349 | "/20210106/guile-static-stripped-2.0.14-powerpc64le-linux-gnu.tar.xz") | |
5c93d233 LC |
350 | (_ |
351 | "/20131110/guile-2.0.9.tar.xz")))) | |
352 | ||
353 | (define (bootstrap-guile-hash system) | |
354 | "Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM." | |
355 | (match system | |
356 | ("x86_64-linux" | |
357 | (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")) | |
358 | ("i686-linux" | |
359 | (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")) | |
360 | ("mips64el-linux" | |
361 | (base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")) | |
362 | ("armhf-linux" | |
363 | (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5")) | |
8a1118a9 CM |
364 | ("powerpc64le-linux" |
365 | (base32 "1rnyfz5q38jyvxddj617443bnnzql4vw0mxzqpj8wz48wx4bhbq0")) | |
5c93d233 | 366 | ("aarch64-linux" |
6741f543 EF |
367 | (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r")) |
368 | ("i586-gnu" | |
369 | (base32 "0wgqpsmvg25rnqn49ap7kwd2qxccd8dr4lllzp7i3rjvgav27vac")))) | |
5c93d233 | 370 | |
3e5750af LC |
371 | (define (bootstrap-guile-origin system) |
372 | "Return an <origin> object for the Guile tarball of SYSTEM." | |
373 | (origin | |
374 | (method url-fetch) | |
375 | (uri (map (cute string-append <> (bootstrap-guile-url-path system)) | |
376 | %bootstrap-base-urls)) | |
377 | (sha256 (bootstrap-guile-hash system)))) | |
378 | ||
5c93d233 LC |
379 | (define (download-bootstrap-guile store system) |
380 | "Return a derivation that downloads the bootstrap Guile tarball for SYSTEM." | |
381 | (let* ((path (bootstrap-guile-url-path system)) | |
382 | (base (basename path)) | |
383 | (urls (map (cut string-append <> path) %bootstrap-base-urls))) | |
384 | (run-with-store store | |
385 | (url-fetch urls 'sha256 (bootstrap-guile-hash system) | |
386 | #:system system)))) | |
387 | ||
0d5a559f LC |
388 | (define* (raw-build store name inputs |
389 | #:key outputs system search-paths | |
390 | #:allow-other-keys) | |
391 | (define (->store file) | |
836a85da | 392 | (run-with-store store |
ac199505 LC |
393 | (lower-object (bootstrap-executable file system) |
394 | system))) | |
0d5a559f LC |
395 | |
396 | (let* ((tar (->store "tar")) | |
397 | (xz (->store "xz")) | |
398 | (mkdir (->store "mkdir")) | |
399 | (bash (->store "bash")) | |
5c93d233 | 400 | (guile (download-bootstrap-guile store system)) |
5d6792f0 MW |
401 | ;; The following code, run by the bootstrap guile after it is |
402 | ;; unpacked, creates a wrapper for itself to set its load path. | |
403 | ;; This replaces the previous non-portable method based on | |
404 | ;; reading the /proc/self/exe symlink. | |
405 | (make-guile-wrapper | |
406 | '(begin | |
407 | (use-modules (ice-9 match)) | |
408 | (match (command-line) | |
409 | ((_ out bash) | |
410 | (let ((bin-dir (string-append out "/bin")) | |
411 | (guile (string-append out "/bin/guile")) | |
412 | (guile-real (string-append out "/bin/.guile-real")) | |
413 | ;; We must avoid using a bare dollar sign in this code, | |
414 | ;; because it would be interpreted by the shell. | |
415 | (dollar (string (integer->char 36)))) | |
416 | (chmod bin-dir #o755) | |
417 | (rename-file guile guile-real) | |
418 | (call-with-output-file guile | |
419 | (lambda (p) | |
420 | (format p "\ | |
421 | #!~a | |
422 | export GUILE_SYSTEM_PATH=~a/share/guile/2.0 | |
423 | export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache | |
424 | exec -a \"~a0\" ~a \"~a@\"\n" | |
425 | bash out out dollar guile-real dollar))) | |
426 | (chmod guile #o555) | |
427 | (chmod bin-dir #o555)))))) | |
0d5a559f LC |
428 | (builder |
429 | (add-text-to-store store | |
430 | "build-bootstrap-guile.sh" | |
431 | (format #f " | |
432 | echo \"unpacking bootstrap Guile to '$out'...\" | |
433 | ~a $out | |
434 | cd $out | |
5c93d233 | 435 | ~a -dc < $GUILE_TARBALL | ~a xv |
0d5a559f | 436 | |
5d6792f0 MW |
437 | # Use the bootstrap guile to create its own wrapper to set the load path. |
438 | GUILE_SYSTEM_PATH=$out/share/guile/2.0 \ | |
439 | GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \ | |
440 | $out/bin/guile -c ~s $out ~a | |
441 | ||
0d5a559f LC |
442 | # Sanity check. |
443 | $out/bin/guile --version~%" | |
836a85da LC |
444 | (derivation->output-path mkdir) |
445 | (derivation->output-path xz) | |
446 | (derivation->output-path tar) | |
5d6792f0 | 447 | (format #f "~s" make-guile-wrapper) |
836a85da | 448 | (derivation->output-path bash))))) |
0d5a559f | 449 | (derivation store name |
836a85da | 450 | (derivation->output-path bash) `(,builder) |
0d5a559f | 451 | #:system system |
64de896a LC |
452 | #:inputs (map derivation-input |
453 | (list bash mkdir tar xz guile)) | |
454 | #:sources (list builder) | |
5c93d233 LC |
455 | #:env-vars `(("GUILE_TARBALL" |
456 | . ,(derivation->output-path guile)))))) | |
0d5a559f LC |
457 | |
458 | (define* (make-raw-bag name | |
d3d337d2 LC |
459 | #:key source inputs native-inputs outputs |
460 | system target) | |
0d5a559f LC |
461 | (bag |
462 | (name name) | |
d3d337d2 | 463 | (system system) |
0d5a559f LC |
464 | (build-inputs inputs) |
465 | (build raw-build))) | |
466 | ||
18633d4f LC |
467 | (define %bootstrap-guile |
468 | ;; The Guile used to run the build scripts of the initial derivations. | |
469 | ;; It is just unpacked from a tarball containing a pre-built binary. | |
470 | ;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below. | |
471 | ;; | |
472 | ;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo' | |
473 | ;; support (for /etc/services). | |
474 | (let ((raw (build-system | |
0d5a559f LC |
475 | (name 'raw) |
476 | (description "Raw build system with direct store access") | |
477 | (lower make-raw-bag)))) | |
18633d4f LC |
478 | (package |
479 | (name "guile-bootstrap") | |
480 | (version "2.0") | |
481 | (source #f) | |
482 | (build-system raw) | |
483 | (synopsis "Bootstrap Guile") | |
484 | (description "Pre-built Guile for bootstrapping purposes.") | |
485 | (home-page #f) | |
4a44e743 | 486 | (license lgpl3+)))) |
18633d4f | 487 | |
18633d4f LC |
488 | (define %bootstrap-coreutils&co |
489 | (package-from-tarball "bootstrap-binaries" | |
490 | (lambda (system) | |
491 | (origin | |
87f5d366 | 492 | (method url-fetch) |
04732c37 | 493 | (uri (map (cut string-append <> "/" system |
aa1e1947 MW |
494 | (match system |
495 | ("armhf-linux" | |
496 | "/20150101/static-binaries.tar.xz") | |
3b88f376 EF |
497 | ("aarch64-linux" |
498 | "/20170217/static-binaries.tar.xz") | |
8a1118a9 CM |
499 | ("powerpc64le-linux" |
500 | "/20210106/static-binaries-0-powerpc64le-linux-gnu.tar.xz") | |
6741f543 EF |
501 | ("i586-gnu" |
502 | "/20200326/static-binaries-0-i586-pc-gnu.tar.xz") | |
aa1e1947 MW |
503 | (_ |
504 | "/20131110/static-binaries.tar.xz"))) | |
04732c37 | 505 | %bootstrap-base-urls)) |
18633d4f LC |
506 | (sha256 |
507 | (match system | |
508 | ("x86_64-linux" | |
509 | (base32 | |
06213498 | 510 | "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4")) |
18633d4f LC |
511 | ("i686-linux" |
512 | (base32 | |
06213498 | 513 | "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak")) |
aa1e1947 MW |
514 | ("armhf-linux" |
515 | (base32 | |
516 | "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5")) | |
3b88f376 EF |
517 | ("aarch64-linux" |
518 | (base32 | |
519 | "18dfiq6c6xhsdpbidigw6480wh0vdgsxqq3xindq4lpdgqlccpfh")) | |
8a1118a9 CM |
520 | ("powerpc64le-linux" |
521 | (base32 | |
522 | "0afs2j9z2d1hjq42myz4iwjh0aqgzf59inifw87x6b6p1z9wv92v")) | |
6741f543 EF |
523 | ("i586-gnu" |
524 | (base32 | |
525 | "17kllqnf3fg79gzy9ansgi801c46yh9c23h4d923plvb0nfm1cfn")) | |
f57ff219 MW |
526 | ("mips64el-linux" |
527 | (base32 | |
06213498 | 528 | "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753")))))) |
84cbe39c MW |
529 | "fgrep" ; the program to test |
530 | "Bootstrap binaries of Coreutils, Awk, etc." | |
531 | #:snippet | |
532 | '(let ((path (list (string-append (getcwd) "/bin")))) | |
533 | (chmod "bin" #o755) | |
534 | (patch-shebang "bin/egrep" path) | |
535 | (patch-shebang "bin/fgrep" path) | |
653add37 EF |
536 | ;; Starting with grep@2.25 'egrep' and 'fgrep' are shell files |
537 | ;; that call 'grep'. If the bootstrap 'egrep' and 'fgrep' | |
538 | ;; are not binaries then patch them to execute 'grep' via its | |
539 | ;; absolute file name instead of searching for it in $PATH. | |
540 | (if (not (elf-file? "bin/egrep")) | |
541 | (substitute* '("bin/egrep" "bin/fgrep") | |
542 | (("^exec grep") (string-append (getcwd) "/bin/grep")))) | |
ad1656dc | 543 | (chmod "bin" #o555)))) |
18633d4f | 544 | |
aec77e86 JN |
545 | (define-public %bootstrap-linux-libre-headers |
546 | (package-from-tarball | |
547 | "linux-libre-headers-bootstrap" | |
548 | (lambda (system) | |
549 | (origin | |
550 | (method url-fetch) | |
da3c6a7f | 551 | (uri (map (cute string-append <> |
7f1d2dd3 | 552 | "/i686-linux/20190815/" |
da3c6a7f JN |
553 | "linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz") |
554 | %bootstrap-base-urls)) | |
aec77e86 JN |
555 | (sha256 |
556 | (base32 | |
da3c6a7f | 557 | "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s")))) |
aec77e86 JN |
558 | #f ; no program to test |
559 | "Bootstrap linux-libre-headers")) | |
560 | ||
18633d4f LC |
561 | (define %bootstrap-binutils |
562 | (package-from-tarball "binutils-bootstrap" | |
563 | (lambda (system) | |
564 | (origin | |
87f5d366 | 565 | (method url-fetch) |
04732c37 | 566 | (uri (map (cut string-append <> "/" system |
aa1e1947 MW |
567 | (match system |
568 | ("armhf-linux" | |
569 | "/20150101/binutils-2.25.tar.xz") | |
3b88f376 EF |
570 | ("aarch64-linux" |
571 | "/20170217/binutils-2.27.tar.xz") | |
8a1118a9 CM |
572 | ("powerpc64le-linux" |
573 | "/20210106/binutils-static-stripped-2.34-powerpc64le-linux-gnu.tar.xz") | |
6741f543 EF |
574 | ("i586-gnu" |
575 | "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz") | |
aa1e1947 MW |
576 | (_ |
577 | "/20131110/binutils-2.23.2.tar.xz"))) | |
04732c37 | 578 | %bootstrap-base-urls)) |
18633d4f LC |
579 | (sha256 |
580 | (match system | |
581 | ("x86_64-linux" | |
582 | (base32 | |
06213498 | 583 | "1j5yivz7zkjqfsfmxzrrrffwyayjqyfxgpi89df0w4qziqs2dg20")) |
18633d4f LC |
584 | ("i686-linux" |
585 | (base32 | |
06213498 | 586 | "14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9")) |
aa1e1947 MW |
587 | ("armhf-linux" |
588 | (base32 | |
589 | "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q")) | |
3b88f376 EF |
590 | ("aarch64-linux" |
591 | (base32 | |
592 | "111s7ilfiby033rczc71797xrmaa3qlv179wdvsaq132pd51xv3n")) | |
8a1118a9 CM |
593 | ("powerpc64le-linux" |
594 | (base32 | |
595 | "1klxy945c61134mzhqzz2gbk8w0n8jq7arwkrvz78d22ff2q0cwz")) | |
6741f543 EF |
596 | ("i586-gnu" |
597 | (base32 | |
598 | "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs")) | |
f57ff219 MW |
599 | ("mips64el-linux" |
600 | (base32 | |
06213498 | 601 | "1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7")))))) |
18633d4f LC |
602 | "ld" ; the program to test |
603 | "Bootstrap binaries of the GNU Binutils")) | |
604 | ||
605 | (define %bootstrap-glibc | |
606 | ;; The initial libc. | |
607 | (package | |
608 | (name "glibc-bootstrap") | |
609 | (version "0") | |
610 | (source #f) | |
611 | (build-system trivial-build-system) | |
612 | (arguments | |
613 | `(#:guile ,%bootstrap-guile | |
614 | #:modules ((guix build utils)) | |
615 | #:builder | |
668ffe1e | 616 | (begin |
18633d4f LC |
617 | (use-modules (guix build utils)) |
618 | ||
668ffe1e JN |
619 | (let ((out (assoc-ref %outputs "out")) |
620 | (tar (assoc-ref %build-inputs "tar")) | |
621 | (xz (assoc-ref %build-inputs "xz")) | |
622 | (tarball (assoc-ref %build-inputs "tarball"))) | |
623 | ||
624 | (mkdir out) | |
625 | (copy-file tarball "binaries.tar.xz") | |
626 | (invoke xz "-d" "binaries.tar.xz") | |
627 | (let ((builddir (getcwd))) | |
628 | (with-directory-excursion out | |
629 | (invoke tar "xvf" | |
630 | (string-append builddir | |
631 | "/binaries.tar")) | |
632 | (chmod "lib" #o755) | |
633 | ||
634 | ;; Patch libc.so so it refers to the right path. | |
635 | (substitute* "lib/libc.so" | |
636 | (("/[^ ]+/lib/(libc|ld)" _ prefix) | |
637 | (string-append out "/lib/" prefix))) | |
638 | ||
639 | #t)))))) | |
18633d4f | 640 | (inputs |
836a85da LC |
641 | `(("tar" ,(bootstrap-executable "tar" (%current-system))) |
642 | ("xz" ,(bootstrap-executable "xz" (%current-system))) | |
dd6b9a37 LC |
643 | ("tarball" ,(bootstrap-origin |
644 | (origin | |
645 | (method url-fetch) | |
646 | (uri (map (cut string-append <> "/" (%current-system) | |
aa1e1947 MW |
647 | (match (%current-system) |
648 | ("armhf-linux" | |
649 | "/20150101/glibc-2.20.tar.xz") | |
3b88f376 EF |
650 | ("aarch64-linux" |
651 | "/20170217/glibc-2.25.tar.xz") | |
8a1118a9 CM |
652 | ("powerpc64le-linux" |
653 | "/20210106/glibc-stripped-2.31-powerpc64le-linux-gnu.tar.xz") | |
6741f543 EF |
654 | ("i586-gnu" |
655 | "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz") | |
aa1e1947 MW |
656 | (_ |
657 | "/20131110/glibc-2.18.tar.xz"))) | |
dd6b9a37 LC |
658 | %bootstrap-base-urls)) |
659 | (sha256 | |
660 | (match (%current-system) | |
661 | ("x86_64-linux" | |
662 | (base32 | |
06213498 | 663 | "0jlqrgavvnplj1b083s20jj9iddr4lzfvwybw5xrcis9spbfzk7v")) |
dd6b9a37 LC |
664 | ("i686-linux" |
665 | (base32 | |
06213498 | 666 | "1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w")) |
aa1e1947 MW |
667 | ("armhf-linux" |
668 | (base32 | |
669 | "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn")) | |
3b88f376 EF |
670 | ("aarch64-linux" |
671 | (base32 | |
672 | "07nx3x8598i2924rjnlrncg6rm61c9bmcczbbcpbx0fb742nvv5c")) | |
8a1118a9 CM |
673 | ("powerpc64le-linux" |
674 | (base32 | |
675 | "1a1df6z8gkaq09md3jy94lixnh20599p58p0s856p10xwjaqr1iz")) | |
6741f543 EF |
676 | ("i586-gnu" |
677 | (base32 | |
678 | "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952")) | |
f57ff219 MW |
679 | ("mips64el-linux" |
680 | (base32 | |
06213498 | 681 | "0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg"))))))))) |
18633d4f | 682 | (synopsis "Bootstrap binaries and headers of the GNU C Library") |
7de1f103 | 683 | (description synopsis) |
1fb78cb2 LC |
684 | (home-page #f) |
685 | (license lgpl2.1+))) | |
18633d4f LC |
686 | |
687 | (define %bootstrap-gcc | |
688 | ;; The initial GCC. Uses binaries from a tarball typically built by | |
689 | ;; %GCC-BOOTSTRAP-TARBALL. | |
690 | (package | |
691 | (name "gcc-bootstrap") | |
692 | (version "0") | |
693 | (source #f) | |
694 | (build-system trivial-build-system) | |
695 | (arguments | |
21c203a5 LC |
696 | `(#:guile ,%bootstrap-guile |
697 | #:modules ((guix build utils)) | |
698 | #:builder | |
668ffe1e | 699 | (begin |
21c203a5 LC |
700 | (use-modules (guix build utils) |
701 | (ice-9 popen)) | |
18633d4f | 702 | |
668ffe1e JN |
703 | (let ((out (assoc-ref %outputs "out")) |
704 | (tar (assoc-ref %build-inputs "tar")) | |
705 | (xz (assoc-ref %build-inputs "xz")) | |
706 | (bash (assoc-ref %build-inputs "bash")) | |
707 | (libc (assoc-ref %build-inputs "libc")) | |
708 | (tarball (assoc-ref %build-inputs "tarball"))) | |
709 | ||
710 | (mkdir out) | |
711 | (copy-file tarball "binaries.tar.xz") | |
712 | (invoke xz "-d" "binaries.tar.xz") | |
713 | (let ((builddir (getcwd)) | |
714 | (bindir (string-append out "/bin"))) | |
715 | (with-directory-excursion out | |
716 | (invoke tar "xvf" | |
717 | (string-append builddir "/binaries.tar"))) | |
718 | ||
719 | (with-directory-excursion bindir | |
720 | (chmod "." #o755) | |
721 | (rename-file "gcc" ".gcc-wrapped") | |
722 | (call-with-output-file "gcc" | |
723 | (lambda (p) | |
724 | (format p "#!~a | |
18633d4f LC |
725 | exec ~a/bin/.gcc-wrapped -B~a/lib \ |
726 | -Wl,-rpath -Wl,~a/lib \ | |
727 | -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" | |
668ffe1e JN |
728 | bash |
729 | out libc libc libc | |
730 | ,(glibc-dynamic-linker)))) | |
18633d4f | 731 | |
668ffe1e JN |
732 | (chmod "gcc" #o555) |
733 | #t)))))) | |
18633d4f | 734 | (inputs |
836a85da LC |
735 | `(("tar" ,(bootstrap-executable "tar" (%current-system))) |
736 | ("xz" ,(bootstrap-executable "xz" (%current-system))) | |
737 | ("bash" ,(bootstrap-executable "bash" (%current-system))) | |
18633d4f | 738 | ("libc" ,%bootstrap-glibc) |
dd6b9a37 LC |
739 | ("tarball" ,(bootstrap-origin |
740 | (origin | |
668ffe1e JN |
741 | (method url-fetch) |
742 | (uri (map (cut string-append <> "/" (%current-system) | |
743 | (match (%current-system) | |
744 | ("armhf-linux" | |
745 | "/20150101/gcc-4.8.4.tar.xz") | |
746 | ("aarch64-linux" | |
747 | "/20170217/gcc-5.4.0.tar.xz") | |
8a1118a9 CM |
748 | ("powerpc64le-linux" |
749 | "/20210106/gcc-stripped-5.5.0-powerpc64le-linux-gnu.tar.xz") | |
6741f543 EF |
750 | ("i586-gnu" |
751 | "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz") | |
668ffe1e JN |
752 | (_ |
753 | "/20131110/gcc-4.8.2.tar.xz"))) | |
754 | %bootstrap-base-urls)) | |
755 | (sha256 | |
756 | (match (%current-system) | |
757 | ("x86_64-linux" | |
758 | (base32 | |
759 | "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls")) | |
760 | ("i686-linux" | |
761 | (base32 | |
762 | "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw")) | |
763 | ("armhf-linux" | |
764 | (base32 | |
765 | "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v")) | |
766 | ("aarch64-linux" | |
767 | (base32 | |
768 | "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1")) | |
8a1118a9 CM |
769 | ("powerpc64le-linux" |
770 | (base32 | |
771 | "151kjsai25vz2s667bgzpisx8f281fpl3n9pxz2yrp9jlnadz3m1")) | |
6741f543 EF |
772 | ("i586-gnu" |
773 | (base32 | |
774 | "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5")) | |
668ffe1e JN |
775 | ("mips64el-linux" |
776 | (base32 | |
777 | "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks"))))))))) | |
a18eda27 LC |
778 | (native-search-paths |
779 | (list (search-path-specification | |
780 | (variable "CPATH") | |
af070955 | 781 | (files '("include"))) |
a18eda27 LC |
782 | (search-path-specification |
783 | (variable "LIBRARY_PATH") | |
af070955 | 784 | (files '("lib" "lib64"))))) |
18633d4f | 785 | (synopsis "Bootstrap binaries of the GNU Compiler Collection") |
7de1f103 | 786 | (description synopsis) |
1fb78cb2 LC |
787 | (home-page #f) |
788 | (license gpl3+))) | |
18633d4f | 789 | |
b00a95be JN |
790 | (define %bootstrap-mescc-tools |
791 | ;; The initial MesCC tools. Uses binaries from a tarball typically built by | |
792 | ;; %MESCC-TOOLS-BOOTSTRAP-TARBALL. | |
793 | (package | |
794 | (name "bootstrap-mescc-tools") | |
795 | (version "0.5.2") | |
796 | (source #f) | |
797 | (build-system trivial-build-system) | |
798 | (arguments | |
799 | `(#:guile ,%bootstrap-guile | |
800 | #:modules ((guix build utils)) | |
801 | #:builder | |
802 | (begin | |
803 | (use-modules (guix build utils) | |
804 | (ice-9 popen)) | |
805 | (let ((out (assoc-ref %outputs "out")) | |
806 | (tar (assoc-ref %build-inputs "tar")) | |
807 | (xz (assoc-ref %build-inputs "xz")) | |
808 | (tarball (assoc-ref %build-inputs "tarball"))) | |
809 | ||
810 | (mkdir out) | |
811 | (copy-file tarball "binaries.tar.xz") | |
812 | (invoke xz "-d" "binaries.tar.xz") | |
813 | (let ((builddir (getcwd)) | |
814 | (bindir (string-append out "/bin"))) | |
815 | (with-directory-excursion out | |
816 | (invoke tar "xvf" | |
817 | (string-append builddir "/binaries.tar")))))))) | |
818 | (inputs | |
836a85da LC |
819 | `(("tar" ,(bootstrap-executable "tar" (%current-system))) |
820 | ("xz" ,(bootstrap-executable "xz" (%current-system))) | |
da3c6a7f JN |
821 | ("tarball" |
822 | ,(bootstrap-origin | |
823 | (origin | |
824 | (method url-fetch) | |
825 | (uri (map | |
826 | (cute string-append <> | |
7f1d2dd3 MW |
827 | "/i686-linux/20190815/" |
828 | "mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz") | |
da3c6a7f JN |
829 | %bootstrap-base-urls)) |
830 | (sha256 | |
831 | (base32 | |
7f1d2dd3 | 832 | "0c3kklgghzh4q2dbpl6asb74cimp7hp6jscdwqwmzxbapgcl6582"))))))) |
b00a95be JN |
833 | (synopsis "Bootstrap binaries of MesCC Tools") |
834 | (description synopsis) | |
835 | (home-page #f) | |
0b07f227 | 836 | (supported-systems '("i686-linux" "x86_64-linux")) |
b00a95be JN |
837 | (license gpl3+))) |
838 | ||
5f02c9b7 JN |
839 | (define %bootstrap-mes |
840 | ;; The initial Mes. Uses binaries from a tarball typically built by | |
841 | ;; %MES-BOOTSTRAP-TARBALL. | |
842 | (package | |
843 | (name "bootstrap-mes") | |
844 | (version "0") | |
845 | (source #f) | |
846 | (build-system trivial-build-system) | |
847 | (arguments | |
848 | `(#:guile ,%bootstrap-guile | |
849 | #:modules ((guix build utils)) | |
850 | #:builder | |
851 | (begin | |
852 | (use-modules (guix build utils) | |
853 | (ice-9 popen)) | |
854 | (let ((out (assoc-ref %outputs "out")) | |
855 | (tar (assoc-ref %build-inputs "tar")) | |
856 | (xz (assoc-ref %build-inputs "xz")) | |
857 | (tarball (assoc-ref %build-inputs "tarball"))) | |
858 | ||
859 | (mkdir out) | |
860 | (copy-file tarball "binaries.tar.xz") | |
861 | (invoke xz "-d" "binaries.tar.xz") | |
862 | (let ((builddir (getcwd)) | |
863 | (bindir (string-append out "/bin"))) | |
864 | (with-directory-excursion out | |
865 | (invoke tar "xvf" | |
866 | (string-append builddir "/binaries.tar")))))))) | |
867 | (inputs | |
836a85da LC |
868 | `(("tar" ,(bootstrap-executable "tar" (%current-system))) |
869 | ("xz" ,(bootstrap-executable "xz" (%current-system))) | |
da3c6a7f JN |
870 | ("tarball" |
871 | ,(bootstrap-origin | |
872 | (origin | |
873 | (method url-fetch) | |
c89bbccc JN |
874 | (uri (map |
875 | (cute string-append <> | |
7f1d2dd3 | 876 | "/i686-linux/20190815/" |
c89bbccc JN |
877 | "mes-minimal-stripped-0.19-i686-linux.tar.xz") |
878 | %bootstrap-base-urls)) | |
da3c6a7f | 879 | (sha256 |
0b07f227 | 880 | (base32 |
7f1d2dd3 | 881 | "1q4xjpx6nbn44kxnilpgl12bhpmwy2bblzwszc2ci7xkf400jcpv"))))))) |
0b07f227 | 882 | (supported-systems '("i686-linux" "x86_64-linux")) |
5f02c9b7 JN |
883 | (synopsis "Bootstrap binaries of Mes") |
884 | (description synopsis) | |
885 | (home-page #f) | |
886 | (license gpl3+))) | |
887 | ||
a2b2070b | 888 | (define (%bootstrap-inputs) |
18633d4f LC |
889 | ;; The initial, pre-built inputs. From now on, we can start building our |
890 | ;; own packages. | |
d77860db JN |
891 | (match (%current-system) |
892 | ((or "i686-linux" "x86_64-linux") | |
893 | `(("linux-libre-headers" ,%bootstrap-linux-libre-headers) | |
894 | ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools) | |
895 | ("mes" ,%bootstrap-mes))) | |
896 | (_ | |
897 | `(("libc" ,%bootstrap-glibc) | |
898 | ("gcc" ,%bootstrap-gcc) | |
899 | ("binutils" ,%bootstrap-binutils) | |
900 | ("coreutils&co" ,%bootstrap-coreutils&co) | |
901 | ;; In gnu-build-system.scm, we rely on the availability of Bash. | |
902 | ("bash" ,%bootstrap-coreutils&co))))) | |
18633d4f | 903 | |
03d76577 LC |
904 | (define %bootstrap-inputs-for-tests |
905 | ;; These are bootstrap inputs that are cheap to produce (no compilation | |
906 | ;; needed) and that are meant to be used for testing. (These are those we | |
907 | ;; used before the Mes-based reduced bootstrap.) | |
908 | `(("libc" ,%bootstrap-glibc) | |
909 | ("gcc" ,%bootstrap-gcc) | |
910 | ("binutils" ,%bootstrap-binutils) | |
911 | ("coreutils&co" ,%bootstrap-coreutils&co) | |
912 | ("bash" ,%bootstrap-coreutils&co))) | |
913 | ||
18633d4f | 914 | ;;; bootstrap.scm ends here |