2017-09-05 12:54:14 +01:00
|
|
|
{ stdenv, fetchFromGitHub, avrbinutils, avrgcc, avrlibc, libelf, which, git, pkgconfig, freeglut
|
2018-02-24 13:12:44 +00:00
|
|
|
, libGLU_combined }:
|
2016-05-24 22:18:03 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "simavr-${version}";
|
2017-03-01 17:01:40 +00:00
|
|
|
version = "1.5";
|
2016-05-24 22:18:03 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "buserror";
|
|
|
|
repo = "simavr";
|
2017-03-01 17:01:40 +00:00
|
|
|
rev = "e0d4de41a72520491a4076b3ed87beb997a395c0";
|
|
|
|
sha256 = "0b2lh6l2niv80dmbm9xkamvnivkbmqw6v97sy29afalrwfxylxla";
|
2016-05-24 22:18:03 +01:00
|
|
|
};
|
|
|
|
|
2017-03-09 23:57:23 +00:00
|
|
|
# ld: cannot find -lsimavr
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2017-09-05 12:54:14 +01:00
|
|
|
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}";
|
2016-05-24 22:18:03 +01:00
|
|
|
installFlags = buildFlags + " DESTDIR=$(out)";
|
|
|
|
|
2017-09-05 12:54:14 +01:00
|
|
|
|
2017-05-18 10:39:00 +01:00
|
|
|
# Hack to avoid TMPDIR in RPATHs.
|
|
|
|
preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
|
|
|
|
|
2016-05-24 22:18:03 +01:00
|
|
|
postFixup = ''
|
|
|
|
target="$out/bin/simavr"
|
|
|
|
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
|
|
|
'';
|
|
|
|
|
2017-09-05 22:26:13 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2018-02-24 13:12:44 +00:00
|
|
|
buildInputs = [ which git avrbinutils avrgcc avrlibc libelf freeglut libGLU_combined ];
|
2016-05-24 22:18:03 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A lean and mean Atmel AVR simulator";
|
|
|
|
homepage = https://github.com/buserror/simavr;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ goodrone ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|