Subject: [PATCH 12/23] gnu: Remove various AVR packages.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Fri, 29 Sep 2023 11:16:16 +0200

* gnu/packages/avr.scm (avr-gcc): Remove variable.
  (avr-libc): Ditto.
  (avr-toolchain): Ditto.
---
 gnu/packages/avr.scm | 92 +++-----------------------------------------
 1 file changed, 6 insertions(+), 86 deletions(-)

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 97873a8691..e9b8e2b064 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -23,72 +23,16 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages avr)
-  #:use-module ((guix licenses) #:prefix license:)
-  #:use-module (guix gexp)
-  #:use-module (guix utils)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages cross-base)
+  #:use-module (guix build-system gnu)
   #:use-module (guix download)
-  #:use-module (guix git-download)
+  #:use-module (guix gexp)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
-  #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial)
-  #:use-module (gnu packages check)
-  #:use-module (gnu packages cross-base)
-  #:use-module (gnu packages flashing-tools)
-  #:use-module (gnu packages gcc)
+  #:use-module (guix utils)
   #:export (make-avr-libc))
 
-(define avr-gcc
-  (let ((xgcc (cross-gcc "avr" #:xbinutils avr-binutils)))
-    (package
-      (inherit xgcc)
-      (name "avr-gcc")
-      (arguments
-       (substitute-keyword-arguments (package-arguments xgcc)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
-                (lambda* (#:key inputs #:allow-other-keys)
-                  (let ((gcc (assoc-ref inputs  "gcc")))
-                    ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
-                    ;; prevent header conflict with the GCC from native-inputs.
-                    (setenv "CPLUS_INCLUDE_PATH"
-                            (string-join
-                             (delete (string-append gcc "/include/c++")
-                                     (string-split (getenv "CPLUS_INCLUDE_PATH")
-                                                   #\:))
-                             ":"))
-                    (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"))))))))))
-      (native-search-paths
-       (list (search-path-specification
-              (variable "CROSS_C_INCLUDE_PATH")
-              (files '("avr/include")))
-             (search-path-specification
-              (variable "CROSS_CPLUS_INCLUDE_PATH")
-              (files '("avr/include")))
-             (search-path-specification
-              (variable "CROSS_OBJC_INCLUDE_PATH")
-              (files '("avr/include")))
-             (search-path-specification
-              (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
-              (files '("avr/include")))
-             (search-path-specification
-              (variable "CROSS_LIBRARY_PATH")
-              (files '("avr/lib")))))
-      (native-inputs
-       `(("gcc" ,gcc)
-         ,@(package-native-inputs xgcc))))))
-
 (define* (make-avr-libc #:key
                         (xbinutils (cross-binutils "avr"))
                         (xgcc (cross-gcc "avr")))
@@ -117,27 +61,3 @@ (define* (make-avr-libc #:key
 for use with GCC on Atmel AVR microcontrollers.")
     (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.
-  (package
-    (name "avr-toolchain")
-    (version (package-version avr-gcc))
-    (source #f)
-    (build-system trivial-build-system)
-    (arguments '(#:builder (begin (mkdir %output) #t)))
-    (propagated-inputs
-     `(("avrdude" ,avrdude)
-       ("binutils" ,avr-binutils)
-       ("gcc" ,avr-gcc)
-       ("libc" ,avr-libc)))
-    (synopsis "Complete GCC tool chain for AVR microcontroller development")
-    (description "This package provides a complete GCC tool chain for AVR
-microcontroller development.  This includes the GCC AVR cross compiler and
-avrdude for firmware flashing.  The supported programming languages are C and
-C++.")
-    (home-page (package-home-page avr-libc))
-    (license (package-license avr-gcc))))
-- 
2.34.1