diff mbox series

[bug#66263,05/23] gnu: cross-gcc: Enable multilib for avr.

Message ID 20230929091627.7820-5-jean@foundationdevices.com
State New
Headers show
Series guix: Add avr as a platform. | expand

Commit Message

Jean-Pierre De Jesus DIAZ Sept. 29, 2023, 9:16 a.m. UTC
* gnu/packages/cross-base.scm (cross-gcc-arguments)
  [target-avr?]: Remove --disable-mutlilib and add --enable-multilib.
---
 gnu/packages/avr.scm        |  4 +---
 gnu/packages/cross-base.scm | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 7 deletions(-)

Comments

Maxim Cournoyer Oct. 5, 2023, 4:15 a.m. UTC | #1
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> writes:

> * gnu/packages/cross-base.scm (cross-gcc-arguments)
>   [target-avr?]: Remove --disable-mutlilib and add --enable-multilib.
> ---
>  gnu/packages/avr.scm        |  4 +---
>  gnu/packages/cross-base.scm | 17 +++++++++++++----
>  2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index b9bee5e624..e976203b89 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -75,9 +75,7 @@ (define avr-gcc
>                    ;; 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))))
> +                    (("#!/bin/sh") (string-append "#!" (which "sh"))))))))))
>        (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 f55765f1b0..ec7ca2186d 100644
> --- a/gnu/packages/cross-base.scm
> +++ b/gnu/packages/cross-base.scm
> @@ -197,12 +197,21 @@ (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 (string-match "--enable-languages.*" flag)
> +                                #$libc)

Not your code, but it'd be cleaner to use (string-prefix?
"--enable-languages" flag) here.

> +                           (and (string-match "--disable-multilib" flag)
> +                                #$(target-avr? target))))

I'd also move the #$libc above and #$(target-avr? ...) expressions as
the first tests for 'and', as there is no reason to match strings when
these are #f.
diff mbox series

Patch

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index b9bee5e624..e976203b89 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -75,9 +75,7 @@  (define avr-gcc
                   ;; 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))))
+                    (("#!/bin/sh") (string-append "#!" (which "sh"))))))))))
       (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 f55765f1b0..ec7ca2186d 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -197,12 +197,21 @@  (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 (string-match "--enable-languages.*" flag)
+                                #$libc)
+                           (and (string-match "--disable-multilib" flag)
+                                #$(target-avr? target))))
+                     #$flags)))
         ((#:make-flags flags)
          (if libc
              #~(let ((libc (assoc-ref %build-inputs "libc")))