diff --git a/pkgs/development/misc/avr-gcc-with-avr-libc/avr-libc-fix-gcc-4.6.0.patch b/pkgs/development/misc/avr-gcc-with-avr-libc/avr-libc-fix-gcc-4.6.0.patch new file mode 100644 index 00000000000..e59e40091bf --- /dev/null +++ b/pkgs/development/misc/avr-gcc-with-avr-libc/avr-libc-fix-gcc-4.6.0.patch @@ -0,0 +1,29 @@ +# Patch from Gentoo + +diff -ur 1/include/avr/pgmspace.h 2/include/avr/pgmspace.h +--- 1/include/avr/pgmspace.h 2011-05-31 18:19:44.524000823 +0200 ++++ 2/include/avr/pgmspace.h 2011-05-31 18:20:27.576000824 +0200 +@@ -252,7 +252,7 @@ + # define PSTR(s) ((const PROGMEM char *)(s)) + #else /* !DOXYGEN */ + /* The real thing. */ +-# define PSTR(s) (__extension__({static char __c[] PROGMEM = (s); &__c[0];})) ++# define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) + #endif /* DOXYGEN */ + + #define __LPM_classic__(addr) \ +diff -ur 1/libc/stdlib/dtostre.c 2/libc/stdlib/dtostre.c +--- 1/libc/stdlib/dtostre.c 2011-05-31 18:19:44.639000823 +0200 ++++ 2/libc/stdlib/dtostre.c 2011-05-31 18:20:27.639000824 +0200 +@@ -37,9 +37,9 @@ + char * + dtostre (double val, char *sbeg, unsigned char prec, unsigned char flags) + { +- __attribute__((progmem)) static char str_nan[2][4] = ++ __attribute__((progmem)) static const char str_nan[2][4] = + {"nan", "NAN"}; +- __attribute__((progmem)) static char str_inf[2][sizeof(str_nan[0])] = ++ __attribute__((progmem)) static const char str_inf[2][sizeof(str_nan[0])] = + {"inf", "INF"}; + char *d; /* dst */ + char *s; /* src */ diff --git a/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix b/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix index 06063db491e..83e800faa2c 100644 --- a/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix +++ b/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix @@ -1,21 +1,23 @@ -{ stdenv, fetchurl, writeTextFile, coreutils, gnumake, gcc, gnutar, bzip2, gnugrep, gnused, gawk }: +{ stdenv, fetchurl, writeTextFile, coreutils, gnumake, gcc, gnutar, bzip2 + , gnugrep, gnused, gawk, diffutils, patch + , gmp, mpfr, mpc }: stdenv.mkDerivation { name = "avr-gcc-libc"; srcBinutils = fetchurl { - url = ftp://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2; - sha256 = "0pm20n2l9ddgdpgzk3zhnbb8nbyb4rb2kvcw21pkd6iwybk3rhz2"; + url = "mirror://gnu/binutils/binutils-2.21.tar.bz2"; + sha256 = "1iyhc42zfa0j2gaxy4zvpk47sdqj4rqvib0mb8597ss8yidyrav0"; }; srcGCC = fetchurl { - url = ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-core-4.1.2.tar.bz2; - sha256 = "07binc1hqlr0g387zrg5sp57i12yzd5ja2lgjb83bbh0h3gwbsbv"; + url = "mirror://gcc/releases/gcc-4.6.1/gcc-core-4.6.1.tar.bz2"; + sha256 = "0bbb8f754a31f29013f6e9ad4c755d92bb0f154a665c4b623e86ae7174d98e33"; }; srcAVRLibc = fetchurl { - url = http://www.very-clever.com/download/nongnu/avr-libc/avr-libc-1.4.5.tar.bz2; - sha256 = "058iv3vs6syy01pfkd5894xap9zakjx8ki1bpjdnihn6vk6fr80l"; + url = http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.7.1.tar.bz2; + sha256 = "1b1s4cf787izlm3r094vvkzrzb3w3bg6bwiz2wz71cg7q07kzzn6"; }; phases = "doAll"; @@ -24,7 +26,7 @@ stdenv.mkDerivation { builder = writeTextFile { name = "avrbinutilsgccavrlibc-builder-script"; text = '' - PATH=${coreutils}/bin:${gnumake}/bin:${gcc}/bin:${gnutar}/bin:${bzip2}/bin:${gnugrep}/bin:${gnused}/bin:${gawk}/bin + PATH=${coreutils}/bin:${gnumake}/bin:${gcc}/bin:${gnutar}/bin:${bzip2}/bin:${gnugrep}/bin:${gnused}/bin:${gawk}/bin:${diffutils}/bin:${patch}/bin # that's all a bit too hacky...! for i in `cat ${gcc}/nix-support/propagated-user-env-packages`; do echo adding $i @@ -33,6 +35,11 @@ stdenv.mkDerivation { mkdir -p "$out" export > env-vars + for i in "${gmp}" "${mpfr}" "${mpc}"; do + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$i/include " + export NIX_LDFLAGS="$NIX_LDFLAGS -L$i/lib " + done + # important, without this gcc won't find the binutils executables PATH=$PATH:$out/bin @@ -51,13 +58,14 @@ stdenv.mkDerivation { cd gcc-* mkdir obj-avr cd obj-avr - ../configure --target=avr --prefix="$prefix" --disable-nls --enable-languages=c --disable-libssp + ../configure --target=avr --prefix="$prefix" --disable-nls --enable-languages=c --disable-libssp --with-dwarf2 make $MAKE_FLAGS make install cd $TMP tar jxf $srcAVRLibc cd avr-libc-* + patch -Np1 -i ${./avr-libc-fix-gcc-4.6.0.patch} ./configure --prefix="$prefix" --build=`./config.guess` --host=avr make $MAKE_FLAGS make install diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3183fbc391..853e67dc5e8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2598,9 +2598,7 @@ let ### DEVELOPMENT / MISC - avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc { - gcc = gcc40; - }; + avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc {}; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { };