forked from mirrors/nixpkgs
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
|
@ -5,13 +5,14 @@
|
|||
, fetchFromGitHub
|
||||
, flex
|
||||
, libffi
|
||||
, pkgconfig
|
||||
, pkg-config
|
||||
, protobuf
|
||||
, python3
|
||||
, readline
|
||||
, tcl
|
||||
, verilog
|
||||
, zlib
|
||||
, plugins ? []
|
||||
}:
|
||||
|
||||
# NOTE: as of late 2020, yosys has switched to an automation robot that
|
||||
|
@ -32,6 +33,8 @@
|
|||
# ultimately less confusing than using dates.
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit plugins;
|
||||
|
||||
pname = "yosys";
|
||||
version = "0.9+3830";
|
||||
|
||||
|
@ -43,21 +46,16 @@ stdenv.mkDerivation rec {
|
|||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ tcl readline libffi python3 bison flex protobuf zlib ];
|
||||
nativeBuildInputs = [ pkg-config protobuf flex bison python3 ];
|
||||
buildInputs = [ tcl readline libffi python3 protobuf zlib ];
|
||||
|
||||
makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
|
||||
|
||||
patchPhase = ''
|
||||
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}'
|
||||
substituteInPlace ./misc/yosys-config.in \
|
||||
--replace '/bin/bash' '${bash}/bin/bash'
|
||||
chmod +x ./misc/yosys-config.in
|
||||
patchShebangs ./misc/yosys-config.in
|
||||
patchShebangs tests
|
||||
'';
|
||||
|
||||
|
@ -76,8 +74,8 @@ stdenv.mkDerivation rec {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
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."
|
||||
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."
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
@ -94,7 +92,14 @@ stdenv.mkDerivation rec {
|
|||
# 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.
|
||||
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; {
|
||||
description = "Open RTL synthesis framework and tools";
|
||||
|
|
Loading…
Reference in a new issue