From patchwork Thu May 18 18:28:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis 'GNUtoo' Carikli X-Patchwork-Id: 50136 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 52FFB27BBE9; Thu, 18 May 2023 19:29:12 +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=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,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 9531E179AE for ; Thu, 18 May 2023 19:29:11 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pziN7-0005I5-UH; Thu, 18 May 2023 14:29:05 -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 1pziN6-0005Fj-6e for guix-patches@gnu.org; Thu, 18 May 2023 14:29:04 -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 1pziN5-0003XN-3i for guix-patches@gnu.org; Thu, 18 May 2023 14:29:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pziN4-0002kz-Sr for guix-patches@gnu.org; Thu, 18 May 2023 14:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63576] [PATCH v1 2/4] gnu: Add aarch64-none-elf-gcc. Resent-From: Denis 'GNUtoo' Carikli Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 May 2023 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63576 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63576@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Efraim Flashner , Denis 'GNUtoo' Carikli Received: via spool by 63576-submit@debbugs.gnu.org id=B63576.168443452510553 (code B ref 63576); Thu, 18 May 2023 18:29:02 +0000 Received: (at 63576) by debbugs.gnu.org; 18 May 2023 18:28:45 +0000 Received: from localhost ([127.0.0.1]:54515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pziMn-0002k8-0f for submit@debbugs.gnu.org; Thu, 18 May 2023 14:28:45 -0400 Received: from cyberdimension.org ([80.67.179.20]:34922 helo=gnutoo.cyberdimension.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pziMi-0002jY-H6 for 63576@debbugs.gnu.org; Thu, 18 May 2023 14:28:41 -0400 Received: from gnutoo.cyberdimension.org (localhost [127.0.0.1]) by cyberdimension.org (OpenSMTPD) with ESMTP id 1179e8db; Thu, 18 May 2023 18:28:36 +0000 (UTC) Received: from localhost.localdomain (localhost [::1]) by gnutoo.cyberdimension.org (OpenSMTPD) with ESMTP id aea57366; Thu, 18 May 2023 18:28:36 +0000 (UTC) From: Denis 'GNUtoo' Carikli Date: Thu, 18 May 2023 20:28:12 +0200 Message-Id: <20230518182814.15881-2-GNUtoo@cyberdimension.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230518182814.15881-1-GNUtoo@cyberdimension.org> References: <20230518182814.15881-1-GNUtoo@cyberdimension.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 * gnu/packages/aarch64-none-elf-toolchain.scm (aarch64-none-elf-gcc): New variable. --- gnu/packages/aarch64-none-elf-toolchain.scm | 59 ++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/gnu/packages/aarch64-none-elf-toolchain.scm b/gnu/packages/aarch64-none-elf-toolchain.scm index 14569036ce..88a2abb1f9 100644 --- a/gnu/packages/aarch64-none-elf-toolchain.scm +++ b/gnu/packages/aarch64-none-elf-toolchain.scm @@ -17,10 +17,67 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages aarch64-none-elf-toolchain) + #:use-module (guix gexp) + #:use-module (guix utils) #:use-module (guix packages) - #:use-module (gnu packages cross-base)) + #:use-module (gnu packages cross-base) + #:use-module (gnu packages gcc)) (define-public aarch64-none-elf-binutils (package (inherit (cross-binutils "aarch64-none-elf")) (name "aarch64-none-elf-binutils"))) + +(define aarch64-none-elf-gcc + (let ((xgcc (cross-gcc "aarch64-none-elf" #:xgcc gcc #:xbinutils aarch64-none-elf-binutils))) + (package + (inherit xgcc) + (name "aarch64-none-elf-gcc") + (arguments + (substitute-keyword-arguments (package-arguments xgcc) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH + (lambda* (#:key inputs #:allow-other-keys) + (let ((gcc (assoc-ref inputs "gcc"))) + ;; Remove the default compiler from CPLUS_INCLUDE_PATH to + ;; prevent header conflict with the GCC from native-inputs. + (setenv "CPLUS_INCLUDE_PATH" + (string-join + (delete (string-append gcc "/include/c++") + (string-split (getenv "CPLUS_INCLUDE_PATH") + #\:)) + ":")) + (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 AARCH64-NONE-ELF 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)))) + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("aarch64-none-elf/include"))) + (search-path-specification + (variable "CROSS_CPLUS_INCLUDE_PATH") + (files '("aarch64-none-elf/include"))) + (search-path-specification + (variable "CROSS_OBJC_INCLUDE_PATH") + (files '("aarch64-none-elf/include"))) + (search-path-specification + (variable "CROSS_OBJCPLUS_INCLUDE_PATH") + (files '("aarch64-none-elf/include"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("aarch64-none-elf/lib"))))) + (native-inputs + `(("gcc" ,gcc) + ,@(package-native-inputs xgcc))))))