diff mbox series

[bug#67484] gnu: avr-libc: Update to 2.1-1 (git version)

Message ID CAAGQtHzS-hdXcvfj0hKRZrEKALWsiDYD=bjj2Za-i+ubZz6ZiA@mail.gmail.com
State New
Headers show
Series [bug#67484] gnu: avr-libc: Update to 2.1-1 (git version) | expand

Commit Message

Kristian Lein-Mathisen Nov. 27, 2023, 2:24 p.m. UTC
And here, the attachment. How embarrassing!
K.

On Mon, Nov 27, 2023 at 2:03 PM Kristian Lein-Mathisen <
kristianlein@gmail.com> wrote:

>
> Hi,
>
> I'm working with the newest AVR devices and as such need the newer
> avr-libc. avr-libc was moved from savannah to github and seems to have no
> official releases after 2.1. However, several new AVR devices have been
> added to the post 2.1-release and this is useful to package. avr-libc
> currently most recent commit
> <https://github.com/avrdudes/avr-libc/commit/55e8cac69935657bcd3e4d938750960c757844c3>
> is quite old, from Jul 6, 2022, and it the once I've used here.
>
> My patch simply replaces the older 2.0 avr-libc which may rise some
> stability concerns. If there is a way to parameterize make-avr-libc to
> support both 2.0 and 2.1-1 (and perhaps 2.1) in a way that's accessibly to
> (make-avr-toolchain #:xgcc gcc-14), please advice.
>
> Also, there used to be an old avr-toolchain package which is now gone. I
> now have to issue
>
> > guix package -e '(begin (import (gnu packages avr) (gnu packages gcc))
> (make-avr-toolchain #:xgcc gcc-13))'
>
> In order to install avr-gcc, is this how this is intended to work?
>
> Thanks for any pointers,
> K.
>
diff mbox series

Patch

From 902d1628ec6902f726152cd52815521fd5091153 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Mon, 27 Nov 2023 13:08:55 +0100
Subject: [PATCH] gnu: avr-libc: Update to unofficial 2.1-1

* gnu/packages/avr.scm (gnu): Update to 2.1-1
---
 gnu/packages/avr.scm | 60 ++++++++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index a66abbbd3a..420b17b469 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -38,6 +38,8 @@  (define-module (gnu packages avr)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages flashing-tools)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages vim)
   #:export (make-avr-toolchain))
@@ -120,29 +122,43 @@  (define make-avr-gcc
   (memoize make-avr-gcc/implementation))
 
 (define* (make-avr-libc/implementation #:key (xgcc gcc))
-  (package
-    (name "avr-libc")
-    (version "2.0.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://savannah//avr-libc/avr-libc-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32
-                "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj"))))
-    (build-system gnu-build-system)
-    (arguments
-     '(#:out-of-source? #t
-       #:configure-flags '("--host=avr")))
-    (native-inputs `(("avr-binutils" ,(make-avr-binutils))
-                     ("avr-gcc" ,(make-avr-gcc #:xgcc xgcc))))
-    (home-page "https://www.nongnu.org/avr-libc/")
-    (synopsis "The AVR C Library")
-    (description
-     "AVR Libc is a project whose goal is to provide a high quality C library
+  (let ((commit "55e8cac69935657bcd3e4d938750960c757844c3")
+        (revision "1")) ;; post-2.1 they say
+    (package
+      (name "avr-libc")
+      (version (git-version "2.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/avrdudes/avr-libc")
+                      (commit commit)))
+                (sha256
+                 (base32 "00zgrd8sy7449hycr6429flv2ivddndbjvz0bi62sjalqyy7f3w7"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       '(#:out-of-source? #t
+         #:configure-flags '("--host=avr")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-shebangs
+             (lambda _
+               (substitute* "devtools/gen-avr-lib-tree.sh"
+                 (("#! /bin/sh") (string-append "#!" (which "sh"))))
+               (substitute* "devtools/mlib-gen.py"
+                 (("#!/usr/bin/env python") (string-append "#!" (which "python3")))))))))
+      (native-inputs `(("avr-binutils" ,(make-avr-binutils))
+                       ("avr-gcc" ,(make-avr-gcc #:xgcc gcc))
+                       ("python" ,python)
+                       ("automake" ,automake)
+                       ("autoconf" ,autoconf)))
+      (home-page "https://www.nongnu.org/avr-libc/")
+      (synopsis "The AVR C Library")
+      (description
+       "AVR Libc is a project whose goal is to provide a high quality C library
 for use with GCC on Atmel AVR microcontrollers.")
-    (license
-     (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))
+      (license
+       (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt")))))
 
 (define make-avr-libc
   (memoize make-avr-libc/implementation))

base-commit: 3778f778c37110460dd78088200cbd05eb0c49e4
-- 
2.41.0