summary refs log tree commit diff
path: root/pkgs/development/compilers/yosys/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/compilers/yosys/default.nix
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/compilers/yosys/default.nix')
-rw-r--r--pkgs/development/compilers/yosys/default.nix74
1 files changed, 53 insertions, 21 deletions
diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix
index c3185ca4e0e..a0c02e26db0 100644
--- a/pkgs/development/compilers/yosys/default.nix
+++ b/pkgs/development/compilers/yosys/default.nix
@@ -1,11 +1,12 @@
 { stdenv
+, lib
 , abc-verifier
 , bash
 , bison
 , fetchFromGitHub
 , flex
 , libffi
-, pkgconfig
+, pkg-config
 , protobuf
 , python3
 , readline
@@ -14,34 +15,50 @@
 , zlib
 }:
 
+# NOTE: as of late 2020, yosys has switched to an automation robot that
+# automatically tags their repository Makefile with a new build number every
+# day when changes are committed. please MAKE SURE that the version number in
+# the 'version' field exactly matches the YOSYS_VER field in the Yosys
+# makefile!
+#
+# if a change in yosys isn't yet available under a build number like this (i.e.
+# it was very recently merged, within an hour), wait a few hours for the
+# automation robot to tag the new version, like so:
+#
+#     https://github.com/YosysHQ/yosys/commit/71ca9a825309635511b64b3ec40e5e5e9b6ad49b
+#
+# note that while most nix packages for "unstable versions" use a date-based
+# version scheme, synchronizing the nix package version here with the unstable
+# yosys version number helps users report better bugs upstream, and is
+# ultimately less confusing than using dates.
+
 stdenv.mkDerivation rec {
   pname   = "yosys";
-  version = "2020.08.22";
+  version = "0.9+4052";
 
   src = fetchFromGitHub {
     owner  = "YosysHQ";
     repo   = "yosys";
-    rev    = "12132b6850747aec99715fdfa3184fe3ebefa015";
-    sha256 = "1v6x1y2f3r8vi7pnkgx374rrv02xgmg9yg23f61n7d1v2rd6y5cc";
+    rev    = "687f381b6985d9dda7e11535628e2fafff267af5";
+    sha256 = "15lcj798ckh9zwvdqb5gnvicilsxjyxv01gcviijg310hq62n7vf";
   };
 
   enableParallelBuilding = true;
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ tcl readline libffi python3 bison flex protobuf zlib ];
+  nativeBuildInputs = [ pkg-config bison flex ];
+  buildInputs = [ tcl readline libffi python3 protobuf zlib ];
 
   makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
 
-  patchPhase = ''
+  patches = [
+    ./plugin-search-dirs.patch
+  ];
+
+  postPatch = ''
     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'
-    patchShebangs tests
+
+    chmod +x ./misc/yosys-config.in
+    patchShebangs tests ./misc/yosys-config.in
   '';
 
   preBuild = let
@@ -55,11 +72,17 @@ stdenv.mkDerivation rec {
     (cd misc && ${protobuf}/bin/protoc --cpp_out ../backends/protobuf/ ./yosys.proto)
 
     if ! grep -q "ABCREV = ${shortAbcRev}" Makefile; then
-      echo "yosys isn't compatible with the provided abc (${shortAbcRev}), failing."
+      echo "ERROR: yosys isn't compatible with the provided abc (${shortAbcRev}), failing."
+      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."
       exit 1
     fi
   '';
 
+  checkTarget = "test";
   doCheck = true;
   checkInputs = [ verilog ];
 
@@ -68,16 +91,25 @@ stdenv.mkDerivation rec {
   # they just assume that 'yosys-abc' is available -- but it's not installed
   # when using ABCEXTERNAL
   #
-  # add a symlink to fake things so that both variants work the same way.
-  postInstall = ''
-    ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc
-  '';
+  # 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";
 
-  meta = with stdenv.lib; {
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
     description = "Open RTL synthesis framework and tools";
     homepage    = "http://www.clifford.at/yosys/";
     license     = licenses.isc;
     platforms   = platforms.all;
     maintainers = with maintainers; [ shell thoughtpolice emily ];
+    #In file included from kernel/driver.cc:20:
+    #./kernel/yosys.h:42:10: fatal error: 'map' file not found
+    ##include <map>
+
+    #https://github.com/YosysHQ/yosys/issues/681
+    #https://github.com/YosysHQ/yosys/issues/2011
+    broken = stdenv.isDarwin;
   };
 }