2015-02-22 11:02:09 +01:00
|
|
|
{ stdenv, fetchurl, texinfo, gmp, mpfr, libmpc, zlib }:
|
2010-07-28 20:01:17 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2009-02-17 13:56:35 +01:00
|
|
|
name = "avr-gcc-libc";
|
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
srcs = [
|
|
|
|
(fetchurl {
|
|
|
|
url = "mirror://gnu/binutils/binutils-2.25.tar.bz2";
|
|
|
|
sha256 = "08r9i26b05zcwb9zxb6zllpfdiiicdfsgbpsjlrjmvx3rxjzrpi2";
|
|
|
|
})
|
2012-12-23 17:20:34 +01:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
(fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-4.8.4/gcc-4.8.4.tar.bz2";
|
|
|
|
sha256 = "4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695";
|
|
|
|
})
|
2009-02-17 13:56:35 +01:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
(fetchurl {
|
|
|
|
url = http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.8.1.tar.bz2;
|
|
|
|
sha256 = "0sd9qkvhmk9av4g1f8dsjwc309hf1g0731bhvicnjb3b3d42l1n3";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
2011-08-23 09:56:34 +02:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
nativeBuildInputs = [ texinfo ];
|
|
|
|
|
|
|
|
buildInputs = [ gmp mpfr libmpc zlib ];
|
|
|
|
|
|
|
|
# Make sure we don't strip the libraries in lib/gcc/avr.
|
|
|
|
stripDebugList= [ "bin" "avr/bin" "libexec" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2009-02-17 13:56:35 +01:00
|
|
|
# important, without this gcc won't find the binutils executables
|
2015-02-22 11:02:09 +01:00
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
|
|
|
|
# Binutils.
|
|
|
|
pushd binutils-*/
|
|
|
|
mkdir obj-avr
|
|
|
|
cd obj-avr
|
|
|
|
../configure --target=avr --prefix="$out" --disable-nls --disable-debug --disable-dependency-tracking
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
popd
|
2009-02-17 13:56:35 +01:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
# GCC.
|
|
|
|
pushd gcc-*
|
|
|
|
mkdir obj-avr
|
|
|
|
cd obj-avr
|
|
|
|
../configure --target=avr --prefix="$out" --disable-nls --disable-libssp --with-dwarf2 --disable-install-libiberty --with-system-zlib --enable-languages=c,c++
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
popd
|
2009-02-17 13:56:35 +01:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
# We don't want avr-libc to use the native compiler.
|
|
|
|
export BUILD_CC=$CC
|
|
|
|
export BUILD_CXX=$CXX
|
|
|
|
unset CC
|
|
|
|
unset CXX
|
2009-02-17 13:56:35 +01:00
|
|
|
|
2015-02-22 11:02:09 +01:00
|
|
|
# AVR-libc.
|
|
|
|
pushd avr-libc-*
|
|
|
|
./configure --prefix="$out" --build=`./config.guess` --host=avr
|
|
|
|
make $MAKE_FLAGS
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2014-05-31 18:06:20 +02:00
|
|
|
meta = with stdenv.lib; {
|
2015-02-22 11:02:09 +01:00
|
|
|
description = "AVR development 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
|
|
|
|
platforms = platforms.linux;
|
2009-02-17 13:56:35 +01:00
|
|
|
};
|
|
|
|
}
|