simavr: fix build for separate avr toolchain

This commit is contained in:
Maximilian Güntner 2017-09-05 13:54:14 +02:00
parent 414f5eff2d
commit b22718d51c
No known key found for this signature in database
GPG Key ID: 5D667E0FD0397CFF

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, avrgcclibc, libelf, which, git, pkgconfig, freeglut
{ stdenv, fetchFromGitHub, avrbinutils, avrgcc, avrlibc, libelf, which, git, pkgconfig, freeglut
, mesa }:
stdenv.mkDerivation rec {
@ -15,9 +15,14 @@ stdenv.mkDerivation rec {
# ld: cannot find -lsimavr
enableParallelBuilding = false;
buildFlags = "AVR_ROOT=${avrgcclibc}/avr SIMAVR_VERSION=${version}";
preConfigure = ''
substituteInPlace Makefile.common --replace "-I../simavr/sim/avr -I../../simavr/sim/avr" \
"-I${avrlibc}/avr/include -L${avrlibc}/avr/lib/avr5 -B${avrlibc}/avr/lib -I../simavr/sim/avr -I../../simavr/sim/avr"
'';
buildFlags = "AVR_ROOT=${avrlibc}/avr SIMAVR_VERSION=${version}";
installFlags = buildFlags + " DESTDIR=$(out)";
# Hack to avoid TMPDIR in RPATHs.
preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
@ -26,7 +31,7 @@ stdenv.mkDerivation rec {
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
'';
buildInputs = [ which git avrgcclibc libelf pkgconfig freeglut mesa ];
buildInputs = [ which git avrbinutils avrgcc avrlibc libelf pkgconfig freeglut mesa ];
meta = with stdenv.lib; {
description = "A lean and mean Atmel AVR simulator";