2023-02-02 18:25:31 +00:00
|
|
|
{ lib, stdenv, makeSetupHook, fetchFromGitHub, libelf, which, pkg-config, freeglut
|
2020-04-24 23:36:52 +00:00
|
|
|
, avrgcc, avrlibc
|
|
|
|
, libGLU, libGL
|
|
|
|
, GLUT }:
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
let
|
|
|
|
setupHookDarwin = makeSetupHook {
|
|
|
|
name = "darwin-avr-gcc-hook";
|
|
|
|
substitutions = {
|
|
|
|
darwinSuffixSalt = stdenv.cc.suffixSalt;
|
|
|
|
avrSuffixSalt = avrgcc.suffixSalt;
|
|
|
|
};
|
|
|
|
} ./setup-hook-darwin.sh;
|
|
|
|
in stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "simavr";
|
2021-10-01 09:20:50 +00:00
|
|
|
version = "1.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "buserror";
|
|
|
|
repo = "simavr";
|
2021-10-01 09:20:50 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0njz03lkw5374x1lxrq08irz4b86lzj2hibx46ssp7zv712pq55q";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"PREFIX="
|
|
|
|
"AVR_ROOT=${avrlibc}/avr"
|
|
|
|
"SIMAVR_VERSION=${version}"
|
|
|
|
"AVR=avr-"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ which pkg-config avrgcc ]
|
|
|
|
++ lib.optional stdenv.isDarwin setupHookDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ libelf freeglut libGLU libGL ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optional stdenv.isDarwin GLUT;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
# remove forbidden references to $TMPDIR
|
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
|
|
|
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/*
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkTarget = "-C tests run_tests";
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A lean and mean Atmel AVR simulator";
|
|
|
|
homepage = "https://github.com/buserror/simavr";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ goodrone ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|