From patchwork Tue Nov 28 11:34:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 56892 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C47F827BBEA; Tue, 28 Nov 2023 11:37:02 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DF3BA27BBE2 for ; Tue, 28 Nov 2023 11:37:01 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7wOi-0006wj-U6; Tue, 28 Nov 2023 06:37:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7wOh-0006vV-9e for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:59 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7wOh-0008CM-0h for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7wOn-0003Oh-RK for guix-patches@gnu.org; Tue, 28 Nov 2023 06:37:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH v1 16/22] gnu: Add cross-gcc-toolchain procedure. References: <20230929091333.7623-1-jean@foundationdevices.com> In-Reply-To: <20230929091333.7623-1-jean@foundationdevices.com> Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Nov 2023 11:37:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66263 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ Received: via spool by 66263-submit@debbugs.gnu.org id=B66263.170117140312904 (code B ref 66263); Tue, 28 Nov 2023 11:37:05 +0000 Received: (at 66263) by debbugs.gnu.org; 28 Nov 2023 11:36:43 +0000 Received: from localhost ([127.0.0.1]:45638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wOQ-0003Lx-9f for submit@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:42 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:45518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wOA-0003Jy-Qw for 66263@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4083dbc43cfso37372885e9.3 for <66263@debbugs.gnu.org>; Tue, 28 Nov 2023 03:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1701171374; x=1701776174; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WfUjTPlANmq3DKHZUprDni/YHXt+G7w+CoxvAnHFrfc=; b=HMP8kCnl9tzdiU4ReQ8TUhLV0XlubocU70CR7+MH0WGYh2gvMIqzln+ChhWLiFBxax StZHKTOkMxjVry30UV440BOOi6TaDliiBB0wyR0gpV8qESxwDZdxio4Jc8yhiHYXo1+v y8ZN8pjyXFDlVD8R+pvhFCyoL/qTgtUyF7xqH6TSR3wdM+SMocwTEgB3yhGPPC1S32BE OveKzOHf4kY/xw6Xb5xAd+O2EJ5ssexf8l8z+60UFRSWBo99hSqsQkoyKfWTxILRVRlM xTHnH3lcy7d3gX9safmvk86UNx8VqID1AxOOMjXAzDG+vlbMO/sMUzmWbZ1l4ZsFiPD9 SYWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701171374; x=1701776174; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WfUjTPlANmq3DKHZUprDni/YHXt+G7w+CoxvAnHFrfc=; b=rU9yZ0dRGa7uYuWz4FYMKO/CjmNfIHEO2SDIOezGzh7AucejB6eg3ULjYXgAuqffyI N4ROpS5BGawItxNW2ewLQFgtobE2i7z+vIZkT+0W2PTUToZG1yl3RYzUt1azhAj9jDLJ g6qLy0zzpvEdfuPElK85C65cIZwSsJVKNwze6iYF54QKUFSM1+6Hoge16sMikFDOKGaD yA/ieCIsHDvpRg/OCk1yB/TihlPbZDltJwSr2Pjy6aeAYbbEADA3u4m8IU+8pV40E5zK 3e52t+TJVrRV5iZ3ptqnpRmWar6gAPrCRaGuK9LIkG07uP2wogs4Awdfbo9X+ei4FLMG lsgw== X-Gm-Message-State: AOJu0YzRPKNUfQN7YC8n0KJMbZAdk8/5ZQ4XzHb6QxbzRcIT4ZLVyiLQ icYmaN+IhUMTFsXhEelAtF3aqh5nEkSuNACvV64= X-Google-Smtp-Source: AGHT+IGDYCORhRAergVSr5GMFI9d8gmGHS2vsDgGfH7rCzI4oatOc5aMb9P/MFTJEhQtO4RPYfwVig== X-Received: by 2002:a05:600c:524f:b0:40b:4ba1:c4f2 with SMTP id fc15-20020a05600c524f00b0040b4ba1c4f2mr1443673wmb.30.1701171373981; Tue, 28 Nov 2023 03:36:13 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b0040b4cb14d40sm1848769wmg.19.2023.11.28.03.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:36:13 -0800 (PST) Date: Tue, 28 Nov 2023 12:34:59 +0100 Message-ID: <20231128113510.11214-16-jean@foundationdevices.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jean-Pierre De Jesus DIAZ X-ACL-Warn: , Jean-Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean-Pierre De Jesus DIAZ via Guix-patches via From: Jean-Pierre De Jesus DIAZ Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/cross-base.scm (cross-gcc-toolchain/implementation): New procedure. * gnu/packages/cross-base.scm (cross-gcc-toolchain): New procedure. Change-Id: I994067eac094d0a50a7399e61bda944eded9187f --- 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 72f786dc35..0a8a0bb95c 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -34,6 +34,7 @@ (define-module (gnu packages cross-base) #: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 @@ (define-module (gnu packages cross-base) #: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 @@ (define-module (gnu packages cross-base) 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 @@ (define* (cross-libc* target #: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: ;;