guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

16/23: gnu: Add cross-gcc-toolchain procedure.


From: guix-commits
Subject: 16/23: gnu: Add cross-gcc-toolchain procedure.
Date: Mon, 11 Dec 2023 06:57:42 -0500 (EST)

efraim pushed a commit to branch master
in repository guix.

commit f9cb95d9b4e211652c05018fa7d4acff15f86f5c
Author: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
AuthorDate: Tue Nov 28 12:34:59 2023 +0100

    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>
---
 gnu/packages/cross-base.scm | 51 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 104fb4de32..6ee7b315d8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -34,6 +34,7 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages mingw)
+  #:use-module (guix memoization)
   #:use-module (guix platform)
   #:use-module (guix packages)
   #:use-module (guix diagnostics)
@@ -41,6 +42,7 @@
   #:use-module (guix i18n)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
@@ -50,7 +52,8 @@
             cross-libc
             cross-gcc
             cross-mig
-            cross-kernel-headers))
+            cross-kernel-headers
+            cross-gcc-toolchain))
 
 (define-syntax %xgcc
   ;; GCC package used as the basis for cross-compilation.  It doesn't have to
@@ -727,6 +730,52 @@ returned."
                    #:xgcc xgcc))
    (else #f)))
 
+(define* (cross-gcc-toolchain/implementation target
+                                             #:key
+                                             (base-gcc %xgcc)
+                                             (xbinutils (cross-binutils 
target))
+                                             (libc (cross-libc
+                                                     target
+                                                     #:xgcc (cross-gcc target 
#:xgcc base-gcc)
+                                                     #:xbinutils xbinutils))
+                                             (xgcc (cross-gcc target
+                                                              #:xgcc base-gcc
+                                                              #:libc libc
+                                                              #:xbinutils 
xbinutils)))
+  "Returns PACKAGE that contains a cross-compilation tool chain for TARGET
+with XBINUTILS, XGCC and LIBC (if exists for TARGET)."
+  (package
+    (name (string-append (package-name xgcc) "-toolchain"))
+    (version (package-version xgcc))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     (list #:modules '((guix build union))
+           #:builder
+           #~(begin
+               (use-modules (ice-9 match)
+                            (guix build union))
+
+               (match %build-inputs
+                 (((names . directory) ...)
+                  (union-build #$output directory))))))
+    (inputs `(,xbinutils ,xgcc ,@(if libc (list libc) '())))
+    (home-page (package-home-page xgcc))
+    (synopsis
+     (format #f "Complete GCC tool chain for C/C++ development (~a)" target))
+    (description "This package provides a complete GCC cross toolchain for
+C/C++ development to be installed in user profiles.  This includes GCC, as
+well as libc (headers and binariesl), and Binutils.  GCC is the GNU Compiler
+Collection.")
+    (license (delete-duplicates `(,(package-license xgcc)
+                                  ,(package-license xbinutils)
+                                  ,@(if libc
+                                        (list (package-license libc))
+                                        '()))))))
+
+(define cross-gcc-toolchain
+  (memoize cross-gcc-toolchain/implementation))
+
 
 ;;; Concrete cross tool chains are instantiated like this:
 ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]