yosys: Added plugins support and various fixes
* fixed buildInputs and nativeBuildInputs for cross compilation * don't use pkgconfig alias * simplified patchPhase * made the version variable overridable in preBuild
This commit is contained in:
parent
d8c2a4f718
commit
d81e4d9f66
1 changed files with 18 additions and 13 deletions
|
@ -5,13 +5,14 @@
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, flex
|
, flex
|
||||||
, libffi
|
, libffi
|
||||||
, pkgconfig
|
, pkg-config
|
||||||
, protobuf
|
, protobuf
|
||||||
, python3
|
, python3
|
||||||
, readline
|
, readline
|
||||||
, tcl
|
, tcl
|
||||||
, verilog
|
, verilog
|
||||||
, zlib
|
, zlib
|
||||||
|
, plugins ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# NOTE: as of late 2020, yosys has switched to an automation robot that
|
# NOTE: as of late 2020, yosys has switched to an automation robot that
|
||||||
|
@ -32,6 +33,8 @@
|
||||||
# ultimately less confusing than using dates.
|
# ultimately less confusing than using dates.
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
inherit plugins;
|
||||||
|
|
||||||
pname = "yosys";
|
pname = "yosys";
|
||||||
version = "0.9+3830";
|
version = "0.9+3830";
|
||||||
|
|
||||||
|
@ -43,21 +46,16 @@ stdenv.mkDerivation rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkg-config protobuf flex bison python3 ];
|
||||||
buildInputs = [ tcl readline libffi python3 bison flex protobuf zlib ];
|
buildInputs = [ tcl readline libffi python3 protobuf zlib ];
|
||||||
|
|
||||||
makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
|
makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
|
||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
substituteInPlace ./Makefile \
|
substituteInPlace ./Makefile \
|
||||||
--replace 'CXX = clang' "" \
|
|
||||||
--replace 'LD = clang++' 'LD = $(CXX)' \
|
|
||||||
--replace 'CXX = gcc' "" \
|
|
||||||
--replace 'LD = gcc' 'LD = $(CXX)' \
|
|
||||||
--replace 'ABCMKARGS = CC="$(CXX)" CXX="$(CXX)"' 'ABCMKARGS =' \
|
|
||||||
--replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}'
|
--replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}'
|
||||||
substituteInPlace ./misc/yosys-config.in \
|
chmod +x ./misc/yosys-config.in
|
||||||
--replace '/bin/bash' '${bash}/bin/bash'
|
patchShebangs ./misc/yosys-config.in
|
||||||
patchShebangs tests
|
patchShebangs tests
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -76,8 +74,8 @@ stdenv.mkDerivation rec {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "YOSYS_VER := ${version}" Makefile; then
|
if ! grep -q "YOSYS_VER := $version" Makefile; then
|
||||||
echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package (${version}), failing."
|
echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package ($version), failing."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
@ -94,7 +92,14 @@ stdenv.mkDerivation rec {
|
||||||
# add a symlink to fake things so that both variants work the same way. this
|
# add a symlink to fake things so that both variants work the same way. this
|
||||||
# is also needed at build time for the test suite.
|
# is also needed at build time for the test suite.
|
||||||
postBuild = "ln -sfv ${abc-verifier}/bin/abc ./yosys-abc";
|
postBuild = "ln -sfv ${abc-verifier}/bin/abc ./yosys-abc";
|
||||||
postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc";
|
postInstall = ''
|
||||||
|
ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc
|
||||||
|
|
||||||
|
mkdir -p $out/share/yosys/plugins
|
||||||
|
for plugin in $plugins; do
|
||||||
|
ln -sfv $plugin/share/yosys/plugins/* $out/share/yosys/plugins/
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Open RTL synthesis framework and tools";
|
description = "Open RTL synthesis framework and tools";
|
||||||
|
|
Loading…
Reference in a new issue