From patchwork Mon Sep 27 21:59:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morgan Smith X-Patchwork-Id: 33366 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 853F327BBE3; Mon, 27 Sep 2021 23:07:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B769727BBE1 for ; Mon, 27 Sep 2021 23:07:12 +0100 (BST) Received: from localhost ([::1]:55024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUymF-0005J3-Ib for patchwork@mira.cbaines.net; Mon, 27 Sep 2021 18:07:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUyhG-0005Ez-NG for guix-patches@gnu.org; Mon, 27 Sep 2021 18:02:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUyhG-0006oR-1T for guix-patches@gnu.org; Mon, 27 Sep 2021 18:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mUyhF-00089K-R6 for guix-patches@gnu.org; Mon, 27 Sep 2021 18:02:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48767] [PATCH] gnu: gcc-arm-none-eabi-7-2018-q2-update: Simplify build References: In-Reply-To: Resent-From: Morgan.J.Smith@outlook.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 27 Sep 2021 22:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48767 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48767@debbugs.gnu.org, maximedevos@telenet.be Cc: Morgan Smith Received: via spool by 48767-submit@debbugs.gnu.org id=B48767.163278007931276 (code B ref 48767); Mon, 27 Sep 2021 22:02:01 +0000 Received: (at 48767) by debbugs.gnu.org; 27 Sep 2021 22:01:19 +0000 Received: from localhost ([127.0.0.1]:43023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUygY-00088M-W9 for submit@debbugs.gnu.org; Mon, 27 Sep 2021 18:01:19 -0400 Received: from mail-bn7nam10olkn2092.outbound.protection.outlook.com ([40.92.40.92]:49111 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUygW-000886-4F for 48767@debbugs.gnu.org; Mon, 27 Sep 2021 18:01:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B6gEWHzF+BKpR+gTXHdbb/e0KsSXcGfmCFlor1cEmInvCHa6QBONtE1/QN5ZFgoUuhn5FL1+NAQEWtoUBOg0uO9uwGM3JB6ozNwahj2IBXOzer97Uv6hY94gZztd4CtJh0sQ0lHQCqrCIoLLgWuKKmDFr2bmlMS6QOzD6HsSKw+YRVf783LIxeEPh7x6TQnVREnuqjqNFiM1iKjlZpXBY4P+qRikiXKAKIhgGl+sovqfJvdGI+VUGJJTSBSMhO9LN1lr0HPiTpxbBBtSz8IswRq+RanHw49bEyNe0wPQ7+U5yyS3Y6Ksgwj3Ai3MDuOQE/4LevC+fS/FJiO12IglOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wZPNfMfKwNfjOdKLOU4DfGz/fCY/5aKN63GeLvC+jxc=; b=ML9qcRrjB17ZuH+cB2LjMXz8IKih0XrK9WYJ33UFUs1EeR3IBqZ++YkuOp2dDhFa1Y+EKQX7BgLYadTlqR8vWod1M7FC1FekXsszC2B9s/6+gFdfk2oTypYimJd0uuTP3d2xadv8jIb6siLOrG6eFkBi/ihfocX3+ZeYzrh4C+vd1NASz1FboRXsr7b/BbToJEN5tvmhxDFj5v8xnMwX8vCNnLIF763Z1OlKJZei6IWsBvkIU15MKf5+BpppdjLl+/XD1r8tcNQibCPKpzgJQNlqDqSCkJIHKPYjQ1/9MSGz0MsW8xgJ6JMRhExFNXOGzUEy5M/MulWdN8Lq4YiYCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wZPNfMfKwNfjOdKLOU4DfGz/fCY/5aKN63GeLvC+jxc=; b=SP6UwixzJta6Kq/DKK0XXdXAUmrs9Sp7LK/AAq0qnxVLvvIIoDiUygBnrABSTACRQQbOw7kgTNzzjPAoQf9LX1DV2gnSGIOkN7CAqxBgDtYq9xh4Abmi9n69HIroIRFGaZWA1fpjVt5Lp5ypzi5mbM6gynD3L8inz+Xuq7dOjuIkxN+P++rDCgDjJHJwzfxHYTcsH9MbAaMZygtWXkgonnl1frjcE+/Xxs0OxZQJK0aq0NU/hDsvQESpR5c7795ly/83r11W8WPRie52aXHiJ7JBB+La4i9w2WndbUaRBOKAIKrKqVbkKYvT8CEH5fbENAjUmIb3Mz8bJKHjzVUe3g== Received: from SN6PR05MB4031.namprd05.prod.outlook.com (2603:10b6:805:17::33) by SN4PR0501MB3695.namprd05.prod.outlook.com (2603:10b6:803:4f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.10; Mon, 27 Sep 2021 22:01:09 +0000 Received: from SN6PR05MB4031.namprd05.prod.outlook.com ([fe80::39d4:1130:ae2e:47bf]) by SN6PR05MB4031.namprd05.prod.outlook.com ([fe80::39d4:1130:ae2e:47bf%7]) with mapi id 15.20.4544.013; Mon, 27 Sep 2021 22:01:09 +0000 From: Morgan.J.Smith@outlook.com Date: Mon, 27 Sep 2021 17:59:11 -0400 Message-ID: X-Mailer: git-send-email 2.33.0 X-TMN: [Ma5O0QsM0zS5X0DaZOVTvUgc8sSpt1ix] X-ClientProxiedBy: YQBPR01CA0049.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:2::21) To SN6PR05MB4031.namprd05.prod.outlook.com (2603:10b6:805:17::33) X-Microsoft-Original-Message-ID: <20210927215910.13792-1-Morgan.J.Smith@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from workpad.hitronhub.home (170.52.80.188) by YQBPR01CA0049.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Mon, 27 Sep 2021 22:01:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b1f6d8f1-ccea-41dd-059c-08d982024f6a X-MS-Exchange-SLBlob-MailProps: LtmIgUwM0qR87WTIZiDFXlWi7gg9yqVB8sOAb6CU5hesh3jlTLmhZvYxWjsX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ZW8qdJ0WxZqIJuSOu3LaIM6hW0nx2ZXK8NHPj8L+MI436KS96oYf/rhMNpMflBzuZ6lZYpLG2n/KdZHqumZtoz0a6v+uJfXHzJJpTAQZbYlpSDGoZeg77k1alM+Zr7ImzJPOGP0IMnPBg9x8hDhedLrGVbDOWfOaIPB9eFAfMbUPWeg5a5oqQEGxTd0QK+iZdEVyhDO0F3ydpCeNe95h+3hCHNWiI= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0q9lXqI3F3mXi768mhDxDuz8MY1DeJ5L+H7a7Gb2XTQKkvpO7kvKAvWMhVHVvdo8zvqIiuMXCp3/O1jFLV/MemNB0RYDURvUK28PERt7fAhIVxQojNjvXrOr8zVzfyMZoSJ35By3C817QQu7kX4MdQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1f6d8f1-ccea-41dd-059c-08d982024f6a X-MS-Exchange-CrossTenant-AuthSource: SN6PR05MB4031.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2021 22:01:08.8686 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0501MB3695 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" X-getmail-retrieved-from-mailbox: Patches From: Morgan Smith * gnu/packages/embedded.scm (gcc-arm-none-eabi-4.9)[phases]: Add expand-version-string phase (gcc-arm-none-eabi-7-2018-q2-update): Inherit from gcc-arm-none-eabi-4.9 and remove all the redundant bits. --- Hello Maxime, Thanks for the review! Is this the appropriate time to tell you I also have a very eerily similar patch set read to go for a riscv cross compiler? Maybe trying to make this stuff reusable is a good thing to do. First step is to clean up the arm stuff I suppose. I pretty sure this patch doesn't really change the packages at all in any meaningful way. Adding the DEV-PHASE version thing means that now when people type 'arm-none-eabi-gcc --version' they'll see in brackets the guix version number beside the actual version number. Also gcc-arm-none-eabi-7-2018-q2-update now has the 'with-multilib-list' configure flag set twice but it's pretty clear it just uses the latter value as it won't even compile with the inherited flag value. There seems to be a weird glitch when you inherit a phase the uses `this-package' but you also specify arguments. I found a work around though. To test this patch I compiled gcc-arm-none-eabi-4.9, gcc-arm-none-eabi-6, and gcc-arm-none-eabi-7-2018-q2-update successfully. Than I installed arm-none-eabi-toolchain and made sure it could successfully compile the arm stuff I'm working on. Everything seems to work great. Morgan gnu/packages/embedded.scm | 144 +++++++++++++------------------------- 1 file changed, 48 insertions(+), 96 deletions(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index f388c11c3d..809708187f 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -115,13 +115,17 @@ ":")) (format #t "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" - (getenv "CPLUS_INCLUDE_PATH")) - #t))) + (getenv "CPLUS_INCLUDE_PATH"))))) (add-after 'unpack 'fix-genmultilib (lambda _ (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))) - #t)))) + (("#!/bin/sh") (string-append "#!" (which "sh")))))) + (add-after 'unpack 'expand-version-string + (lambda _ + (make-file-writable "gcc/DEV-PHASE") + (with-output-to-file "gcc/DEV-PHASE" + (lambda () + (display ,(package-version this-package)))))))) ((#:configure-flags flags) ;; The configure flags are largely identical to the flags used by the ;; "GCC ARM embedded" project. @@ -166,6 +170,46 @@ (search-patches "gcc-6-cross-environment-variables.patch" "gcc-6-arm-none-eabi-multilib.patch"))))))) +;;; The following definitions are for the "7-2018-q2-update" variant of the +;;; ARM cross toolchain as offered on https://developer.arm.com +(define-public gcc-arm-none-eabi-7-2018-q2-update + (let ((revision "2") + (svn-revision 261907)) + (package (inherit gcc-arm-none-eabi-6) + (version (string-append "7-2018-q2-update-" + revision "." (number->string svn-revision))) + (source + (origin + (method svn-fetch) + (uri (svn-reference + (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/") + (revision svn-revision))) + (file-name (string-append "gcc-arm-embedded-" version "-checkout")) + (sha256 + (base32 + "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5")) + (patches + (append + (origin-patches (package-source gcc-7)) + (search-patches "gcc-7-cross-environment-variables.patch"))))) + (arguments + (substitute-keyword-arguments (package-arguments gcc-arm-none-eabi-4.9) + ((#:configure-flags flags) + ;; I add this flag on the end so it overrides the previously set value + `(append ,flags (list "--with-multilib-list=rmprofile"))) + ((#:phases phases) + `(modify-phases ,phases + ;; XXX: I replicated this phase just so that the version is + ;; correct. This phase automatically gets the correct version if + ;; I don't specify any arguments for a package for some reason + ;; (see gcc-arm-none-eabi-6) + (replace 'expand-version-string + (lambda _ + (make-file-writable "gcc/DEV-PHASE") + (with-output-to-file "gcc/DEV-PHASE" + (lambda () + (display ,(package-version this-package))))))))))))) + (define-public newlib-arm-none-eabi (package (name "newlib") @@ -268,98 +312,6 @@ usable on embedded products.") (synopsis "Newlib variant for small systems with limited memory"))) -;;; The following definitions are for the "7-2018-q2-update" variant of the -;;; ARM cross toolchain as offered on https://developer.arm.com -(define-public gcc-arm-none-eabi-7-2018-q2-update - (let ((xgcc (cross-gcc "arm-none-eabi" - #:xgcc gcc-7 - #:xbinutils (cross-binutils "arm-none-eabi"))) - (revision "1") - (svn-revision 261907)) - (package (inherit xgcc) - (version (string-append "7-2018-q2-update-" - revision "." (number->string svn-revision))) - (source - (origin - (method svn-fetch) - (uri (svn-reference - (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/") - (revision svn-revision))) - (file-name (string-append "gcc-arm-embedded-" version "-checkout")) - (sha256 - (base32 - "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5")) - (patches - (append - (origin-patches (package-source gcc-7)) - (search-patches "gcc-7-cross-environment-variables.patch"))))) - (native-inputs - `(("flex" ,flex) - ("isl" ,isl-0.18) - ,@(alist-delete "isl" (package-native-inputs xgcc)))) - (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'expand-version-string - (lambda _ - (make-file-writable "gcc/DEV-PHASE") - (with-output-to-file "gcc/DEV-PHASE" - (lambda () - (display "7-2018-q2-update"))) - #t)) - (add-after 'unpack 'fix-genmultilib - (lambda _ - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))) - #t)) - (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")) - #t))))) - ((#:configure-flags flags) - ;; The configure flags are largely identical to the flags used by the - ;; "GCC ARM embedded" project. - `(append (list "--enable-multilib" - "--with-newlib" - "--with-multilib-list=rmprofile" - "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" - "--enable-plugins" - "--disable-decimal-float" - "--disable-libffi" - "--disable-libgomp" - "--disable-libmudflap" - "--disable-libquadmath" - "--disable-libssp" - "--disable-libstdcxx-pch" - "--disable-nls" - "--disable-shared" - "--disable-threads" - "--disable-tls") - (delete "--disable-multilib" ,flags))))) - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("arm-none-eabi/include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-none-eabi/include" - "arm-none-eabi/include/c++" - "arm-none-eabi/include/c++/arm-none-eabi"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("arm-none-eabi/lib")))))))) (define-public newlib-arm-none-eabi-7-2018-q2-update ;; This is the same commit as used for the 7-2018-q2-update release