Skip to content

Commit

Permalink
avr-*: split avr-gcc-libc into separate packages
Browse files Browse the repository at this point in the history
- avr-gcc 5.3.0 -> 5.4.0

closes #28220

Since the packages do not share a common prefix anymore, you need
to define the current store paths in your project's Makefile.

Example for an atmega644 build:

CFLAGS += -I /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/include
CFLAGS += -B /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/lib/avr5
CFLAGS += -L /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/lib/avr5
CFLAGS += -L /nix/store/8409dj9js4i5901i63275wxdm783l0p6-avr-gcc-5.4.0/lib/gcc/avr/5.4.0/avr5
  • Loading branch information
mguentner committed Sep 5, 2017
1 parent c23654b commit 6a458c1
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 77 deletions.
76 changes: 0 additions & 76 deletions pkgs/development/misc/avr-gcc-with-avr-libc/default.nix

This file was deleted.

22 changes: 22 additions & 0 deletions pkgs/development/misc/avr/binutils/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ stdenv, fetchurl }:

let
version = "2.26";
in
stdenv.mkDerivation {
name = "avr-binutils-${version}";

src = fetchurl {
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
sha256 = "1ngc2h3knhiw8s22l8y6afycfaxr5grviqy7mwvm4bsl14cf9b62";
};
configureFlags = "--target=avr --enable-languages=c,c++";

meta = with stdenv.lib; {
description = "the GNU Binutils for AVR microcontrollers";
homepage = http://www.gnu.org/software/binutils/;
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ mguentner ];
};
}
50 changes: 50 additions & 0 deletions pkgs/development/misc/avr/gcc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ stdenv, fetchurl, gmp, mpfr, libmpc, zlib, avrbinutils, texinfo }:

let
version = "5.4.0";
in
stdenv.mkDerivation {

name = "avr-gcc-${version}";
src = fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.bz2";
sha256 = "0fihlcy5hnksdxk0sn6bvgnyq8gfrgs8m794b1jxwd1dxinzg3b0";
};

buildInputs = [ gmp mpfr libmpc zlib avrbinutils ];

nativeBuildInputs = [ texinfo ];

hardeningDisable = [ "format" ];

stripDebugList= [ "bin" "libexec" ];

enableParallelBuilding = true;

configurePhase = ''
mkdir gcc-build
cd gcc-build
../configure \
--prefix=$out \
--host=$CHOST \
--build=$CHOST \
--target=avr \
--with-as=${avrbinutils}/bin/avr-as \
--with-gnu-as \
--with-gnu-ld \
--with-ld=${avrbinutils}/bin/avr-ld \
--with-system-zlib \
--disable-install-libiberty \
--disable-nls \
--disable-libssp \
--with-dwarf2 \
--enable-languages=c,c++'';

meta = with stdenv.lib; {
description = "GNU Compiler Collection, version ${version} for AVR microcontrollers";
homepage = http://gcc.gnu.org;
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ mguentner ];
};
}
38 changes: 38 additions & 0 deletions pkgs/development/misc/avr/libc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ stdenv, fetchurl, avrgcc, avrbinutils, automake, autoconf }:

let
version = "2.0.0";
in
stdenv.mkDerivation {
name = "avr-libc-${version}";

src = fetchurl {
url = http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2;
sha256 = "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj";
};

buildInputs = [ avrgcc avrbinutils automake autoconf ];
configurePhase = ''
unset LD
unset AS
unset AR
unset CC
unset CXX
unset RANLIB
unset STRIP
./configure --prefix=$out --build=$(./config.guess) --host=avr
'';

# Make sure we don't strip the libraries in lib/gcc/avr.
stripDebugList= "bin";
dontPatchELF = true;

meta = with stdenv.lib; {
description = "a C runtime library for AVR microcontrollers";
homepage = http://savannah.nongnu.org/projects/avr-libc/;
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ mguentner ];
};
}
8 changes: 7 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6587,7 +6587,13 @@ with pkgs;
samples = true;
};

avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc {};
avrgcclibc = throw "avrgcclibs are now separate packages, install avrbinutils, avrgcc and avrlibc";

avrbinutils = callPackage ../development/misc/avr/binutils {};

avrgcc = callPackage ../development/misc/avr/gcc {};

avrlibc = callPackage ../development/misc/avr/libc {};

avr8burnomat = callPackage ../development/misc/avr8-burn-omat { };

Expand Down

0 comments on commit 6a458c1

Please sign in to comment.