diff --git a/pkgs/development/compilers/ghdl/default.nix b/pkgs/development/compilers/ghdl/default.nix index 758b04a7101e..383fec786b91 100644 --- a/pkgs/development/compilers/ghdl/default.nix +++ b/pkgs/development/compilers/ghdl/default.nix @@ -1,40 +1,63 @@ -{ stdenv, fetchFromGitHub, fetchpatch, callPackage, gnat11, zlib, llvm, lib -, backend ? "mcode" }: +{ stdenv +, fetchFromGitHub +, fetchpatch +, callPackage +, gnat +, zlib +, llvm +, lib +, backend ? "mcode" +}: assert backend == "mcode" || backend == "llvm"; stdenv.mkDerivation rec { pname = "ghdl-${backend}"; - version = "1.0.0"; + version = "2.0.0"; src = fetchFromGitHub { owner = "ghdl"; repo = "ghdl"; rev = "v${version}"; - sha256 = "1gyh0xckwbzgslbpw9yrpj4gqs9fm1a2qpbzl0sh143fk1kwjlly"; + sha256 = "sha256-B/G3FGRzYy4Y9VNNB8yM3FohiIjPJhYSVbqsTN3cL5k="; }; patches = [ - # Allow compilation with GNAT 11, picked from master + # https://github.com/ghdl/ghdl/issues/2056 (fetchpatch { - name = "fix-gnat-11-compilation.patch"; - url = "https://github.com/ghdl/ghdl/commit/8356ea3bb4e8d0e5ad8638c3d50914b64fc360ec.patch"; - sha256 = "04pzn8g7xha8000wbjjmry6h1grfqyn3bjvj47hi4qwgl21wfjra"; + 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"; - buildInputs = [ gnat11 zlib ] ++ lib.optional (backend == "llvm") [ llvm ]; - propagatedBuildInputs = lib.optionals (backend == "llvm") [ zlib ]; + 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 = [ "--enable-synth" ] ++ lib.optional (backend == "llvm") - "--with-llvm-config=${llvm.dev}/bin/llvm-config"; + 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" ];