Commit | Line | Data |
---|---|---|
827d2891 | 1 | ;;; GNU Guix --- Functional package management for GNU |
be99170d | 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> |
3f00ff8b | 3 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
efc4eb14 | 4 | ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> |
2d558e31 | 5 | ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> |
827d2891 LC |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu packages cross-base) | |
827d2891 | 23 | #:use-module (gnu packages) |
f594028a | 24 | #:use-module (gnu packages gcc) |
827d2891 LC |
25 | #:use-module (gnu packages base) |
26 | #:use-module (gnu packages linux) | |
2d558e31 | 27 | #:use-module (gnu packages hurd) |
cba36e64 | 28 | #:use-module (gnu packages mingw) |
827d2891 LC |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
31 | #:use-module (guix utils) | |
32 | #:use-module (guix build-system gnu) | |
33 | #:use-module (guix build-system trivial) | |
34 | #:use-module (srfi srfi-1) | |
35 | #:use-module (srfi srfi-26) | |
264218a4 | 36 | #:use-module (ice-9 match) |
2d558e31 | 37 | #:use-module (ice-9 regex) |
264218a4 LC |
38 | #:export (cross-binutils |
39 | cross-libc | |
cba36e64 JN |
40 | cross-gcc |
41 | cross-newlib?)) | |
827d2891 | 42 | |
be99170d | 43 | (define-syntax %xgcc |
c92f1c0a LC |
44 | ;; GCC package used as the basis for cross-compilation. It doesn't have to |
45 | ;; be 'gcc' and can be a specific variant such as 'gcc-4.8'. | |
be99170d LC |
46 | ;; |
47 | ;; Note: This is a macro so that we do not refer to 'gcc' from the top | |
48 | ;; level, which would lead to circular-dependency issues. | |
49 | (identifier-syntax gcc)) | |
c92f1c0a | 50 | |
cba36e64 JN |
51 | (define %gcc-include-paths |
52 | ;; Environment variables for header search paths. | |
53 | ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'. | |
54 | '("C_INCLUDE_PATH" | |
55 | "CPLUS_INCLUDE_PATH" | |
56 | "OBJC_INCLUDE_PATH" | |
57 | "OBJCPLUS_INCLUDE_PATH")) | |
58 | ||
59 | (define %gcc-cross-include-paths | |
60 | ;; Search path for target headers when cross-compiling. | |
61 | (map (cut string-append "CROSS_" <>) %gcc-include-paths)) | |
62 | ||
827d2891 LC |
63 | (define (cross p target) |
64 | (package (inherit p) | |
827d2891 LC |
65 | (name (string-append (package-name p) "-cross-" target)) |
66 | (arguments | |
67 | (substitute-keyword-arguments (package-arguments p) | |
68 | ((#:configure-flags flags) | |
69 | `(cons ,(string-append "--target=" target) | |
70 | ,flags)))))) | |
71 | ||
1306b0b0 LC |
72 | (define (package-with-patch original patch) |
73 | "Return package ORIGINAL with PATCH applied." | |
74 | (package (inherit original) | |
75 | (source (origin (inherit (package-source original)) | |
76 | (patches (list patch)))))) | |
77 | ||
47e74d6e LC |
78 | (define (cross-binutils target) |
79 | "Return a cross-Binutils for TARGET." | |
80 | (let ((binutils (package (inherit binutils) | |
81 | (arguments | |
82 | (substitute-keyword-arguments (package-arguments | |
83 | binutils) | |
84 | ((#:configure-flags flags) | |
85 | ;; Build with `--with-sysroot' so that ld honors | |
86 | ;; DT_RUNPATH entries when searching for a needed | |
87 | ;; library. This works because as a side effect | |
88 | ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells | |
89 | ;; elf32.em to use DT_RUNPATH in its search list. | |
c8fa51f2 LC |
90 | ;; See <http://sourceware.org/ml/binutils/2013-05/msg00312.html>. |
91 | ;; | |
92 | ;; In theory choosing / as the sysroot could lead ld | |
93 | ;; to pick up native libs instead of target ones. In | |
94 | ;; practice the RUNPATH of target libs only refers to | |
95 | ;; target libs, not native libs, so this is safe. | |
96 | `(cons "--with-sysroot=/" ,flags))))))) | |
1306b0b0 LC |
97 | |
98 | ;; For Xtensa, apply Qualcomm's patch. | |
99 | (cross (if (string-prefix? "xtensa-" target) | |
100 | (package-with-patch binutils | |
101 | (search-patch | |
102 | "ath9k-htc-firmware-binutils.patch")) | |
103 | binutils) | |
104 | target))) | |
827d2891 | 105 | |
7b3318e3 RW |
106 | (define (cross-gcc-arguments target xgcc libc) |
107 | "Return build system arguments for a cross-gcc for TARGET, using XGCC as the | |
108 | base compiler and using LIBC (which may be either a libc package or #f.)" | |
b4469d8c LC |
109 | ;; Set the current target system so that 'glibc-dynamic-linker' returns the |
110 | ;; right name. | |
111 | (parameterize ((%current-target-system target)) | |
2a1552c6 LC |
112 | ;; Disable stripping as this can break binaries, with object files of |
113 | ;; libgcc.a showing up as having an unknown architecture. See | |
114 | ;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html> | |
115 | ;; for instance. | |
116 | (let ((args `(#:strip-binaries? #f | |
7b3318e3 | 117 | ,@(package-arguments xgcc)))) |
2a1552c6 LC |
118 | (substitute-keyword-arguments args |
119 | ((#:configure-flags flags) | |
120 | `(append (list ,(string-append "--target=" target) | |
121 | ,@(if libc | |
8fd857f5 | 122 | `( ;; Disable libcilkrts because it is not |
3009a9e4 | 123 | ;; ported to GNU/Hurd. |
8fd857f5 | 124 | "--disable-libcilkrts") |
2a1552c6 LC |
125 | `( ;; Disable features not needed at this stage. |
126 | "--disable-shared" "--enable-static" | |
ca7ef4d4 | 127 | "--enable-languages=c,c++" |
cdb4b4b3 | 128 | |
ca7ef4d4 RW |
129 | ;; libstdc++ cannot be built at this stage |
130 | ;; ("Link tests are not allowed after | |
131 | ;; GCC_NO_EXECUTABLES."). | |
132 | "--disable-libstdc++-v3" | |
cdb4b4b3 | 133 | |
2a1552c6 LC |
134 | "--disable-threads" ;libgcc, would need libc |
135 | "--disable-libatomic" | |
136 | "--disable-libmudflap" | |
137 | "--disable-libgomp" | |
138 | "--disable-libssp" | |
139 | "--disable-libquadmath" | |
140 | "--disable-decimal-float" ;would need libc | |
8fd857f5 | 141 | "--disable-libcilkrts" |
9a745d76 MR |
142 | |
143 | ;; When target is any OS other than 'none' these | |
144 | ;; libraries will fail if there is no libc | |
145 | ;; present. See | |
146 | ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg01311.html> | |
147 | "--disable-libitm" | |
148 | "--disable-libvtv" | |
149 | "--disable-libsanitizer" | |
cba36e64 JN |
150 | )) |
151 | ||
152 | ;; For a newlib (non-glibc) target | |
153 | ,@(if (cross-newlib? target) | |
154 | '("--with-newlib") | |
155 | '())) | |
cdb4b4b3 | 156 | |
2a1552c6 LC |
157 | ,(if libc |
158 | flags | |
159 | `(remove (cut string-match "--enable-languages.*" <>) | |
160 | ,flags)))) | |
161 | ((#:make-flags flags) | |
162 | (if libc | |
163 | `(let ((libc (assoc-ref %build-inputs "libc"))) | |
164 | ;; FLAGS_FOR_TARGET are needed for the target libraries to receive | |
165 | ;; the -Bxxx for the startfiles. | |
166 | (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib") | |
167 | ,flags)) | |
168 | flags)) | |
169 | ((#:phases phases) | |
3593e5d5 | 170 | `(cross-gcc-build-phases ,target ,phases)))))) |
cdb4b4b3 | 171 | |
1306b0b0 LC |
172 | (define (cross-gcc-patches target) |
173 | "Return GCC patches needed for TARGET." | |
174 | (cond ((string-prefix? "xtensa-" target) | |
175 | ;; Patch by Qualcomm needed to build the ath9k-htc firmware. | |
fc1adab1 | 176 | (search-patches "ath9k-htc-firmware-gcc.patch")) |
cba36e64 JN |
177 | ((target-mingw? target) |
178 | (search-patches "gcc-4.9.3-mingw-gthr-default.patch")) | |
1306b0b0 LC |
179 | (else '()))) |
180 | ||
cba36e64 JN |
181 | (define (cross-gcc-snippet target) |
182 | "Return GCC snippet needed for TARGET." | |
183 | (cond ((target-mingw? target) | |
184 | '(copy-recursively "libstdc++-v3/config/os/mingw32-w64" | |
185 | "libstdc++-v3/config/os/newlib")) | |
186 | (else #f))) | |
187 | ||
827d2891 | 188 | (define* (cross-gcc target |
7b3318e3 RW |
189 | #:key |
190 | (xgcc %xgcc) | |
191 | (xbinutils (cross-binutils target)) | |
192 | (libc #f)) | |
827d2891 | 193 | "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use |
7b3318e3 RW |
194 | XGCC as the base compiler. Use XBINUTILS as the associated cross-Binutils. |
195 | If LIBC is false, then build a GCC that does not target a libc; otherwise, | |
196 | target that libc." | |
197 | (package (inherit xgcc) | |
827d2891 LC |
198 | (name (string-append "gcc-cross-" |
199 | (if libc "" "sans-libc-") | |
200 | target)) | |
7b3318e3 | 201 | (source (origin (inherit (package-source xgcc)) |
01eafd38 | 202 | (patches |
1421afa9 | 203 | (append |
7b3318e3 | 204 | (origin-patches (package-source xgcc)) |
1421afa9 | 205 | (cons (search-patch "gcc-cross-environment-variables.patch") |
cba36e64 JN |
206 | (cross-gcc-patches target)))) |
207 | (modules '((guix build utils))) | |
208 | (snippet | |
209 | (cross-gcc-snippet target)))) | |
a49c57a7 LC |
210 | |
211 | ;; For simplicity, use a single output. Otherwise libgcc_s & co. are not | |
212 | ;; found by default, etc. | |
213 | (outputs '("out")) | |
214 | ||
827d2891 LC |
215 | (arguments |
216 | `(#:implicit-inputs? #f | |
3593e5d5 LC |
217 | #:imported-modules ((gnu build cross-toolchain) |
218 | ,@%gnu-build-system-modules) | |
827d2891 LC |
219 | #:modules ((guix build gnu-build-system) |
220 | (guix build utils) | |
3593e5d5 | 221 | (gnu build cross-toolchain) |
827d2891 | 222 | (srfi srfi-1) |
3593e5d5 LC |
223 | (srfi srfi-26) |
224 | (ice-9 regex)) | |
827d2891 | 225 | |
7b3318e3 | 226 | ,@(cross-gcc-arguments target xgcc libc))) |
0de71c23 LC |
227 | |
228 | (native-inputs | |
4a740d0f LC |
229 | `(("ld-wrapper-cross" ,(make-ld-wrapper |
230 | (string-append "ld-wrapper-" target) | |
5bde4503 | 231 | #:target (const target) |
4a740d0f LC |
232 | #:binutils xbinutils)) |
233 | ("binutils-cross" ,xbinutils) | |
827d2891 LC |
234 | |
235 | ;; Call it differently so that the builder can check whether the "libc" | |
236 | ;; input is #f. | |
fb77c614 | 237 | ("libc-native" ,@(assoc-ref (%final-inputs) "libc")) |
827d2891 LC |
238 | |
239 | ;; Remaining inputs. | |
7b3318e3 | 240 | ,@(let ((inputs (append (package-inputs xgcc) |
fb77c614 | 241 | (alist-delete "libc" (%final-inputs))))) |
cba36e64 JN |
242 | (cond |
243 | ((target-mingw? target) | |
244 | (if libc | |
245 | `(("libc" ,mingw-w64) | |
246 | ,@inputs) | |
247 | `(("mingw-source" ,(package-source mingw-w64)) | |
248 | ,@inputs))) | |
249 | (libc | |
250 | `(("libc" ,libc) | |
251 | ("xkernel-headers" ;the target headers | |
252 | ,@(assoc-ref (package-propagated-inputs libc) | |
253 | "kernel-headers")) | |
254 | ,@inputs)) | |
255 | (else inputs))))) | |
17bb886f | 256 | |
0de71c23 LC |
257 | (inputs '()) |
258 | ||
17bb886f | 259 | ;; Only search target inputs, not host inputs. |
cba36e64 JN |
260 | (search-paths (cons (search-path-specification |
261 | (variable "CROSS_LIBRARY_PATH") | |
262 | (files '("lib" "lib64"))) | |
263 | (map (lambda (variable) | |
264 | (search-path-specification | |
265 | (variable variable) | |
266 | (files '("include")))) | |
267 | %gcc-cross-include-paths))) | |
17bb886f | 268 | (native-search-paths '()))) |
827d2891 | 269 | |
2d558e31 MR |
270 | (define* (cross-kernel-headers target |
271 | #:optional | |
272 | (xgcc (cross-gcc target)) | |
273 | (xbinutils (cross-binutils target))) | |
274 | "Return headers depending on TARGET." | |
275 | ||
827d2891 LC |
276 | (define xlinux-headers |
277 | (package (inherit linux-libre-headers) | |
278 | (name (string-append (package-name linux-libre-headers) | |
279 | "-cross-" target)) | |
280 | (arguments | |
0d5a559f LC |
281 | (substitute-keyword-arguments |
282 | `(#:implicit-cross-inputs? #f | |
283 | ,@(package-arguments linux-libre-headers)) | |
827d2891 LC |
284 | ((#:phases phases) |
285 | `(alist-replace | |
286 | 'build | |
287 | (lambda _ | |
288 | (setenv "ARCH" ,(system->linux-architecture target)) | |
289 | (format #t "`ARCH' set to `~a' (cross compiling)~%" (getenv "ARCH")) | |
290 | ||
440a3143 | 291 | (and (zero? (system* "make" ,(system->defconfig target))) |
827d2891 LC |
292 | (zero? (system* "make" "mrproper" "headers_check")))) |
293 | ,phases)))) | |
0de71c23 LC |
294 | (native-inputs `(("cross-gcc" ,xgcc) |
295 | ("cross-binutils" ,xbinutils) | |
296 | ,@(package-native-inputs linux-libre-headers))))) | |
827d2891 | 297 | |
2d558e31 MR |
298 | (define xgnumach-headers |
299 | (package (inherit gnumach-headers) | |
300 | (name (string-append (package-name gnumach-headers) | |
301 | "-cross-" target)) | |
302 | ||
303 | (native-inputs `(("cross-gcc" ,xgcc) | |
304 | ("cross-binutils" ,xbinutils) | |
305 | ,@(package-native-inputs gnumach-headers))))) | |
306 | ||
307 | (define xmig | |
308 | (package (inherit mig) | |
309 | (name (string-append "mig-cross")) | |
310 | (arguments | |
311 | `(#:modules ((guix build gnu-build-system) | |
312 | (guix build utils) | |
313 | (srfi srfi-26)) | |
314 | #:phases (alist-cons-before | |
315 | 'configure 'set-cross-headers-path | |
316 | (lambda* (#:key inputs #:allow-other-keys) | |
317 | (let* ((mach (assoc-ref inputs "cross-gnumach-headers")) | |
318 | (cpath (string-append mach "/include"))) | |
319 | (for-each (cut setenv <> cpath) | |
3009a9e4 | 320 | ',%gcc-cross-include-paths))) |
2d558e31 MR |
321 | %standard-phases) |
322 | #:configure-flags (list ,(string-append "--target=" target)) | |
323 | ,@(package-arguments mig))) | |
324 | ||
325 | (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers))) | |
326 | (native-inputs `(("cross-gcc" ,xgcc) | |
327 | ("cross-binutils" ,xbinutils) | |
328 | ,@(package-native-inputs mig))))) | |
329 | ||
330 | (define xhurd-headers | |
331 | (package (inherit hurd-headers) | |
332 | (name (string-append (package-name hurd-headers) | |
333 | "-cross-" target)) | |
334 | ||
2d558e31 MR |
335 | (native-inputs `(("cross-gcc" ,xgcc) |
336 | ("cross-binutils" ,xbinutils) | |
337 | ("cross-mig" ,xmig) | |
338 | ,@(alist-delete "mig"(package-native-inputs hurd-headers)))))) | |
339 | ||
340 | (define xglibc/hurd-headers | |
341 | (package (inherit glibc/hurd-headers) | |
342 | (name (string-append (package-name glibc/hurd-headers) | |
343 | "-cross-" target)) | |
344 | ||
345 | (arguments | |
346 | (substitute-keyword-arguments | |
347 | `(#:modules ((guix build gnu-build-system) | |
348 | (guix build utils) | |
349 | (srfi srfi-26)) | |
350 | ,@(package-arguments glibc/hurd-headers)) | |
351 | ((#:phases phases) | |
352 | `(alist-cons-before | |
353 | 'pre-configure 'set-cross-headers-path | |
354 | (lambda* (#:key inputs #:allow-other-keys) | |
355 | (let* ((mach (assoc-ref inputs "gnumach-headers")) | |
356 | (hurd (assoc-ref inputs "hurd-headers")) | |
357 | (cpath (string-append mach "/include:" | |
358 | hurd "/include"))) | |
359 | (for-each (cut setenv <> cpath) | |
3009a9e4 | 360 | ',%gcc-cross-include-paths))) |
2d558e31 MR |
361 | ,phases)))) |
362 | ||
363 | (propagated-inputs `(("gnumach-headers" ,xgnumach-headers) | |
364 | ("hurd-headers" ,xhurd-headers))) | |
365 | ||
366 | (native-inputs `(("cross-gcc" ,xgcc) | |
367 | ("cross-binutils" ,xbinutils) | |
368 | ("cross-mig" ,xmig) | |
369 | ,@(alist-delete "mig"(package-native-inputs glibc/hurd-headers)))))) | |
370 | ||
371 | (define xhurd-minimal | |
372 | (package (inherit hurd-minimal) | |
373 | (name (string-append (package-name hurd-minimal) | |
374 | "-cross-" target)) | |
375 | (arguments | |
376 | (substitute-keyword-arguments | |
377 | `(#:modules ((guix build gnu-build-system) | |
378 | (guix build utils) | |
379 | (srfi srfi-26)) | |
380 | ,@(package-arguments hurd-minimal)) | |
381 | ((#:phases phases) | |
382 | `(alist-cons-before | |
383 | 'configure 'set-cross-headers-path | |
384 | (lambda* (#:key inputs #:allow-other-keys) | |
385 | (let* ((glibc-headers (assoc-ref inputs "cross-glibc-hurd-headers")) | |
386 | (cpath (string-append glibc-headers "/include"))) | |
387 | (for-each (cut setenv <> cpath) | |
3009a9e4 | 388 | ',%gcc-cross-include-paths))) |
2d558e31 MR |
389 | ,phases)))) |
390 | ||
391 | (inputs `(("cross-glibc-hurd-headers" ,xglibc/hurd-headers))) | |
392 | ||
393 | (native-inputs `(("cross-gcc" ,xgcc) | |
394 | ("cross-binutils" ,xbinutils) | |
395 | ("cross-mig" ,xmig) | |
396 | ,@(alist-delete "mig"(package-native-inputs hurd-minimal)))))) | |
397 | ||
398 | (define xhurd-core-headers | |
399 | (package (inherit hurd-core-headers) | |
400 | (name (string-append (package-name hurd-core-headers) | |
401 | "-cross-" target)) | |
402 | ||
403 | (inputs `(("gnumach-headers" ,xgnumach-headers) | |
404 | ("hurd-headers" ,xhurd-headers) | |
405 | ("hurd-minimal" ,xhurd-minimal))) | |
406 | ||
407 | (native-inputs `(("cross-gcc" ,xgcc) | |
408 | ("cross-binutils" ,xbinutils) | |
409 | ("cross-mig" ,xmig) | |
410 | ,@(package-native-inputs hurd-core-headers))))) | |
411 | ||
412 | (match target | |
413 | ((or "i586-pc-gnu" "i586-gnu") xhurd-core-headers) | |
414 | (_ xlinux-headers))) | |
415 | ||
416 | (define* (cross-libc target | |
417 | #:optional | |
418 | (xgcc (cross-gcc target)) | |
419 | (xbinutils (cross-binutils target)) | |
420 | (xheaders (cross-kernel-headers target))) | |
421 | "Return a libc cross-built for TARGET, a GNU triplet. Use XGCC and | |
422 | XBINUTILS and the cross tool chain." | |
423 | (define (cross-libc-for-target target) | |
424 | "Return libc depending on TARGET." | |
425 | (match target | |
426 | ((or "i586-pc-gnu" "i586-gnu") glibc/hurd) | |
427 | (_ glibc/linux))) | |
428 | ||
d76181a7 | 429 | ;; Use (cross-libc-for-target ...) to determine the correct libc to use. |
0158ca7f | 430 | |
cba36e64 JN |
431 | (if (cross-newlib? target) |
432 | (native-libc target) | |
433 | (let ((libc (cross-libc-for-target target))) | |
434 | (package (inherit libc) | |
435 | (name (string-append "glibc-cross-" target)) | |
436 | (arguments | |
437 | (substitute-keyword-arguments | |
438 | `(;; Disable stripping (see above.) | |
439 | #:strip-binaries? #f | |
440 | ||
441 | ;; This package is used as a target input, but it should not have | |
442 | ;; the usual cross-compilation inputs since that would include | |
443 | ;; itself. | |
444 | #:implicit-cross-inputs? #f | |
445 | ||
446 | ;; We need SRFI 26. | |
447 | #:modules ((guix build gnu-build-system) | |
448 | (guix build utils) | |
449 | (srfi srfi-26)) | |
450 | ||
451 | ,@(package-arguments libc)) | |
452 | ((#:configure-flags flags) | |
453 | `(cons ,(string-append "--host=" target) | |
454 | ,flags)) | |
455 | ((#:phases phases) | |
456 | `(alist-cons-before | |
457 | 'configure 'set-cross-kernel-headers-path | |
458 | (lambda* (#:key inputs #:allow-other-keys) | |
459 | (let* ((kernel (assoc-ref inputs "kernel-headers")) | |
460 | (cpath (string-append kernel "/include"))) | |
461 | (for-each (cut setenv <> cpath) | |
3009a9e4 | 462 | ',%gcc-cross-include-paths) |
cba36e64 JN |
463 | (setenv "CROSS_LIBRARY_PATH" |
464 | (string-append kernel "/lib")) ;for Hurd's libihash | |
465 | #t)) | |
466 | ,phases)))) | |
467 | ||
468 | ;; Shadow the native "kernel-headers" because glibc's recipe expects the | |
469 | ;; "kernel-headers" input to point to the right thing. | |
470 | (propagated-inputs `(("kernel-headers" ,xheaders))) | |
471 | ||
472 | ;; FIXME: 'static-bash' should really be an input, not a native input, but | |
473 | ;; to do that will require building an intermediate cross libc. | |
474 | (inputs '()) | |
475 | ||
476 | (native-inputs `(("cross-gcc" ,xgcc) | |
477 | ("cross-binutils" ,xbinutils) | |
62596a15 | 478 | ,@(if (hurd-triplet? target) |
cba36e64 JN |
479 | `(("cross-mig" |
480 | ,@(assoc-ref (package-native-inputs xheaders) | |
481 | "cross-mig"))) | |
482 | '()) | |
483 | ,@(package-inputs libc) ;FIXME: static-bash | |
484 | ,@(package-native-inputs libc))))))) | |
485 | ||
486 | (define (native-libc target) | |
487 | (if (target-mingw? target) | |
488 | mingw-w64 | |
489 | glibc)) | |
490 | ||
491 | (define (cross-newlib? target) | |
492 | (not (eq? (native-libc target) glibc))) | |
827d2891 LC |
493 | |
494 | \f | |
bd2e1a8c LC |
495 | ;;; Concrete cross tool chains are instantiated like this: |
496 | ;; | |
497 | ;; (define-public xgcc-armhf | |
498 | ;; (let ((triplet "arm-linux-gnueabihf")) | |
827d2891 | 499 | ;; (cross-gcc triplet |
e0775d2a MW |
500 | ;; #:xbinutils (cross-binutils triplet) |
501 | ;; #:libc (cross-libc triplet)))) | |
bd2e1a8c LC |
502 | ;; |
503 | ;;; We don't do that here because we'd be referring to bindings from (gnu | |
504 | ;;; packages gcc) from the top level, which doesn't play well with circular | |
505 | ;;; dependencies among modules. |