GNU bug report logs - #66263
[PATCH 00/23] guix: Add avr as a platform.

Previous Next

Package: guix-patches;

Reported by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>

Date: Fri, 29 Sep 2023 09:15:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 66263 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [bug#66263] [PATCH v1 07/22] gnu: cross-gcc: Enable multilib for AVR.
Date: Tue, 28 Nov 2023 12:34:50 +0100
* 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 <m.othacehe <at> gmail.com>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2023 Josselin Poiret <dev <at> jpoiret.xyz>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
 ;;;
 ;;; 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")))
-- 
2.41.0





This bug report was last modified 1 year and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.