synlig: 2023.10.12 -> 2023-10-26

authored by Henner Zeller and committed by Austin Seipp 13687487 44ff5dfc

+30 -78
-66
pkgs/development/compilers/yosys/plugins/synlig-makefile-for-nix.patch
··· 1 - diff --git a/Makefile b/Makefile 2 - index 4c96ae7..9e1a2e3 100755 3 - --- a/Makefile 4 - +++ b/Makefile 5 - @@ -3,7 +3,7 @@ 6 - # Setup make itself. 7 - 8 - .ONESHELL: 9 - -override SHELL := /bin/bash 10 - +SHELL := bash 11 - override .SHELLFLAGS := -e -u -o pipefail -O nullglob -O extglob -O globstar -c 12 - 13 - # Unset all default build- and recipe-related variables. 14 - @@ -315,7 +315,6 @@ endif 15 - GetTargetStructName = target[${1}] 16 - 17 - makefiles_to_include := \ 18 - - third_party/Build.*.mk \ 19 - frontends/*/Build.mk \ 20 - tests/*/Build.mk \ 21 - lib/*/Build.mk 22 - diff --git a/frontends/systemverilog/Build.mk b/frontends/systemverilog/Build.mk 23 - index acd9cb6..c039994 100644 24 - --- a/frontends/systemverilog/Build.mk 25 - +++ b/frontends/systemverilog/Build.mk 26 - @@ -1,6 +1,7 @@ 27 - t := systemverilog-plugin 28 - ts := $(call GetTargetStructName,${t}) 29 - out_dir := $(call GetTargetBuildDir,${t}) 30 - +mod_dir := third_party/yosys_mod 31 - 32 - cxx_is_clang := $(findstring clang,$(notdir ${CXX})) 33 - 34 - @@ -13,9 +14,9 @@ ${ts}.sources := \ 35 - ${${ts}.src_dir}uhdm_ast_frontend.cc \ 36 - ${${ts}.src_dir}uhdm_common_frontend.cc \ 37 - ${${ts}.src_dir}uhdm_surelog_ast_frontend.cc \ 38 - - ${$(call GetTargetStructName,yosys).mod_dir}const2ast.cc \ 39 - - ${$(call GetTargetStructName,yosys).mod_dir}edif.cc \ 40 - - ${$(call GetTargetStructName,yosys).mod_dir}simplify.cc 41 - + $(mod_dir)/const2ast.cc \ 42 - + $(mod_dir)/edif.cc \ 43 - + $(mod_dir)/simplify.cc 44 - 45 - define ${ts}.env = 46 - export PKG_CONFIG_PATH=$(call ShQuote,${$(call GetTargetStructName,surelog).output_vars.PKG_CONFIG_PATH}$(if ${PKG_CONFIG_PATH},:${PKG_CONFIG_PATH})) 47 - @@ -35,8 +36,8 @@ endif 48 - endif 49 - 50 - ${ts}.cxxflags = \ 51 - - -I${$(call GetTargetStructName,yosys).src_dir} \ 52 - - -I${$(call GetTargetStructName,yosys).mod_dir} \ 53 - + -I$(shell yosys-config --cxxflags) \ 54 - + -I$(mod_dir) \ 55 - -D_YOSYS_ \ 56 - -DYOSYS_ENABLE_PLUGINS \ 57 - $(shell ${${ts}.env}; pkg-config --cflags Surelog) \ 58 - @@ -55,7 +56,7 @@ ${ts}.ldflags = \ 59 - $(shell ${${ts}.env}; pkg-config --libs-only-L Surelog) \ 60 - ${build_type_ldflags} \ 61 - ${LDFLAGS} \ 62 - - -Wl,--export-dynamic 63 - + $(shell yosys-config --ldflags --ldlibs) 64 - 65 - ${ts}.ldlibs = \ 66 - $(shell ${${ts}.env}; pkg-config --libs-only-l --libs-only-other Surelog) \
+30 -12
pkgs/development/compilers/yosys/plugins/synlig.nix
··· 12 12 13 13 stdenv.mkDerivation (finalAttrs: { 14 14 pname = "yosys-synlig"; 15 - version = "2023.10.12"; # Currently no tagged versions upstream 16 15 plugin = "synlig"; 17 16 17 + # The module has automatic regular releases, with date + short git hash 18 + GIT_VERSION = "2023-10-26-f0252f6"; 19 + 20 + # Derive our package version from GIT_VERSION, remove hash, just keep date. 21 + version = builtins.concatStringsSep "-" ( 22 + lib.take 3 (builtins.splitVersion finalAttrs.GIT_VERSION)); 23 + 18 24 src = fetchFromGitHub { 19 - owner = "chipsalliance"; 20 - repo = "synlig"; 21 - rev = "c5bd73595151212c61709d69a382917e96877a14"; 22 - sha256 = "sha256-WJhf5gdZTCs3EeNocP9aZAh6EZquHgYOG/xiTo8l0ao="; 25 + owner = "chipsalliance"; 26 + repo = "synlig"; 27 + rev = "${finalAttrs.GIT_VERSION}"; 28 + hash = "sha256-BGZQbUcIImpz3SjFvMq3Pr1lseNLZnsMvpHy0IsICe4="; 23 29 fetchSubmodules = false; # we use all dependencies from nix 24 30 }; 25 - 26 - patches = [ 27 - ./synlig-makefile-for-nix.patch # Remove assumption submodules available. 28 - ]; 29 31 30 32 nativeBuildInputs = [ 31 33 pkg-config ··· 42 44 43 45 buildPhase = '' 44 46 runHook preBuild 45 - make -j $NIX_BUILD_CORES build@systemverilog-plugin 47 + 48 + # Remove assumptions that submodules are available. 49 + rm -f third_party/Build.*.mk 50 + 51 + # Create a stub makefile include that delegates the parameter-gathering 52 + # to yosys-config 53 + cat > third_party/Build.yosys.mk << "EOF" 54 + t := yosys 55 + ts := ''$(call GetTargetStructName,''${t}) 56 + 57 + ''${ts}.src_dir := ''$(shell yosys-config --datdir/include) 58 + ''${ts}.mod_dir := ''${TOP_DIR}third_party/yosys_mod/ 59 + EOF 60 + 61 + make -j $NIX_BUILD_CORES build@systemverilog-plugin \ 62 + LDFLAGS="''$(yosys-config --ldflags --ldlibs)" 46 63 runHook postBuild 47 64 ''; 48 65 49 - # Very simple litmus test that the plugin can be loaded successfully. 66 + # Check that the plugin can be loaded successfully and parse simple file. 50 67 doCheck = true; 51 68 checkPhase = '' 52 69 runHook preCheck 70 + echo "module litmustest(); endmodule;" > litmustest.sv 53 71 yosys -p "plugin -i build/release/systemverilog-plugin/systemverilog.so;\ 54 - help read_systemverilog" | grep "Read SystemVerilog files using" 72 + read_systemverilog litmustest.sv" 55 73 runHook postCheck 56 74 ''; 57 75