diff mbox

gnu: avr: Use the correct gcc version as native-input. This makes crtatmega32u4.o etc appear in the output.

Message ID 20160815104528.31090-1-dannym@scratchpost.org
State New
Headers show

Commit Message

Danny Milosavljevic Aug. 15, 2016, 10:45 a.m. UTC
See also <http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2475>, <http://svn.savannah.nongnu.org/viewvc/trunk/avr-libc/libc/misc/Rules.am?root=avr-libc&r1=2475&r2=2474&pathrev=2475>.

The easy fix would have been to pass "--enable-device-lib" to libc's configure.
The right fix: use the right gcc as native input.

* gnu/packages/avr.scm (avr-libc): Replace package by function.
* gnu/packages/avr.scm (avr-toolchain): Use new avr-libc function.
---
 gnu/packages/avr.scm | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

Comments

David Thompson Aug. 15, 2016, 11:34 a.m. UTC | #1
On Mon, Aug 15, 2016 at 6:45 AM, Danny Milosavljevic
<dannym@scratchpost.org> wrote:
>
> See also <http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2475>, <http://svn.savannah.nongnu.org/viewvc/trunk/avr-libc/libc/misc/Rules.am?root=avr-libc&r1=2475&r2=2474&pathrev=2475>.
>
> The easy fix would have been to pass "--enable-device-lib" to libc's configure.
> The right fix: use the right gcc as native input.
>
> * gnu/packages/avr.scm (avr-libc): Replace package by function.
> * gnu/packages/avr.scm (avr-toolchain): Use new avr-libc function.

Ah, good catch!  LGTM.

Could someone with commit access apply this?  I'm currently unable to do it.

- Dave
Leo Famulari Aug. 15, 2016, 6:48 p.m. UTC | #2
On Mon, Aug 15, 2016 at 07:34:19AM -0400, Thompson, David wrote:
> On Mon, Aug 15, 2016 at 6:45 AM, Danny Milosavljevic
> <dannym@scratchpost.org> wrote:
> >
> > See also <http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2475>, <http://svn.savannah.nongnu.org/viewvc/trunk/avr-libc/libc/misc/Rules.am?root=avr-libc&r1=2475&r2=2474&pathrev=2475>.
> >
> > The easy fix would have been to pass "--enable-device-lib" to libc's configure.
> > The right fix: use the right gcc as native input.
> >
> > * gnu/packages/avr.scm (avr-libc): Replace package by function.
> > * gnu/packages/avr.scm (avr-toolchain): Use new avr-libc function.
> 
> Ah, good catch!  LGTM.
> 
> Could someone with commit access apply this?  I'm currently unable to do it.

Pushed as 4d2470b0efb.
diff mbox

Patch

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 9873477..fd18ff6 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -73,7 +73,7 @@ 
     (version (package-version gcc-5))
     (source (package-source gcc-5))))
 
-(define-public avr-libc
+(define (avr-libc avr-gcc)
   (package
     (name "avr-libc")
     (version "2.0.0")
@@ -99,7 +99,7 @@ 
              (unsetenv "C_INCLUDE_PATH")
              #t)))))
     (native-inputs `(("avr-binutils" ,avr-binutils)
-                     ("avr-gcc" ,avr-gcc-4.9)))
+                     ("avr-gcc" ,avr-gcc)))
     (home-page "http://www.nongnu.org/avr-libc/")
     (synopsis "The AVR C Library")
     (description
@@ -109,24 +109,27 @@  for use with GCC on Atmel AVR microcontrollers.")
      (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))
 
 (define (avr-toolchain avr-gcc)
-  (package
-    (name "avr-toolchain")
-    (version (package-version avr-gcc))
-    (source #f)
-    (build-system trivial-build-system)
-    (arguments '(#:builder (mkdir %output)))
-    (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
+  ;; 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.
+  (let ((avr-libc (avr-libc avr-gcc)))
+    (package
+      (name "avr-toolchain")
+      (version (package-version avr-gcc))
+      (source #f)
+      (build-system trivial-build-system)
+      (arguments '(#:builder (mkdir %output)))
+      (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))))
+      (home-page (package-home-page avr-libc))
+      (license (package-license avr-gcc)))))
 
 (define-public avr-toolchain-4.9 (avr-toolchain avr-gcc-4.9))
 (define-public avr-toolchain-5 (avr-toolchain avr-gcc-5))