From patchwork Tue Mar 28 14:28:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 48768 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 40CD9170F6; Tue, 28 Mar 2023 15:31:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 03298170FD for ; Tue, 28 Mar 2023 15:31:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phAKx-0004hw-KX; Tue, 28 Mar 2023 10:30:11 -0400 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 1phAKs-0004dQ-6n for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phAKr-0006qW-Un for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phAKr-0002aj-PD for guix-patches@gnu.org; Tue, 28 Mar 2023 10:30:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62307] [PATCH core-updates v2 04/20] gnu: cross-base: Factor out cross-mig. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Mar 2023 14:30:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62307@debbugs.gnu.org Cc: Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 62307-submit@debbugs.gnu.org id=B62307.16800137809756 (code B ref 62307); Tue, 28 Mar 2023 14:30:05 +0000 Received: (at 62307) by debbugs.gnu.org; 28 Mar 2023 14:29:40 +0000 Received: from localhost ([127.0.0.1]:50410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phAKS-0002XH-6s for submit@debbugs.gnu.org; Tue, 28 Mar 2023 10:29:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phAK8-0002UP-Bg for 62307@debbugs.gnu.org; Tue, 28 Mar 2023 10:29:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phAK3-0006ON-4c; Tue, 28 Mar 2023 10:29:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=t220S3xIvoj0FbvWJpJ+BKBT9K0Y2f9MWCL5zO9BNQA=; b=lLqC4D+vcIv9/+h8NgXk EbgI4raGYvdiwEdZhn9OjR8v5jxJ+irW+dzbFuGRKXdimO8mh9i+PvGAYV2u289srZ6ZmLGQMlJRn RxWkeUjzVsmo5/PkT+wTuYVEVW6G6g4/bSEGsuAu/RhwggBqlLolNvjQHt2AZXWFBz9iKWolUx1ri Em23qyUdeT84+5/fy/n3Q8RpFTG4uh/E7wFkPUSmYzSuYOXq+Mky42dmH6cge+kEi4UgoxsUD0MCN VU9Pk0Xg7MAl3cDlmmhb+PB39X2wrAlsTQsPN0R0VlEawzdXG/HtVfKRQniUgRESDaxsDbjrTIV7y YSb75Mu5NP56wg==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phAK2-00026Y-Ng; Tue, 28 Mar 2023 10:29:14 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 28 Mar 2023 16:28:36 +0200 Message-Id: <20230328142852.26635-5-ludo@gnu.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230328142852.26635-1-ludo@gnu.org> References: <87pm90bzva.fsf_-_@gnu.org> <20230328142852.26635-1-ludo@gnu.org> 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: , 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 From: Josselin Poiret * gnu/packages/cross-base.scm (cross-mig): New exported procedure. (cross-gnumach-headers): New procedure. (cross-kernel-headers*): Factor them out. (cross-libc*): Use them there. Signed-off-by: Ludovic Courtès --- gnu/packages/cross-base.scm | 89 ++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index adead3206a..2a7c4d8011 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -46,6 +46,7 @@ (define-module (gnu packages cross-base) #:export (cross-binutils cross-libc cross-gcc + cross-mig cross-kernel-headers)) (define-syntax %xgcc @@ -365,6 +366,52 @@ (define* (cross-kernel-headers/deprecated target #:xgcc xgcc #:xbinutils xbinutils)) +(define* (cross-gnumach-headers target + #:key + (xgcc (cross-gcc target)) + (xbinutils (cross-binutils target))) + (package + (inherit gnumach-headers) + (name (string-append (package-name gnumach-headers) + "-cross-" target)) + (native-inputs + (modify-inputs (package-native-inputs gnumach-headers) + (prepend xgcc xbinutils))))) + +(define* (cross-mig target + #:key + (xgcc (cross-gcc target)) + (xbinutils (cross-binutils target))) + "Return a cross-mig for TARGET, where TARGET is a GNU triplet. Use XGCC as +the base compiler. Use XBINUTILS as the associated cross-Binutils." + (define xgnumach-headers + (cross-gnumach-headers target + #:xgcc xgcc + #:xbinutils xbinutils)) + (package + (inherit mig) + (name (string-append "mig-cross")) + (arguments + (substitute-keyword-arguments (package-arguments mig) + ((#:configure-flags flags #~'()) + #~(list #$(string-append "--target=" target))) + ((#:tests? _ #f) + #f) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (add-before 'configure 'set-cross-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let* ((mach #+xgnumach-headers) + (cpath (string-append mach "/include"))) + (for-each (lambda (variable) + (setenv variable cpath)) + '#$%gcc-cross-include-paths)))))))) + (propagated-inputs + (list xgnumach-headers)) + (native-inputs + (modify-inputs (package-native-inputs mig) + (prepend xgcc xbinutils))))) + (define* (cross-kernel-headers* target #:key (linux-headers linux-libre-headers) @@ -399,40 +446,11 @@ (define xlinux-headers ("cross-binutils" ,xbinutils) ,@(package-native-inputs linux-headers))))) - (define xgnumach-headers-name - (string-append (package-name gnumach-headers) "-cross-" target)) - - (define xgnumach-headers - (package - (inherit gnumach-headers) - (name xgnumach-headers-name) - (native-inputs - (modify-inputs (package-native-inputs gnumach-headers) - (prepend xgcc xbinutils))))) - (define xmig - (package - (inherit mig) - (name (string-append "mig-cross")) - (arguments - (substitute-keyword-arguments (package-arguments mig) - ((#:configure-flags flags #~'()) - #~(list #$(string-append "--target=" target))) - ((#:tests? _ #f) - #f) - ((#:phases phases #~%standard-phases) - #~(modify-phases #$phases - (add-before 'configure 'set-cross-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let* ((mach #+(this-package-input xgnumach-headers-name)) - (cpath (string-append mach "/include"))) - (for-each (lambda (variable) - (setenv variable cpath)) - '#$%gcc-cross-include-paths)))))))) - (propagated-inputs (list xgnumach-headers)) - (native-inputs - (modify-inputs (package-native-inputs mig) - (prepend xgcc xbinutils))))) + (cross-mig target #:xgcc xgcc #:xbinutils xbinutils)) + + (define xgnumach-headers + (cross-gnumach-headers target #:xgcc xgcc #:xbinutils xbinutils)) (define xhurd-headers (package @@ -611,8 +629,9 @@ (define* (cross-libc* target ("cross-binutils" ,xbinutils) ,@(if (target-hurd? target) `(("cross-mig" - ,@(assoc-ref (package-native-inputs xheaders) - "cross-mig"))) + ,(cross-mig target + #:xgcc xgcc + #:xbinutils xbinutils))) '()) ,@(package-inputs libc) ;FIXME: static-bash ,@(package-native-inputs libc))))))