summaryrefslogtreecommitdiff
path: root/gnu/packages/cross-base.scm
diff options
context:
space:
mode:
authorJean-Pierre De Jesus DIAZ <jean@foundationdevices.com>2023-11-28 12:34:44 +0100
committerEfraim Flashner <efraim@flashner.co.il>2023-12-11 11:53:48 +0200
commit444a40c75a3caa4b21a8d50cbde72dc3f5d60e57 (patch)
tree6de18849fc1f4ee868b59fa776f3fb3a75e2869b /gnu/packages/cross-base.scm
parent8e61e6351510f5665d09c6debc0584b3ed218e73 (diff)
gnu: cross-libc: Return #f if no libc available.
* gnu/packages/cross-base.scm (cross-libc): Return #f if no libc is available for the given TARGET. Change-Id: I17d19716373dd5704bb70d805437738fd29bd96b Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r--gnu/packages/cross-base.scm141
1 files changed, 73 insertions, 68 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 14cb3650994..6de13062790 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -9,6 +9,7 @@
9;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> 9;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
10;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> 10;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
11;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz> 11;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
12;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
12;;; 13;;;
13;;; This file is part of GNU Guix. 14;;; This file is part of GNU Guix.
14;;; 15;;;
@@ -610,74 +611,78 @@ the base compiler. Use XBINUTILS as the associated cross-Binutils."
610 (xbinutils (cross-binutils target)) 611 (xbinutils (cross-binutils target))
611 (xheaders (cross-kernel-headers target))) 612 (xheaders (cross-kernel-headers target)))
612 "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS 613 "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
613and the cross tool chain." 614and the cross tool chain. If TARGET doesn't have a standard C library #f is
614 (if (target-mingw? target) 615returned."
615 (let ((machine (substring target 0 (string-index target #\-)))) 616 (match target
616 (make-mingw-w64 machine 617 ((? target-mingw?)
617 #:xgcc xgcc 618 (let ((machine (substring target 0 (string-index target #\-))))
618 #:xbinutils xbinutils)) 619 (make-mingw-w64 machine
619 (package 620 #:xgcc xgcc
620 (inherit libc) 621 #:xbinutils xbinutils)))
621 (name (string-append "glibc-cross-" target)) 622 ((or (? target-linux?) (? target-hurd?))
622 (arguments 623 (package
623 (substitute-keyword-arguments 624 (inherit libc)
624 `( ;; Disable stripping (see above.) 625 (name (string-append "glibc-cross-" target))
625 #:strip-binaries? #f 626 (arguments
626 627 (substitute-keyword-arguments
627 ;; This package is used as a target input, but it should not have 628 `(;; Disable stripping (see above.)
628 ;; the usual cross-compilation inputs since that would include 629 #:strip-binaries? #f
629 ;; itself. 630
630 #:implicit-cross-inputs? #f 631 ;; This package is used as a target input, but it should not have
631 632 ;; the usual cross-compilation inputs since that would include
632 ;; We need SRFI 26. 633 ;; itself.
633 #:modules ((guix build gnu-build-system) 634 #:implicit-cross-inputs? #f
634 (guix build utils) 635
635 (srfi srfi-26)) 636 ;; We need SRFI 26.
636 637 #:modules ((guix build gnu-build-system)
637 ,@(package-arguments libc)) 638 (guix build utils)
638 ((#:configure-flags flags) 639 (srfi srfi-26))
639 `(cons ,(string-append "--host=" target) 640
640 ,(if (target-hurd? target) 641 ,@(package-arguments libc))
641 `(append (list "--disable-werror" 642 ((#:configure-flags flags)
642 ,@%glibc/hurd-configure-flags) 643 `(cons ,(string-append "--host=" target)
643 ,flags) 644 ,(if (target-hurd? target)
644 flags))) 645 `(append (list "--disable-werror"
645 ((#:phases phases) 646 ,@%glibc/hurd-configure-flags)
646 `(modify-phases ,phases 647 ,flags)
647 (add-before 'configure 'set-cross-kernel-headers-path 648 flags)))
648 (lambda* (#:key inputs #:allow-other-keys) 649 ((#:phases phases)
649 (let* ((kernel (assoc-ref inputs "kernel-headers")) 650 `(modify-phases ,phases
650 (cpath (string-append kernel "/include"))) 651 (add-before 'configure 'set-cross-kernel-headers-path
651 (for-each (cut setenv <> cpath) 652 (lambda* (#:key inputs #:allow-other-keys)
652 ',%gcc-cross-include-paths) 653 (let* ((kernel (assoc-ref inputs "kernel-headers"))
653 (setenv "CROSS_LIBRARY_PATH" 654 (cpath (string-append kernel "/include")))
654 (string-append kernel "/lib")) ; for Hurd's libihash 655 (for-each (cut setenv <> cpath)
655 #t))) 656 ',%gcc-cross-include-paths)
656 ,@(if (target-hurd? target) 657 (setenv "CROSS_LIBRARY_PATH"
657 '((add-after 'install 'augment-libc.so 658 (string-append kernel "/lib")) ; for Hurd's libihash
658 (lambda* (#:key outputs #:allow-other-keys) 659 #t)))
659 (let* ((out (assoc-ref outputs "out"))) 660 ,@(if (target-hurd? target)
660 (substitute* (string-append out "/lib/libc.so") 661 '((add-after 'install 'augment-libc.so
661 (("/[^ ]+/lib/libc.so.0.3") 662 (lambda* (#:key outputs #:allow-other-keys)
662 (string-append out "/lib/libc.so.0.3" 663 (let* ((out (assoc-ref outputs "out")))
663 " libmachuser.so libhurduser.so")))) 664 (substitute* (string-append out "/lib/libc.so")
664 #t))) 665 (("/[^ ]+/lib/libc.so.0.3")
665 '()))))) 666 (string-append out "/lib/libc.so.0.3"
666 667 " libmachuser.so libhurduser.so"))))
667 ;; Shadow the native "kernel-headers" because glibc's recipe expects the 668 #t)))
668 ;; "kernel-headers" input to point to the right thing. 669 '())))))
669 (propagated-inputs `(("kernel-headers" ,xheaders))) 670
670 671 ;; Shadow the native "kernel-headers" because glibc's recipe expects the
671 (native-inputs `(("cross-gcc" ,xgcc) 672 ;; "kernel-headers" input to point to the right thing.
672 ("cross-binutils" ,xbinutils) 673 (propagated-inputs `(("kernel-headers" ,xheaders)))
673 ,@(if (target-hurd? target) 674
674 `(("cross-mig" 675 (native-inputs `(("cross-gcc" ,xgcc)
675 ,(cross-mig target 676 ("cross-binutils" ,xbinutils)
676 #:xgcc xgcc 677 ,@(if (target-hurd? target)
677 #:xbinutils xbinutils))) 678 `(("cross-mig"
678 '()) 679 ,(cross-mig target
679 ,@(package-inputs libc) ;FIXME: static-bash 680 #:xgcc xgcc
680 ,@(package-native-inputs libc)))))) 681 #:xbinutils xbinutils)))
682 '())
683 ,@(package-inputs libc) ;FIXME: static-bash
684 ,@(package-native-inputs libc)))))
685 (else #f)))
681 686
682 687
683;;; Concrete cross tool chains are instantiated like this: 688;;; Concrete cross tool chains are instantiated like this: