blob: 383fec786b916cd3d9bd0b9e08fd5e09d8a8bf81 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
{ stdenv
, fetchFromGitHub
, fetchpatch
, callPackage
, gnat
, zlib
, llvm
, lib
, backend ? "mcode"
}:
assert backend == "mcode" || backend == "llvm";
stdenv.mkDerivation rec {
pname = "ghdl-${backend}";
version = "2.0.0";
src = fetchFromGitHub {
owner = "ghdl";
repo = "ghdl";
rev = "v${version}";
sha256 = "sha256-B/G3FGRzYy4Y9VNNB8yM3FohiIjPJhYSVbqsTN3cL5k=";
};
patches = [
# https://github.com/ghdl/ghdl/issues/2056
(fetchpatch {
name = "fix-build-gcc-12.patch";
url = "https://github.com/ghdl/ghdl/commit/f8b87697e8b893b6293ebbfc34670c32bfb49397.patch";
hash = "sha256-tVbMm8veFkNPs6WFBHvaic5Jkp1niyg0LfFufa+hT/E=";
})
];
LIBRARY_PATH = "${stdenv.cc.libc}/lib";
nativeBuildInputs = [
gnat
];
buildInputs = [
zlib
] ++ lib.optional (backend == "llvm") [
llvm
];
propagatedBuildInputs = [
] ++ lib.optionals (backend == "llvm") [
zlib
];
preConfigure = ''
# If llvm 7.0 works, 7.x releases should work too.
sed -i 's/check_version 7.0/check_version 7/g' configure
'';
configureFlags = [
# See https://github.com/ghdl/ghdl/pull/2058
"--disable-werror"
"--enable-synth"
] ++ lib.optionals (backend == "llvm") [
"--with-llvm-config=${llvm.dev}/bin/llvm-config"
];
hardeningDisable = [ "format" ];
enableParallelBuilding = true;
passthru = {
# run with either of
# nix-build -A ghdl-mcode.passthru.tests
# nix-build -A ghdl-llvm.passthru.tests
tests = {
simple = callPackage ./test-simple.nix { inherit backend; };
};
};
meta = with lib; {
homepage = "https://github.com/ghdl/ghdl";
description = "VHDL 2008/93/87 simulator";
maintainers = with maintainers; [ lucus16 thoughtpolice ];
platforms = platforms.linux;
license = licenses.gpl2;
};
}
|