diff options
| author | Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> | 2023-11-28 12:34:59 +0100 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2023-12-11 13:37:21 +0200 |
| commit | f9cb95d9b4e211652c05018fa7d4acff15f86f5c (patch) | |
| tree | 9775eab536a23e0faffa8de0bd538fd77bae22c5 /gnu | |
| parent | 06587003b896755f876ecd57b848e1d663fafb87 (diff) | |
gnu: Add cross-gcc-toolchain procedure.
* gnu/packages/cross-base.scm (cross-gcc-toolchain/implementation,
cross-gcc-toolchain): New procedures.
Change-Id: I994067eac094d0a50a7399e61bda944eded9187f
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages/cross-base.scm | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 104fb4de323..6ee7b315d85 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #:use-module (gnu packages linux) | 34 | #:use-module (gnu packages linux) |
| 35 | #:use-module (gnu packages hurd) | 35 | #:use-module (gnu packages hurd) |
| 36 | #:use-module (gnu packages mingw) | 36 | #:use-module (gnu packages mingw) |
| 37 | #:use-module (guix memoization) | ||
| 37 | #:use-module (guix platform) | 38 | #:use-module (guix platform) |
| 38 | #:use-module (guix packages) | 39 | #:use-module (guix packages) |
| 39 | #:use-module (guix diagnostics) | 40 | #:use-module (guix diagnostics) |
| @@ -41,6 +42,7 @@ | |||
| 41 | #:use-module (guix i18n) | 42 | #:use-module (guix i18n) |
| 42 | #:use-module (guix utils) | 43 | #:use-module (guix utils) |
| 43 | #:use-module (guix build-system gnu) | 44 | #:use-module (guix build-system gnu) |
| 45 | #:use-module (guix build-system trivial) | ||
| 44 | #:use-module (guix gexp) | 46 | #:use-module (guix gexp) |
| 45 | #:use-module (srfi srfi-1) | 47 | #:use-module (srfi srfi-1) |
| 46 | #:use-module (srfi srfi-26) | 48 | #:use-module (srfi srfi-26) |
| @@ -50,7 +52,8 @@ | |||
| 50 | cross-libc | 52 | cross-libc |
| 51 | cross-gcc | 53 | cross-gcc |
| 52 | cross-mig | 54 | cross-mig |
| 53 | cross-kernel-headers)) | 55 | cross-kernel-headers |
| 56 | cross-gcc-toolchain)) | ||
| 54 | 57 | ||
| 55 | (define-syntax %xgcc | 58 | (define-syntax %xgcc |
| 56 | ;; GCC package used as the basis for cross-compilation. It doesn't have to | 59 | ;; GCC package used as the basis for cross-compilation. It doesn't have to |
| @@ -727,6 +730,52 @@ returned." | |||
| 727 | #:xgcc xgcc)) | 730 | #:xgcc xgcc)) |
| 728 | (else #f))) | 731 | (else #f))) |
| 729 | 732 | ||
| 733 | (define* (cross-gcc-toolchain/implementation target | ||
| 734 | #:key | ||
| 735 | (base-gcc %xgcc) | ||
| 736 | (xbinutils (cross-binutils target)) | ||
| 737 | (libc (cross-libc | ||
| 738 | target | ||
| 739 | #:xgcc (cross-gcc target #:xgcc base-gcc) | ||
| 740 | #:xbinutils xbinutils)) | ||
| 741 | (xgcc (cross-gcc target | ||
| 742 | #:xgcc base-gcc | ||
| 743 | #:libc libc | ||
| 744 | #:xbinutils xbinutils))) | ||
| 745 | "Returns PACKAGE that contains a cross-compilation tool chain for TARGET | ||
| 746 | with XBINUTILS, XGCC and LIBC (if exists for TARGET)." | ||
| 747 | (package | ||
| 748 | (name (string-append (package-name xgcc) "-toolchain")) | ||
| 749 | (version (package-version xgcc)) | ||
| 750 | (source #f) | ||
| 751 | (build-system trivial-build-system) | ||
| 752 | (arguments | ||
| 753 | (list #:modules '((guix build union)) | ||
| 754 | #:builder | ||
| 755 | #~(begin | ||
| 756 | (use-modules (ice-9 match) | ||
| 757 | (guix build union)) | ||
| 758 | |||
| 759 | (match %build-inputs | ||
| 760 | (((names . directory) ...) | ||
| 761 | (union-build #$output directory)))))) | ||
| 762 | (inputs `(,xbinutils ,xgcc ,@(if libc (list libc) '()))) | ||
| 763 | (home-page (package-home-page xgcc)) | ||
| 764 | (synopsis | ||
| 765 | (format #f "Complete GCC tool chain for C/C++ development (~a)" target)) | ||
| 766 | (description "This package provides a complete GCC cross toolchain for | ||
| 767 | C/C++ development to be installed in user profiles. This includes GCC, as | ||
| 768 | well as libc (headers and binariesl), and Binutils. GCC is the GNU Compiler | ||
| 769 | Collection.") | ||
| 770 | (license (delete-duplicates `(,(package-license xgcc) | ||
| 771 | ,(package-license xbinutils) | ||
| 772 | ,@(if libc | ||
| 773 | (list (package-license libc)) | ||
| 774 | '())))))) | ||
| 775 | |||
| 776 | (define cross-gcc-toolchain | ||
| 777 | (memoize cross-gcc-toolchain/implementation)) | ||
| 778 | |||
| 730 | 779 | ||
| 731 | ;;; Concrete cross tool chains are instantiated like this: | 780 | ;;; Concrete cross tool chains are instantiated like this: |
| 732 | ;; | 781 | ;; |
