Paste number 313288: guix avr

Paste number 313288: guix avr
Pasted by: davexunit
When:5 years, 7 months ago
Share:Tweet this! | http://paste.lisp.org/+6PQG
Channel:None
Paste contents:
Raw Source | XML | Display As
From 523103362c3e66ebd46a94b46fff09f2ffb808da Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson@vistahigherlearning.com>
Date: Tue, 5 Apr 2016 12:12:48 -0400
Subject: [PATCH] wip AVR stuff

---
 gnu/packages/avr.scm | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index d59816b..1371f53 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -19,6 +19,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)
@@ -27,6 +28,43 @@
   #:use-module (gnu packages vim)
   #:use-module (gnu packages zip))
 
+(define-public avr-binutils
+  (package
+    (inherit (cross-binutils "avr"))
+    (name "avr-binutils")
+    (arguments
+     '(#:configure-flags '("--target=avr"
+                           "--disable-nls")))))
+
+(define-public avr-gcc
+  (let ((base-gcc (cross-gcc "avr" avr-binutils)))
+    (package
+      (inherit base-gcc)
+      (name "avr-gcc")
+      (arguments
+       (substitute-keyword-arguments (package-arguments base-gcc)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'fix-genmultilib
+               (lambda _
+                 (substitute* "gcc/genmultilib"
+                   (("#!/bin/sh") (string-append "#!" (which "sh"))))
+                 #t))))
+         ((#:configure-flags flags)
+          `(cons* "--target=avr"
+                  "--enable-languages=c,c++"
+                  "--disable-nls"
+                  "--disable-libssp"
+                  "--with-dwarf2"
+                  (delete "--disable-multilib" ,flags)))))
+      (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")
@@ -41,17 +79,18 @@
                 "0sd9qkvhmk9av4g1f8dsjwc309hf1g0731bhvicnjb3b3d42l1n3"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:out-of-source? #t
+     '(#:out-of-source? #t
        #:configure-flags '("--host=avr")))
-
-    (native-inputs `(("cross-binutils" ,(cross-binutils "avr"))
-                     ("cross-gcc" ,xgcc-avr)))
+    (native-inputs `(("avr-binutils" ,avr-binutils)
+                     ("avr-gcc" ,avr-gcc)
+                     ("libc" ,(cross-libc "i686-linux"))))
     (home-page "http://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-public microscheme
   (package
-- 
2.7.3

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.