nixpkgs/pkgs/development/compilers/ghdl/default.nix

51 lines
1.4 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, callPackage, gnat, zlib, llvm, lib
2019-06-02 21:40:01 +00:00
, backend ? "mcode" }:
assert backend == "mcode" || backend == "llvm";
stdenv.mkDerivation rec {
pname = "ghdl-${backend}";
2021-02-10 09:04:28 +00:00
version = "1.0.0";
2019-06-02 21:40:01 +00:00
src = fetchFromGitHub {
owner = "ghdl";
repo = "ghdl";
2021-02-10 09:04:28 +00:00
rev = "v${version}";
sha256 = "1gyh0xckwbzgslbpw9yrpj4gqs9fm1a2qpbzl0sh143fk1kwjlly";
2019-06-02 21:40:01 +00:00
};
LIBRARY_PATH = "${stdenv.cc.libc}/lib";
2021-02-10 09:04:28 +00:00
buildInputs = [ gnat zlib ] ++ lib.optional (backend == "llvm") [ llvm ];
propagatedBuildInputs = lib.optionals (backend == "llvm") [ zlib ];
2019-06-02 21:40:01 +00:00
preConfigure = ''
# If llvm 7.0 works, 7.x releases should work too.
2021-02-10 09:04:28 +00:00
sed -i 's/check_version 7.0/check_version 7/g' configure
2019-06-02 21:40:01 +00:00
'';
configureFlags = [ "--enable-synth" ] ++ lib.optional (backend == "llvm")
2021-05-12 08:51:11 +00:00
"--with-llvm-config=${llvm.dev}/bin/llvm-config";
2019-06-02 21:40:01 +00:00
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; };
};
};
2019-06-02 21:40:01 +00:00
meta = with lib; {
homepage = "https://github.com/ghdl/ghdl";
description = "VHDL 2008/93/87 simulator";
maintainers = with maintainers; [ lucus16 thoughtpolice ];
2019-06-02 21:40:01 +00:00
platforms = platforms.linux;
license = licenses.gpl2;
};
}