summary refs log tree commit diff
path: root/pkgs/development/tools/simavr/default.nix
blob: b7490d4108d569ae9abf6834feca8d8711421917 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ lib, stdenv, fetchFromGitHub, libelf, which, pkg-config, freeglut
, avrgcc, avrlibc
, libGLU, libGL
, GLUT }:

stdenv.mkDerivation rec {
  pname = "simavr";
  version = "1.7";

  src = fetchFromGitHub {
    owner = "buserror";
    repo = "simavr";
    rev = "v${version}";
    sha256 = "0njz03lkw5374x1lxrq08irz4b86lzj2hibx46ssp7zv712pq55q";
  };

  makeFlags = [
    "DESTDIR=$(out)"
    "PREFIX="
    "AVR_ROOT=${avrlibc}/avr"
    "SIMAVR_VERSION=${version}"
    "AVR=avr-"
  ];

  NIX_CFLAGS_COMPILE = [ "-Wno-error=stringop-truncation" ];

  nativeBuildInputs = [ which pkg-config avrgcc ];
  buildInputs = [ libelf freeglut libGLU libGL ]
    ++ lib.optional stdenv.isDarwin GLUT;

  # Hack to avoid TMPDIR in RPATHs.
  preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';

  doCheck = true;
  checkTarget = "-C tests run_tests";

  meta = with lib; {
    description = "A lean and mean Atmel AVR simulator";
    homepage    = "https://github.com/buserror/simavr";
    license     = licenses.gpl3;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ goodrone ];
  };

}