From patchwork Tue Nov 28 11:34:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 56905 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 8F27D27BBEC; Tue, 28 Nov 2023 11:38: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 819EB27BBE9 for ; Tue, 28 Nov 2023 11:38:01 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7wOf-0006u6-Gg; Tue, 28 Nov 2023 06:36:57 -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 1r7wOd-0006t8-VY for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:55 -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 1r7wOd-00089l-NF for guix-patches@gnu.org; Tue, 28 Nov 2023 06:36:55 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7wOk-0003Nk-Hv for guix-patches@gnu.org; Tue, 28 Nov 2023 06:37:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH v1 07/22] gnu: cross-gcc: Enable multilib for AVR. 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:02 +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.170117137412741 (code B ref 66263); Tue, 28 Nov 2023 11:37:02 +0000 Received: (at 66263) by debbugs.gnu.org; 28 Nov 2023 11:36:14 +0000 Received: from localhost ([127.0.0.1]:45609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wNx-0003JP-Ml for submit@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:14 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:59628) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7wNt-0003IL-15 for 66263@debbugs.gnu.org; Tue, 28 Nov 2023 06:36:09 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40b4744d603so14697065e9.2 for <66263@debbugs.gnu.org>; Tue, 28 Nov 2023 03:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1701171356; x=1701776156; 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=WwwMLo+/jtyQVt4X/jqqaLyr7sdIhJGBc778TAec3p8=; b=MkWhFQPY6BDC3rmdh3RVX0zPorb0ITofuHi4bnECTfNbDIqN0Dho//bsXhI/QVqKBO 2uJ0Bpc2ayF7NogSU0rZibnPJSZyJ18oVH6YSiCJmrRSmG5soJPugNMDGd03o8Jksbal Sd0nnHLuRpexucaoOL9mMVY4n3RwZQcK/AN0AZl0AZD+Hk/ULt1AfGRkffwpVvT8iIcP Ol34b7LRK8+idx/9bMMybwOQdiL08b89KjBlCUqojd5856aj5IC8/Vmib8t1BDHqXQY8 CaqMzP7TFik+Xh7APvwFlp5X4BxVPQ7gQI7pEFfdYmvrnQOdwh1SZCDXnssCK1Za2c5T +M4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701171356; x=1701776156; 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=WwwMLo+/jtyQVt4X/jqqaLyr7sdIhJGBc778TAec3p8=; b=q47AVckQlaWZdUHORRJQbJtWqkb6rWy/FvWXKE0Jha4neBWFYTJQBWwNgkxrO4HpbO HGZJCSoGCIEAcK6/2FoY9n6J9NBhWjBJS105mIRyr+8qN2TBGiUYk9r4OX3nfoHI1muC jUkUopykptu9x/v1VduS2y1J3HCeVX+PdvsJH9zOyx7lYnlj0O1UXGN5MgGGg+M35Z6g SF3e5RZErZRVze2uuSg1X5spXbJWwKwunV8AjRY6cnWEKNqaQ/Ofyhf3n9zs6t9CdLC8 lJw9qjXpud+OdofEnu7dIV+v7m6HKXJkWFY7HHIcdtasp8ONclrFPV9YvJ5eMwQa0APz unYg== X-Gm-Message-State: AOJu0YxP/dcCNK/DGsTckk/aa7Ld8yojeNGgtYy/8iN4CGGChh3FtLJ0 bZ9th92IGsAKV89dl0/gpJ2BNkGHJ4BixxnBPVc= X-Google-Smtp-Source: AGHT+IEaY6oRcofl4diU1KOMROoJ96iaGb3dUqlurRXWMv9EXLFS5bYuzk5RfYKL75SN1RTW99sddg== X-Received: by 2002:a05:600c:4a9a:b0:405:348e:aa43 with SMTP id b26-20020a05600c4a9a00b00405348eaa43mr12414639wmp.12.1701171355580; Tue, 28 Nov 2023 03:35:55 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b0040b4cb14d40sm1848769wmg.19.2023.11.28.03.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:35:55 -0800 (PST) Date: Tue, 28 Nov 2023 12:34:50 +0100 Message-ID: <20231128113510.11214-7-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/build/cross-toolchain.scm (patch-multilib-shebang): New procedure. * gnu/packages/avr.scm (make-avr-gcc): Remove uneeded phases and flags for multilib. * gnu/packages/cross-base (cross-gcc-arguments) <#:configure-flags> [target-avr?]: Remove --disable-multilib and add --enable-multilib. Change-Id: Id68d803057ac898f0a670f10487b08bf0891ab0b --- gnu/build/cross-toolchain.scm | 10 ++++++++++ gnu/packages/avr.scm | 13 +------------ gnu/packages/cross-base.scm | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm index 9746be3e50..085b88a2c3 100644 --- a/gnu/build/cross-toolchain.scm +++ b/gnu/build/cross-toolchain.scm @@ -48,6 +48,14 @@ (define %gcc-cross-include-paths ;; Search path for target headers when cross-compiling. (map (cut string-append "CROSS_" <>) %gcc-include-paths)) +(define* (patch-genmultilib-shebang #:key inputs native-inputs #:allow-other-keys) + "Patch shebangs in the gcc/genmultilib file as it contains several scripts +inside, each with a #!/bin/sh that needs patching." + (substitute* "gcc/genmultilib" + (("#!/bin/sh") + (string-append "#!" (assoc-ref (or native-inputs inputs) "bash") + "/bin/bash")))) + (define* (make-cross-binutils-visible #:key outputs inputs target #:allow-other-keys) "Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under @@ -173,6 +181,8 @@ (define* (cross-gcc-build-phases target "Modify PHASES to include everything needed to build a cross-GCC for TARGET, a target triplet." (modify-phases phases + (add-after 'unpack 'patch-genmultilib-shebang + patch-genmultilib-shebang) (add-before 'configure 'set-cross-path ;; This mingw32 target checking logic should match that of target-mingw? ;; in (guix utils), but (guix utils) is too large too copy over to the diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm index c035df2b1d..ac09b799f3 100644 --- a/gnu/packages/avr.scm +++ b/gnu/packages/avr.scm @@ -84,18 +84,7 @@ (define* (make-avr-gcc/implementation #:key (xgcc gcc)) (format #t "environment variable `CPLUS_INCLUDE_PATH' \ changed to ~a~%" - (getenv "CPLUS_INCLUDE_PATH"))))) - ;; Without a working multilib build, the resulting GCC lacks - ;; support for nearly every AVR chip. - (add-after 'unpack 'fix-genmultilib - (lambda _ - ;; patch-shebang doesn't work here because there are - ;; actually several scripts inside this script, each with - ;; a #!/bin/sh that needs patching. - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))))))) - ((#:configure-flags flags) - #~(delete "--disable-multilib" #$flags)))) + (getenv "CPLUS_INCLUDE_PATH"))))))))) (native-search-paths (list (search-path-specification (variable "CROSS_C_INCLUDE_PATH") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 4b7c4b6cbe..dcb1c3efa8 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2020 Mathieu Othacehe ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Josselin Poiret +;;; Copyright © 2023 Foundation Devices, Inc. ;;; ;;; This file is part of GNU Guix. ;;; @@ -196,12 +197,19 @@ (define (cross-gcc-arguments target xgcc libc) #~((string-append "--with-toolexeclibdir=" (assoc-ref %outputs "lib") "/" #$target "/lib")) + #~()) + + #$@(if (target-avr? target) + #~("--enable-multilib") #~())) - #$(if libc - flags - #~(remove (cut string-match "--enable-languages.*" <>) - #$flags)))) + (remove + (lambda (flag) + (or (and #$libc + (string-prefix? "--enable-languages" flag)) + (and #$(target-avr? target) + (string=? flag "--disable-multilib")))) + #$flags))) ((#:make-flags flags) (if libc #~(let ((libc (assoc-ref %build-inputs "libc")))