Subject: [bug#66263] [PATCH 00/23] guix: Add avr as a platform.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 05 Oct 2023 00:15:28 -0400

Hi,

Jean-Pierre De Jesus DIAZ <[email-masked]> 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.

-- 
Thanks,
Maxim