Merge pull request #194947 from doronbehar/pkg/ghdl

This commit is contained in:
Doron Behar 2022-10-08 13:37:57 +00:00 committed by GitHub
commit 3bec3e2789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 20 deletions

View File

@ -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" ];

View File

@ -1,21 +1,34 @@
{ stdenv, lib, fetchFromGitHub, pkg-config
, yosys, readline, zlib, ghdl
{ stdenv
, lib
, fetchFromGitHub
, pkg-config
, yosys
, readline
, zlib
, ghdl
}:
stdenv.mkDerivation {
pname = "yosys-ghdl";
version = "2021.01.25";
plugin = "ghdl";
# This is not the latest commit, but it's the latest that builds with current stable ghdl 2.0.0
version = "2022.01.11";
src = fetchFromGitHub {
owner = "ghdl";
repo = "ghdl-yosys-plugin";
rev = "cba859cacf8c6631146dbdaa0f297c060b5a68cd";
sha256 = "01d9wb7sqkmkf2y9bnn3pmhy08khzs5m1d06whxsiwgwnjzfk9mx";
rev = "c9b05e481423c55ffcbb856fd5296701f670808c";
sha256 = "sha256-tT2+DXUtbJIBzBUBcyG2sz+3G+dTkciLVIczcRPr0Jw=";
};
buildInputs = [ yosys readline zlib ghdl ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
yosys
readline
zlib
ghdl
];
nativeBuildInputs = [
pkg-config
];
doCheck = true;
installPhase = ''
@ -25,6 +38,7 @@ stdenv.mkDerivation {
meta = with lib; {
description = "GHDL plugin for Yosys";
homepage = "https://github.com/ghdl/ghdl-yosys-plugin";
license = licenses.isc;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice ];