summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/avr.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 3276de765b..fd51f074f2 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -20,6 +20,7 @@
 
 (define-module (gnu packages avr)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
@@ -33,6 +34,35 @@
     (inherit (cross-binutils "avr"))
     (name "avr-binutils")))
 
+(define-public avr-gcc-4.9
+  (let ((xgcc (cross-gcc "avr" avr-binutils)))
+    (package
+      (inherit xgcc)
+      (name "avr-gcc")
+      (arguments
+       (substitute-keyword-arguments (package-arguments xgcc)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             ;; 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"))))
+                 #t))))
+         ((#:configure-flags flags)
+          `(delete "--disable-multilib" ,flags))))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "CROSS_CPATH")
+              (files '("avr/include")))
+             (search-path-specification
+              (variable "CROSS_LIBRARY_PATH")
+              (files '("avr/lib"))))))))
+
 (define-public avr-libc
   (package
     (name "avr-libc")