summary refs log tree commit diff
path: root/pkgs/development/compilers/yosys/plugins/synlig.nix
diff options
context:
space:
mode:
authorHenner Zeller <h.zeller@acm.org>2023-10-25 08:48:05 -0700
committerAustin Seipp <aseipp@pobox.com>2023-10-27 07:36:13 -0500
commit13687487b97f09360a7de00bbda619973487572a (patch)
tree63c9b4a40b96ac3cb713d72e954ecd67faffeaae /pkgs/development/compilers/yosys/plugins/synlig.nix
parent44ff5dfca2cc87bbfdc89bcb34e30f14385cbe1c (diff)
downloadnixpkgs-13687487b97f09360a7de00bbda619973487572a.tar
nixpkgs-13687487b97f09360a7de00bbda619973487572a.tar.gz
nixpkgs-13687487b97f09360a7de00bbda619973487572a.tar.bz2
nixpkgs-13687487b97f09360a7de00bbda619973487572a.tar.lz
nixpkgs-13687487b97f09360a7de00bbda619973487572a.tar.xz
nixpkgs-13687487b97f09360a7de00bbda619973487572a.tar.zst
nixpkgs-13687487b97f09360a7de00bbda619973487572a.zip
synlig: 2023.10.12 -> 2023-10-26
Diffstat (limited to 'pkgs/development/compilers/yosys/plugins/synlig.nix')
-rw-r--r--pkgs/development/compilers/yosys/plugins/synlig.nix42
1 files changed, 30 insertions, 12 deletions
diff --git a/pkgs/development/compilers/yosys/plugins/synlig.nix b/pkgs/development/compilers/yosys/plugins/synlig.nix
index ccbf8815931..cc4ce429b31 100644
--- a/pkgs/development/compilers/yosys/plugins/synlig.nix
+++ b/pkgs/development/compilers/yosys/plugins/synlig.nix
@@ -12,21 +12,23 @@
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "yosys-synlig";
-  version = "2023.10.12";  # Currently no tagged versions upstream
   plugin = "synlig";
 
+  # The module has automatic regular releases, with date + short git hash
+  GIT_VERSION = "2023-10-26-f0252f6";
+
+  # Derive our package version from GIT_VERSION, remove hash, just keep date.
+  version = builtins.concatStringsSep "-" (
+    lib.take 3 (builtins.splitVersion finalAttrs.GIT_VERSION));
+
   src = fetchFromGitHub {
-    owner  = "chipsalliance";
-    repo   = "synlig";
-    rev    = "c5bd73595151212c61709d69a382917e96877a14";
-    sha256 = "sha256-WJhf5gdZTCs3EeNocP9aZAh6EZquHgYOG/xiTo8l0ao=";
+    owner = "chipsalliance";
+    repo  = "synlig";
+    rev   = "${finalAttrs.GIT_VERSION}";
+    hash  = "sha256-BGZQbUcIImpz3SjFvMq3Pr1lseNLZnsMvpHy0IsICe4=";
     fetchSubmodules = false;  # we use all dependencies from nix
   };
 
-  patches = [
-    ./synlig-makefile-for-nix.patch  # Remove assumption submodules available.
-  ];
-
   nativeBuildInputs = [
     pkg-config
   ];
@@ -42,16 +44,32 @@ stdenv.mkDerivation (finalAttrs: {
 
   buildPhase = ''
     runHook preBuild
-    make -j $NIX_BUILD_CORES build@systemverilog-plugin
+
+    # Remove assumptions that submodules are available.
+    rm -f third_party/Build.*.mk
+
+    # Create a stub makefile include that delegates the parameter-gathering
+    # to yosys-config
+    cat > third_party/Build.yosys.mk << "EOF"
+    t  := yosys
+    ts := ''$(call GetTargetStructName,''${t})
+
+    ''${ts}.src_dir   := ''$(shell yosys-config --datdir/include)
+    ''${ts}.mod_dir   := ''${TOP_DIR}third_party/yosys_mod/
+    EOF
+
+    make -j $NIX_BUILD_CORES build@systemverilog-plugin \
+            LDFLAGS="''$(yosys-config --ldflags --ldlibs)"
     runHook postBuild
   '';
 
-  # Very simple litmus test that the plugin can be loaded successfully.
+  # Check that the plugin can be loaded successfully and parse simple file.
   doCheck = true;
   checkPhase = ''
      runHook preCheck
+     echo "module litmustest(); endmodule;" > litmustest.sv
      yosys -p "plugin -i build/release/systemverilog-plugin/systemverilog.so;\
-               help read_systemverilog" | grep "Read SystemVerilog files using"
+               read_systemverilog litmustest.sv"
      runHook postCheck
   '';