diff mbox series

[bug#66263,08/23] gnu: avr-libc: Convert to procedure.

Message ID 20230929091627.7820-8-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/avr.scm (make-avr-libc): New procedure.

* gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
---
 gnu/packages/avr.scm | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Maxim Cournoyer Oct. 5, 2023, 4:17 a.m. UTC | #1
Hello,

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

> * gnu/packages/avr.scm (make-avr-libc): New procedure.
>
> * gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
> ---
>  gnu/packages/avr.scm | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index ccce686010..df1523274b 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -34,7 +34,8 @@ (define-module (gnu packages avr)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages cross-base)
>    #:use-module (gnu packages flashing-tools)
> -  #:use-module (gnu packages gcc))
> +  #:use-module (gnu packages gcc)
> +  #:export (make-avr-libc))
>  
>  (define-public avr-binutils
>    (package
> @@ -93,7 +94,9 @@ (define avr-gcc
>         `(("gcc" ,gcc)
>           ,@(package-native-inputs xgcc))))))
>  
> -(define avr-libc
> +(define* (make-avr-libc #:key
> +                        (xbinutils (cross-binutils "avr"))
> +                        (xgcc (cross-gcc "avr")))
>    (package
>      (name "avr-libc")

[...]

Procedures returning packages should be memoized, using 'memoize' from
(guix memoization) here since you have keyword arguments.
Maxim Cournoyer Oct. 5, 2023, 4:23 a.m. UTC | #2
Hi,

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

> * gnu/packages/avr.scm (make-avr-libc): New procedure.
>
> * gnu/packages/avr.scm (avr-libc): Use make-avr-libc procedure.
> ---
>  gnu/packages/avr.scm | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index ccce686010..df1523274b 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -34,7 +34,8 @@ (define-module (gnu packages avr)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages cross-base)
>    #:use-module (gnu packages flashing-tools)
> -  #:use-module (gnu packages gcc))
> +  #:use-module (gnu packages gcc)
> +  #:export (make-avr-libc))
>  
>  (define-public avr-binutils
>    (package
> @@ -93,7 +94,9 @@ (define avr-gcc
>         `(("gcc" ,gcc)
>           ,@(package-native-inputs xgcc))))))
>  
> -(define avr-libc
> +(define* (make-avr-libc #:key
> +                        (xbinutils (cross-binutils "avr"))
> +                        (xgcc (cross-gcc "avr")))

I had forgotten: please document any newly added procedures with doc
strings, especially public ones.

>    (package
>      (name "avr-libc")
>      (version "2.0.0")
> @@ -106,10 +109,12 @@ (define avr-libc
>                  "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
>      (build-system gnu-build-system)
>      (arguments
> -     '(#:out-of-source? #t
> -       #:configure-flags '("--host=avr")))
> -    (native-inputs `(("avr-binutils" ,avr-binutils)
> -                     ("avr-gcc" ,avr-gcc)))
> +     (list #:target "avr"
> +
> +           #:out-of-source? #t
> +
> +           #:implicit-cross-inputs? #f))
> +    (native-inputs (list xbinutils xgcc))
>      (home-page "https://www.nongnu.org/avr-libc/")
>      (synopsis "The AVR C Library")

This already was like this, but the leading 'The' determinant should be
dropped for synopsis.
diff mbox series

Patch

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index ccce686010..df1523274b 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -34,7 +34,8 @@  (define-module (gnu packages avr)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages flashing-tools)
-  #:use-module (gnu packages gcc))
+  #:use-module (gnu packages gcc)
+  #:export (make-avr-libc))
 
 (define-public avr-binutils
   (package
@@ -93,7 +94,9 @@  (define avr-gcc
        `(("gcc" ,gcc)
          ,@(package-native-inputs xgcc))))))
 
-(define avr-libc
+(define* (make-avr-libc #:key
+                        (xbinutils (cross-binutils "avr"))
+                        (xgcc (cross-gcc "avr")))
   (package
     (name "avr-libc")
     (version "2.0.0")
@@ -106,10 +109,12 @@  (define avr-libc
                 "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:out-of-source? #t
-       #:configure-flags '("--host=avr")))
-    (native-inputs `(("avr-binutils" ,avr-binutils)
-                     ("avr-gcc" ,avr-gcc)))
+     (list #:target "avr"
+
+           #:out-of-source? #t
+
+           #:implicit-cross-inputs? #f))
+    (native-inputs (list xbinutils xgcc))
     (home-page "https://www.nongnu.org/avr-libc/")
     (synopsis "The AVR C Library")
     (description
@@ -118,6 +123,8 @@  (define avr-libc
     (license
      (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))
 
+(define avr-libc (make-avr-libc))
+
 (define-public avr-toolchain
   ;; avr-libc checks the compiler version and passes "--enable-device-lib" for avr-gcc > 5.1.0.
   ;; It wouldn't install the library for atmega32u4 etc if we didn't use the corret avr-gcc.