@@ -1,4 +1,4 @@
1−{ stdenv
1+{ stdenv, lib
22, abc-verifier
33, bash
44, bison
@@ -12,7 +12,6 @@
1212, tcl
1313, verilog
1414, zlib
15−, plugins ? []
1615}:
1716
1817# NOTE: as of late 2020, yosys has switched to an automation robot that
@@ -33,8 +32,6 @@
3332# ultimately less confusing than using dates.
3433
3534stdenv.mkDerivation rec {
36− inherit plugins;
37−
3835 pname = "yosys";
3936 version = "0.9+3830";
4037
@@ -46,17 +43,21 @@ stdenv.mkDerivation rec {
4643 };
4744
4845 enableParallelBuilding = true;
49− nativeBuildInputs = [ pkg-config protobuf flex bison python3 ];
46+ nativeBuildInputs = [ pkg-config bison flex ];
5047 buildInputs = [ tcl readline libffi python3 protobuf zlib ];
5148
5249 makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
5350
54− patchPhase = ''
51+ patches = [
52+ ./plugin-search-dirs.patch
53+ ];
54+
55+ postPatch = ''
5556 substituteInPlace ./Makefile \
5657 --replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}'
58+
5759 chmod +x ./misc/yosys-config.in
58− patchShebangs ./misc/yosys-config.in
59− patchShebangs tests
60+ patchShebangs tests ./misc/yosys-config.in
6061 '';
6162
6263 preBuild = let
@@ -75,7 +76,7 @@ stdenv.mkDerivation rec {
7576 fi
7677
7778 if ! grep -q "YOSYS_VER := $version" Makefile; then
78− echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package ($version), failing."
79+ echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package (${version}), failing."
7980 exit 1
8081 fi
8182 '';
@@ -92,16 +93,11 @@ stdenv.mkDerivation rec {
9293 # add a symlink to fake things so that both variants work the same way. this
9394 # is also needed at build time for the test suite.
9495 postBuild = "ln -sfv ${abc-verifier}/bin/abc ./yosys-abc";
95− postInstall = ''
96− ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc
96+ postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc";
9797
98− mkdir -p $out/share/yosys/plugins
99− for plugin in $plugins; do
100− ln -sfv $plugin/share/yosys/plugins/* $out/share/yosys/plugins/
101− done
102− '';
98+ setupHook = ./setup-hook.sh;
10399
104− meta = with stdenv.lib; {
100+ meta = with lib; {
105101 description = "Open RTL synthesis framework and tools";
106102 homepage = "http://www.clifford.at/yosys/";
107103 license = licenses.isc;