all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Morgan.J.Smith@outlook.com
To: 48767@debbugs.gnu.org, maximedevos@telenet.be
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>
Subject: [bug#48767] [PATCH] gnu: gcc-arm-none-eabi-7-2018-q2-update: Simplify build
Date: Mon, 27 Sep 2021 17:59:11 -0400	[thread overview]
Message-ID: <SN6PR05MB4031A60A6B1D19CB3BCFF8CAC5A79@SN6PR05MB4031.namprd05.prod.outlook.com> (raw)
In-Reply-To: <BYAPR05MB402338010B759846D3148453C53F9@BYAPR05MB4023.namprd05.prod.outlook.com>

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* 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")))
 
 \f
-;;; 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
-- 
2.33.0





  parent reply	other threads:[~2021-09-27 22:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 23:08 [bug#48767] [PATCH 0/7] Add msp430 toolchain Morgan Smith
2021-06-01  3:09 ` [bug#48767] [PATCH 1/7] gnu: Add gcc-msp430-support-files Morgan.J.Smith
2021-09-26 14:51 ` [bug#48767] [PATCH 1/6] " Morgan.J.Smith
2021-09-27 21:59 ` Morgan.J.Smith [this message]
2021-10-01  8:56   ` [bug#48767] [PATCH] gnu: gcc-arm-none-eabi-7-2018-q2-update: Simplify build Maxime Devos
2022-08-16 15:34 ` [bug#48767] [PATCH 0/7] Add msp430 toolchain Jean Pierre De Jesus DIAZ via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR05MB4031A60A6B1D19CB3BCFF8CAC5A79@SN6PR05MB4031.namprd05.prod.outlook.com \
    --to=morgan.j.smith@outlook.com \
    --cc=48767@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.