2010-07-28 20:01:17 +02:00
|
|
|
{ stdenv, fetchurl, writeTextFile, coreutils, gnumake, gcc, gnutar, bzip2, gnugrep, gnused, gawk }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2009-02-17 13:56:35 +01:00
|
|
|
name = "avr-gcc-libc";
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
srcBinutils = fetchurl {
|
2009-02-17 13:56:35 +01:00
|
|
|
url = ftp://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2;
|
|
|
|
sha256 = "0pm20n2l9ddgdpgzk3zhnbb8nbyb4rb2kvcw21pkd6iwybk3rhz2";
|
|
|
|
};
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
srcGCC = fetchurl {
|
2009-02-17 13:56:35 +01:00
|
|
|
url = ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-core-4.1.2.tar.bz2;
|
|
|
|
sha256 = "07binc1hqlr0g387zrg5sp57i12yzd5ja2lgjb83bbh0h3gwbsbv";
|
|
|
|
};
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
srcAVRLibc = fetchurl {
|
2009-02-17 13:56:35 +01:00
|
|
|
url = http://www.very-clever.com/download/nongnu/avr-libc/avr-libc-1.4.5.tar.bz2;
|
|
|
|
sha256 = "058iv3vs6syy01pfkd5894xap9zakjx8ki1bpjdnihn6vk6fr80l";
|
|
|
|
};
|
|
|
|
|
|
|
|
phases = "doAll";
|
|
|
|
|
|
|
|
# don't call any wired $buildInputs/nix-support/* scripts or such. This makes the build fail
|
2010-07-28 20:01:17 +02:00
|
|
|
builder = writeTextFile {
|
2009-02-17 13:56:35 +01:00
|
|
|
name = "avrbinutilsgccavrlibc-builder-script";
|
|
|
|
text = ''
|
2010-07-28 20:01:17 +02:00
|
|
|
PATH=${coreutils}/bin:${gnumake}/bin:${gcc}/bin:${gnutar}/bin:${bzip2}/bin:${gnugrep}/bin:${gnused}/bin:${gawk}/bin
|
2009-02-17 13:56:35 +01:00
|
|
|
# that's all a bit too hacky...!
|
2010-07-28 20:01:17 +02:00
|
|
|
for i in `cat ${gcc}/nix-support/propagated-user-env-packages`; do
|
2009-02-17 13:56:35 +01:00
|
|
|
echo adding $i
|
|
|
|
PATH=$PATH:$i/bin
|
|
|
|
done
|
|
|
|
mkdir -p "$out"
|
|
|
|
export > env-vars
|
|
|
|
|
|
|
|
# important, without this gcc won't find the binutils executables
|
|
|
|
PATH=$PATH:$out/bin
|
|
|
|
|
|
|
|
prefix=$out
|
|
|
|
|
|
|
|
tar jxf $srcBinutils
|
|
|
|
cd binutils-*/
|
|
|
|
mkdir obj-avr
|
|
|
|
cd obj-avr
|
|
|
|
../configure --target=avr --prefix="$prefix" --disable-nls --prefix=$prefix
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
tar jxf $srcGCC
|
|
|
|
cd gcc-*
|
|
|
|
mkdir obj-avr
|
|
|
|
cd obj-avr
|
|
|
|
../configure --target=avr --prefix="$prefix" --disable-nls --enable-languages=c --disable-libssp
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
tar jxf $srcAVRLibc
|
|
|
|
cd avr-libc-*
|
|
|
|
./configure --prefix="$prefix" --build=`./config.guess` --host=avr
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "avr gcc developement environment including binutils, avr-gcc and avr-libc";
|
|
|
|
# I've tried compiling the packages separately.. too much hassle. This just works. Fine.
|
|
|
|
license = ["GPL" "LGPL"]; # see single packages ..
|
|
|
|
homepage = []; # dito
|
|
|
|
};
|
|
|
|
}
|