From ca27105b041dc5505a760ea554886e0f31d6c535 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 15 Jan 2021 10:13:27 -0600 Subject: [PATCH 1/7] Revert "Merge pull request #105709 from CajuM/symbiflow" This reverts commit 02828f91f15668ce6a757b6ef1d2d8430a403194, reversing changes made to f0a7fce6ee72e574c2406bf1cfd1741c8d2cd07e. --- maintainers/maintainer-list.nix | 6 --- pkgs/data/misc/prjxray-db/default.nix | 43 ----------------- .../data/misc/symbiflow-arch-defs/default.nix | 47 ------------------- .../compilers/prjxray-tools/default.nix | 29 ------------ .../compilers/symbiflow-vtr/default.nix | 40 ---------------- .../symbiflow-yosys-plugins/default.nix | 37 --------------- .../compilers/symbiflow-yosys/default.nix | 37 --------------- pkgs/development/compilers/yosys/default.nix | 31 +++++------- .../python-modules/python-prjxray/default.nix | 44 ----------------- .../python-modules/symbiflow-fasm/default.nix | 27 ----------- .../python-modules/textx/default.nix | 36 -------------- .../python-modules/xc-fasm/default.nix | 45 ------------------ pkgs/top-level/all-packages.nix | 12 ----- pkgs/top-level/python-packages.nix | 8 ---- 14 files changed, 13 insertions(+), 429 deletions(-) delete mode 100644 pkgs/data/misc/prjxray-db/default.nix delete mode 100644 pkgs/data/misc/symbiflow-arch-defs/default.nix delete mode 100644 pkgs/development/compilers/prjxray-tools/default.nix delete mode 100644 pkgs/development/compilers/symbiflow-vtr/default.nix delete mode 100644 pkgs/development/compilers/symbiflow-yosys-plugins/default.nix delete mode 100644 pkgs/development/compilers/symbiflow-yosys/default.nix delete mode 100644 pkgs/development/python-modules/python-prjxray/default.nix delete mode 100644 pkgs/development/python-modules/symbiflow-fasm/default.nix delete mode 100644 pkgs/development/python-modules/textx/default.nix delete mode 100644 pkgs/development/python-modules/xc-fasm/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 2bc0ae5f0425..bded6efff6be 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -5708,12 +5708,6 @@ githubId = 2971615; name = "Marius Bergmann"; }; - mcaju = { - email = "cajum.bugs@yandex.com"; - github = "CajuM"; - githubId = 10420834; - name = "Mihai-Drosi Caju"; - }; mcbeth = { email = "mcbeth@broggs.org"; github = "mcbeth"; diff --git a/pkgs/data/misc/prjxray-db/default.nix b/pkgs/data/misc/prjxray-db/default.nix deleted file mode 100644 index edc3c86438f6..000000000000 --- a/pkgs/data/misc/prjxray-db/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, stdenv -, fetchFromGitHub -}: - -stdenv.mkDerivation rec { - pname = "prjxray-db"; - version = "0.0-0232-g303a61d"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "prjxray-db"; - rev = "303a61d8bc552f7a533b91b17448c59e908aa391"; - sha256 = "0r75xig16dbgh3nfygggir0a160x52y766h7hd9xcib9m88jixb2"; - }; - - enableParallelBuilding = true; - - installPhase = '' - runHook preInstall - - DBDIR="$out/share/symbiflow/prjxray-db/" - DB_CONFIG="$out/bin/prjxray-config" - - mkdir -p $DBDIR $out/bin - - for device in artix7 kintex7 zynq7; do - cp -r $src/$device $DBDIR - done - - echo -e "#!/bin/sh\n\necho $DBDIR" > $DB_CONFIG - chmod +x $DB_CONFIG - - runHook postInstall - ''; - - meta = with lib; { - description = "Project X-Ray - Xilinx Series 7 Bitstream Documentation"; - homepage = "https://github.com/SymbiFlow/prjxray-db"; - license = licenses.cc0; - maintainers = with maintainers; [ mcaju ]; - platforms = platforms.all; - }; -} diff --git a/pkgs/data/misc/symbiflow-arch-defs/default.nix b/pkgs/data/misc/symbiflow-arch-defs/default.nix deleted file mode 100644 index 3f6e39d85f90..000000000000 --- a/pkgs/data/misc/symbiflow-arch-defs/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ lib, stdenv -, fetchurl -, autoPatchelfHook -, python3Packages -, archs ? [ "xc7a100t" "xc7a50t" "xc7z010" "xc7z020" ] -}: - -stdenv.mkDerivation rec { - pname = "symbiflow-arch-defs"; - version = "20200914-111752-g05d68df0"; - - src = fetchurl { - url = "https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/66/20200914-111752/symbiflow-arch-defs-install-05d68df0.tar.xz"; - sha256 = "1gmynybh8n33ag521w17c2kd16n834hqc6d8hi2pfs5kg1jl1a74"; - }; - - sourceRoot = "."; - - propagatedBuildInputs = [ - python3Packages.lxml - python3Packages.python-constraint - ]; - - installPhase = '' - mkdir -p $out/bin - cp -r bin/{symbiflow_*,vpr_common,python} $out/bin - for script in $out/bin/symbiflow_*; do - substituteInPlace $script --replace '/env' '/symbiflow_env' - done - cp bin/env $out/bin/symbiflow_env - - mkdir -p $out/share/symbiflow/arch - cp -r share/symbiflow/{scripts,techmaps} $out/share/symbiflow/ - - for arch in ${builtins.concatStringsSep " " archs}; do - cp -r share/symbiflow/arch/"$arch"_test* $out/share/symbiflow/arch/ - done - ''; - - meta = with lib; { - description = "Project X-Ray - Xilinx Series 7 Bitstream Documentation"; - homepage = "https://github.com/SymbiFlow/symbiflow-arch-defs"; - hydraPlatforms = []; - license = licenses.isc; - platforms = platforms.all; - }; -} diff --git a/pkgs/development/compilers/prjxray-tools/default.nix b/pkgs/development/compilers/prjxray-tools/default.nix deleted file mode 100644 index 652b5458a75e..000000000000 --- a/pkgs/development/compilers/prjxray-tools/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ stdenv -, fetchFromGitHub -, cmake -}: - -stdenv.mkDerivation rec { - pname = "prjxray-tools"; - version = "0.1-2676-gac8d30e3"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "prjxray"; - fetchSubmodules = true; - rev = "ac8d30e3fe2029122408888d2313844b3e0c265b"; - sha256 = "1ag7dk12hdhip821crwinncp8vgyzs0r85l1h2vbgn61lnxc7f4h"; - }; - - nativeBuildInputs = [ cmake ]; - - doCheck = true; - - meta = with stdenv.lib; { - description = "Documenting the Xilinx 7-series bit-stream format"; - homepage = "https://github.com/SymbiFlow/prjxray"; - license = licenses.isc; - platforms = platforms.all; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/compilers/symbiflow-vtr/default.nix b/pkgs/development/compilers/symbiflow-vtr/default.nix deleted file mode 100644 index 8735b12678c3..000000000000 --- a/pkgs/development/compilers/symbiflow-vtr/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ stdenv -, fetchFromGitHub -, bison -, cmake -, flex -, pkg-config -}: - -stdenv.mkDerivation rec { - pname = "symbiflow-vtr"; - version = "8.0.0.rc2-4003-g8980e4621"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "vtr-verilog-to-routing"; - rev = "8980e46218542888fac879961b13aa7b0fba8432"; - sha256 = "1sq7f1f3dzfm48a9vq5nvp0zllby0nasm3pvqab70f4jaq0m1aaa"; - }; - - nativeBuildInputs = [ - bison - cmake - flex - pkg-config - ]; - - cmakeFlags = [ - "-DWITH_ODIN=OFF" - "-DWITH_ABC=OFF" - ]; - - doCheck = true; - - meta = with stdenv.lib; { - description = "SymbiFlow WIP changes for Verilog to Routing (VTR)"; - homepage = "https://github.com/SymbiFlow/vtr-verilog-to-routing"; - platforms = platforms.all; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/compilers/symbiflow-yosys-plugins/default.nix b/pkgs/development/compilers/symbiflow-yosys-plugins/default.nix deleted file mode 100644 index b655f9d48733..000000000000 --- a/pkgs/development/compilers/symbiflow-yosys-plugins/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv -, fetchFromGitHub -, symbiflow-yosys -, zlib -, readline -}: - -stdenv.mkDerivation rec { - pname = "symbiflow-yosys-plugins"; - version = "1.0.0.7-0060-g7454cd6b"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "yosys-symbiflow-plugins"; - rev = "7454cd6b5e4fd22854e2ada219a5e3c3a06e0717"; - sha256 = "0r9r31p7fy4ylfrwvwlbivq5a03xrph34blxbxzx2c8bc02mbv0s"; - }; - - enableParallelBuilding = true; - - nativeBuildInputs = [ symbiflow-yosys ]; - - buildInputs = [ - readline - zlib - ]; - - makeFlags = [ "PLUGINS_DIR=${placeholder "out"}/share/yosys/plugins" ]; - - meta = with stdenv.lib; { - description = "Yosys SymbiFlow Plugins"; - homepage = "https://github.com/SymbiFlow/yosys-symbiflow-plugins"; - license = licenses.isc; - platforms = platforms.all; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/compilers/symbiflow-yosys/default.nix b/pkgs/development/compilers/symbiflow-yosys/default.nix deleted file mode 100644 index b33003f312e4..000000000000 --- a/pkgs/development/compilers/symbiflow-yosys/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv -, abc-verifier -, fetchFromGitHub -, yosys -, plugins ? [] -}: - -let - localAbc-verifier = abc-verifier.overrideAttrs (_: rec { - pname = "abc-verifier"; - version = "2020.06.22"; - - src = fetchFromGitHub { - owner = "YosysHQ"; - repo = "abc"; - rev = "341db25668f3054c87aa3372c794e180f629af5d"; - sha256 = "14cgv34vz5ljkcms6nrv19vqws2hs8bgjgffk5q03cbxnm2jxv5s"; - }; - - passthru.rev = src.rev; - }); -in - -(yosys.overrideAttrs (oldAttrs: rec { - pname = "symbiflow-yosys"; - version = "0.9+2406"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "yosys"; - rev = "d8b2d1a2b1a93057678cf49bb8f0329f191faba1"; - sha256 = "1w8jnqzabvzixjllhb6ak2n2gmjvsn6qd996i7z70bsq5rgdkq9g"; - }; -})).override { - abc-verifier = localAbc-verifier; - plugins = plugins; -} diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix index a83100911d13..51f0b7ed45aa 100644 --- a/pkgs/development/compilers/yosys/default.nix +++ b/pkgs/development/compilers/yosys/default.nix @@ -5,14 +5,13 @@ , fetchFromGitHub , flex , libffi -, pkg-config +, pkgconfig , protobuf , python3 , readline , tcl , verilog , zlib -, plugins ? [] }: # NOTE: as of late 2020, yosys has switched to an automation robot that @@ -33,8 +32,6 @@ # ultimately less confusing than using dates. stdenv.mkDerivation rec { - inherit plugins; - pname = "yosys"; version = "0.9+3830"; @@ -46,16 +43,21 @@ stdenv.mkDerivation rec { }; enableParallelBuilding = true; - nativeBuildInputs = [ pkg-config protobuf flex bison python3 ]; - buildInputs = [ tcl readline libffi python3 protobuf zlib ]; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ tcl readline libffi python3 bison flex 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}' - chmod +x ./misc/yosys-config.in - patchShebangs ./misc/yosys-config.in + substituteInPlace ./misc/yosys-config.in \ + --replace '/bin/bash' '${bash}/bin/bash' patchShebangs tests ''; @@ -74,8 +76,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 ''; @@ -92,14 +94,7 @@ 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 - - mkdir -p $out/share/yosys/plugins - for plugin in $plugins; do - ln -sfv $plugin/share/yosys/plugins/* $out/share/yosys/plugins/ - done - ''; + postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc"; meta = with stdenv.lib; { description = "Open RTL synthesis framework and tools"; diff --git a/pkgs/development/python-modules/python-prjxray/default.nix b/pkgs/development/python-modules/python-prjxray/default.nix deleted file mode 100644 index 5b92311612b0..000000000000 --- a/pkgs/development/python-modules/python-prjxray/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ stdenv -, fetchFromGitHub -, pkgs -, buildPythonPackage -, intervaltree -, numpy -, openpyxl -, parse -, progressbar -, pyjson5 -, pyyaml -, simplejson -, symbiflow-fasm -, textx -}: - -buildPythonPackage rec { - pname = "python-prjxray"; - version = pkgs.prjxray-tools.version; - - src = pkgs.prjxray-tools.src; - - propagatedBuildInputs = [ - intervaltree - numpy - openpyxl - parse - progressbar - pyjson5 - pyyaml - simplejson - symbiflow-fasm - textx - ]; - - doCheck = false; - - meta = with stdenv.lib; { - description = "Documenting the Xilinx 7-series bit-stream format"; - homepage = "https://github.com/SymbiFlow/prjxray"; - license = licenses.isc; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/python-modules/symbiflow-fasm/default.nix b/pkgs/development/python-modules/symbiflow-fasm/default.nix deleted file mode 100644 index 609987441ea6..000000000000 --- a/pkgs/development/python-modules/symbiflow-fasm/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ stdenv -, pkgs -, fetchFromGitHub -, buildPythonPackage -, textx -}: - -buildPythonPackage rec { - pname = "symbiflow-fasm"; - version = "0.0.1-g4857dde"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "fasm"; - rev = "4857dde757edd88688c2faf808774d85bdbe3900"; - sha256 = "1za7f8slf8wvp1mfbfc3vdv61115p49k0vwngs4db6ips1qg1435"; - }; - - propagatedBuildInputs = [ textx ]; - - meta = with stdenv.lib; { - description = "FPGA Assembly (FASM) Parser and Generation library"; - homepage = "https://github.com/SymbiFlow/fasm"; - license = licenses.isc; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/python-modules/textx/default.nix b/pkgs/development/python-modules/textx/default.nix deleted file mode 100644 index 07c568b87d48..000000000000 --- a/pkgs/development/python-modules/textx/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ stdenv -, buildPythonPackage -, fetchPypi -, pytestCheckHook -, arpeggio -, click -, jinja2 -}: - -buildPythonPackage rec { - pname = "textX"; - version = "2.2.0"; - - src = fetchPypi { - inherit pname; - inherit version; - sha256 = "00mwd588ms96qp27m5vpjkzk30wfw53hnmv8y77slxca8lw9vq82"; - }; - - checkInputs = [ pytestCheckHook ]; - - pytestFlagsArray = [ "tests/functional" ]; - - propagatedBuildInputs = [ - arpeggio - click - jinja2 - ]; - - meta = with stdenv.lib; { - description = "textX is a meta-language for building Domain-Specific Languages (DSLs) in Python"; - homepage = "https://textx.github.io"; - license = licenses.mit; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/development/python-modules/xc-fasm/default.nix b/pkgs/development/python-modules/xc-fasm/default.nix deleted file mode 100644 index bf00bb159010..000000000000 --- a/pkgs/development/python-modules/xc-fasm/default.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ stdenv -, fetchFromGitHub -, buildPythonPackage -, pytestCheckHook -, simplejson -, intervaltree -, python-prjxray -, symbiflow-fasm -, textx -}: - -buildPythonPackage rec { - pname = "xc-fasm"; - version = "0.0.1-g0ddd9516"; - - src = fetchFromGitHub { - owner = "SymbiFlow"; - repo = "xc-fasm"; - rev = "0ddd951602d47d5b95f2072f8aa751af5e81e577"; - sha256 = "15bzw92sx99s0zldr48na4yhrnp7b90nxsd8ya6ag1pvvijp2al4"; - }; - - propagatedBuildInputs = [ - simplejson - intervaltree - python-prjxray - symbiflow-fasm - textx - ]; - - # Pip will check for and then install missing dependecies. - # Because some of them are installed from git, it will try - # to download them even if they're present in - # propagatedBuildInputs. - pipInstallFlags = [ "--no-deps" ]; - - checkInputs = [ pytestCheckHook ]; - - meta = with stdenv.lib; { - description = "XC FASM libraries"; - homepage = "https://github.com/SymbiFlow/xc-fasm"; - license = licenses.isc; - maintainers = with maintainers; [ mcaju ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d504a00b0504..efac18edc021 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10720,12 +10720,6 @@ in swift = callPackage ../development/compilers/swift { }; - symbiflow-vtr = callPackage ../development/compilers/symbiflow-vtr { }; - - symbiflow-yosys = callPackage ../development/compilers/symbiflow-yosys { }; - - symbiflow-yosys-plugins = callPackage ../development/compilers/symbiflow-yosys-plugins { }; - swiProlog = callPackage ../development/compilers/swi-prolog { inherit (darwin.apple_sdk.frameworks) Security; jdk = openjdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 @@ -11096,8 +11090,6 @@ in polyml56 = callPackage ../development/compilers/polyml/5.6.nix { }; polyml57 = callPackage ../development/compilers/polyml/5.7.nix { }; - prjxray-tools = callPackage ../development/compilers/prjxray-tools { }; - pure = callPackage ../development/interpreters/pure { /*llvm = llvm_35;*/ }; @@ -20630,8 +20622,6 @@ in inherit (darwin.apple_sdk.frameworks) Security; }; - prjxray-db = callPackage ../data/misc/prjxray-db { }; - profont = callPackage ../data/fonts/profont { inherit (buildPackages.xorg) mkfontscale; }; @@ -20667,8 +20657,6 @@ in sweet = callPackage ../data/themes/sweet { }; - symbiflow-arch-defs = callPackage ../data/misc/symbiflow-arch-defs { }; - mime-types = callPackage ../data/misc/mime-types { }; shared-mime-info = callPackage ../data/misc/shared-mime-info { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b56d493df39b..049689239dc4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4812,8 +4812,6 @@ in { python-openems = callPackage ../development/python-modules/python-openems { }; - python-prjxray = callPackage ../development/python-modules/python-prjxray { }; - python-tado = callPackage ../development/python-modules/python-tado { }; pkutils = callPackage ../development/python-modules/pkutils { }; @@ -7405,8 +7403,6 @@ in { sybil = callPackage ../development/python-modules/sybil { }; - symbiflow-fasm = callPackage ../development/python-modules/symbiflow-fasm { }; - symengine = callPackage ../development/python-modules/symengine { symengine = pkgs.symengine; }; sympy = if isPy3k then @@ -7524,8 +7520,6 @@ in { textfsm = callPackage ../development/python-modules/textfsm { }; - textx = callPackage ../development/python-modules/textx { }; - testpath = callPackage ../development/python-modules/testpath { }; testrepository = callPackage ../development/python-modules/testrepository { }; @@ -8175,8 +8169,6 @@ in { xattr = callPackage ../development/python-modules/xattr { }; - xc-fasm = callPackage ../development/python-modules/xc-fasm { }; - xcaplib = callPackage ../development/python-modules/xcaplib { }; xcffib = callPackage ../development/python-modules/xcffib { }; From 5ffd4e1c2ca95caa4fa8457ea40516fce57c47df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A2ju=20Mihai-Drosi?= Date: Wed, 2 Dec 2020 15:54:27 +0200 Subject: [PATCH 2/7] maintainers: add mcaju --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index bded6efff6be..2bc0ae5f0425 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -5708,6 +5708,12 @@ githubId = 2971615; name = "Marius Bergmann"; }; + mcaju = { + email = "cajum.bugs@yandex.com"; + github = "CajuM"; + githubId = 10420834; + name = "Mihai-Drosi Caju"; + }; mcbeth = { email = "mcbeth@broggs.org"; github = "mcbeth"; From 51d1125f24af5b57f1d4f8fb49f78c729abf1fa9 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 14 Jan 2021 23:52:23 -0600 Subject: [PATCH 3/7] ghdl: 0.37 -> unstable-2021.01.14 This unreleased version of GHDL fixes a bunch of bugs. It also contains a few internal API changes for synthesis support -- required by the GHDL yosys plugin. Ideally, we can just remove this when 0.38 comes out. Signed-off-by: Austin Seipp --- pkgs/development/compilers/ghdl/default.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/ghdl/default.nix b/pkgs/development/compilers/ghdl/default.nix index 6d1fae337340..6181486f50c7 100644 --- a/pkgs/development/compilers/ghdl/default.nix +++ b/pkgs/development/compilers/ghdl/default.nix @@ -5,13 +5,15 @@ assert backend == "mcode" || backend == "llvm"; stdenv.mkDerivation rec { pname = "ghdl-${backend}"; - version = "0.37"; + # NOTE(aseipp): move to 0.38 when it comes out, since it should support a stable + # version of the yosys plugin + version = "unstable-2021.01.14"; src = fetchFromGitHub { - owner = "ghdl"; - repo = "ghdl"; - rev = "v${version}"; - sha256 = "0b53yl4im33c1cd4mdyc4ks9cmrpixym17gzchfmplrl22w3l17y"; + owner = "ghdl"; + repo = "ghdl"; + rev = "4868294436574660552ccef50a5b0849559393de"; + sha256 = "1wqjf0qc66dam1n2mskmlvj53bcsdwwk5rq9gimq6ah1vcwi222p"; }; LIBRARY_PATH = "${stdenv.cc.libc}/lib"; @@ -23,7 +25,7 @@ stdenv.mkDerivation rec { sed -i 's/check_version 7.0/check_version 7/g' configure ''; - configureFlags = lib.optional (backend == "llvm") + configureFlags = [ "--enable-synth" ] ++ lib.optional (backend == "llvm") "--with-llvm-config=${llvm}/bin/llvm-config"; hardeningDisable = [ "format" ]; @@ -33,7 +35,7 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://github.com/ghdl/ghdl"; description = "VHDL 2008/93/87 simulator"; - maintainers = with maintainers; [ lucus16 ]; + maintainers = with maintainers; [ lucus16 thoughtpolice ]; platforms = platforms.linux; license = licenses.gpl2; }; From 2660037f8cdf6bb69bacbf3d9d2f9f72d056c8d6 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 14 Jan 2021 23:52:23 -0600 Subject: [PATCH 4/7] yosys: enable loading "out of band" plugins By default, when yosys looks for plugins with the `-m` flag or `plugin` command, it always looks in `YOSYS_PREFIX/share/yosys/plugins` for a `.so` file, and loads that. By design, this is intended to be a single, global, mutable location such as `/usr/share/yosys/...` on disk, and plugins are supposed to install their `.so` files here after yosys is installed, and they all coexist together. Obviously, this won't work for us, but users might expect these plugins to still work. More importantly, they won't want to add special cases to their build systems. Instead, to allow Nix users to use yosys plugins with the same UX (e.g. natively call `plugin bluespec` or `-m ghdl`), we add a patch to yosys that allows it to search a new `NIX_YOSYS_PLUGIN_DIRS` search path environment variable. In tandem, we add a setup hook that adds to this search path if a package has a `$out/share/yosys/plugins` directory. Thus, it's enough to just include `yosys`, and any package that has a yosys plugin in `$out/share/yosys/plugins`, and you can load it with `-m` or the `plugin` command. We could use a style like the haskellPackages set, where the set of packages are "encased" in a lambda, and we pass packages that are compatible with that version of the compiler: haskell.packages.ghc8102.ghcWithPackages (p: with p; [ ... ]) but, realistically, there will probably only ever be one version of yosys and one set of compatible plugins, so this seems overdone. Signed-off-by: Austin Seipp --- pkgs/development/compilers/yosys/default.nix | 3 ++ .../compilers/yosys/plugin-search-dirs.patch | 34 +++++++++++++++++++ .../development/compilers/yosys/setup-hook.sh | 5 +++ 3 files changed, 42 insertions(+) create mode 100644 pkgs/development/compilers/yosys/plugin-search-dirs.patch create mode 100644 pkgs/development/compilers/yosys/setup-hook.sh diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix index 51f0b7ed45aa..3c292deabc61 100644 --- a/pkgs/development/compilers/yosys/default.nix +++ b/pkgs/development/compilers/yosys/default.nix @@ -49,6 +49,7 @@ stdenv.mkDerivation rec { makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"]; patchPhase = '' + patch -p1 < ${./plugin-search-dirs.patch} substituteInPlace ./Makefile \ --replace 'CXX = clang' "" \ --replace 'LD = clang++' 'LD = $(CXX)' \ @@ -96,6 +97,8 @@ stdenv.mkDerivation rec { postBuild = "ln -sfv ${abc-verifier}/bin/abc ./yosys-abc"; postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc"; + setupHook = ./setup-hook.sh; + meta = with stdenv.lib; { description = "Open RTL synthesis framework and tools"; homepage = "http://www.clifford.at/yosys/"; diff --git a/pkgs/development/compilers/yosys/plugin-search-dirs.patch b/pkgs/development/compilers/yosys/plugin-search-dirs.patch new file mode 100644 index 000000000000..0cb0aee9c7ed --- /dev/null +++ b/pkgs/development/compilers/yosys/plugin-search-dirs.patch @@ -0,0 +1,34 @@ +diff --git a/passes/cmds/plugin.cc b/passes/cmds/plugin.cc +index 3ed19497..f9534bd0 100644 +--- a/passes/cmds/plugin.cc ++++ b/passes/cmds/plugin.cc +@@ -75,8 +75,27 @@ void load_plugin(std::string filename, std::vector aliases) + #endif + + void *hdl = dlopen(filename.c_str(), RTLD_LAZY|RTLD_LOCAL); +- if (hdl == NULL && orig_filename.find('/') == std::string::npos) +- hdl = dlopen((proc_share_dirname() + "plugins/" + orig_filename + ".so").c_str(), RTLD_LAZY|RTLD_LOCAL); ++ if (hdl == NULL && orig_filename.find('/') == std::string::npos) { ++ std::string install_dir = proc_share_dirname() + "plugins"; ++ ++ vector all_dirs; ++ all_dirs.push_back(install_dir); ++ ++ char* plugin_dirs = getenv("NIX_YOSYS_PLUGIN_DIRS"); ++ if (plugin_dirs != NULL) { ++ std::string p(plugin_dirs), t; ++ std::stringstream ss(p); ++ ++ while(std::getline(ss, t, ':')) { ++ all_dirs.push_back(t); ++ } ++ } ++ ++ for (auto dir : all_dirs) { ++ hdl = dlopen((dir + "/" + orig_filename + ".so").c_str(), RTLD_LAZY|RTLD_LOCAL); ++ if (hdl != NULL) break; ++ } ++ } + if (hdl == NULL) + log_cmd_error("Can't load module `%s': %s\n", filename.c_str(), dlerror()); + loaded_plugins[orig_filename] = hdl; diff --git a/pkgs/development/compilers/yosys/setup-hook.sh b/pkgs/development/compilers/yosys/setup-hook.sh new file mode 100644 index 000000000000..d01bbdd1a8c1 --- /dev/null +++ b/pkgs/development/compilers/yosys/setup-hook.sh @@ -0,0 +1,5 @@ +addYosysPluginPath() { + addToSearchPath NIX_YOSYS_PLUGIN_DIRS "$1/share/yosys/plugins" +} + +addEnvHooks "$targetOffset" addYosysPluginPath From ec1830e696fce7a92e230ee28e6deb3c53bee1a1 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 14 Jan 2021 23:52:24 -0600 Subject: [PATCH 5/7] init: experimental yosys-{bluespec, ghdl} plugins These plugins can be included in a closure, along with the `yosys` derivation, and they will be automatically picked up for use. For example, this allows you to include 'yosys-bluespec' in your `buildInputs`, and then immediately run: $ nix-shell -p yosys yosys-bluespec yosys-ghdl $ yosys -m bluespec -p 'help read_bluespec' $ yosys -m ghdl -p 'help ghdl' These two plugins are a bit experimental, admittedly, but they are good, clean examples of how to write and use the yosys plugin infrastructure, and make it easy to test updates, etc. Signed-off-by: Austin Seipp --- .../compilers/yosys/plugins/bluespec.nix | 32 +++++++++++++++++++ .../compilers/yosys/plugins/ghdl.nix | 31 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 65 insertions(+) create mode 100644 pkgs/development/compilers/yosys/plugins/bluespec.nix create mode 100644 pkgs/development/compilers/yosys/plugins/ghdl.nix diff --git a/pkgs/development/compilers/yosys/plugins/bluespec.nix b/pkgs/development/compilers/yosys/plugins/bluespec.nix new file mode 100644 index 000000000000..ea67ffc661cb --- /dev/null +++ b/pkgs/development/compilers/yosys/plugins/bluespec.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchFromGitHub, pkg-config +, yosys, readline, zlib, bluespec +}: + +stdenv.mkDerivation { + pname = "yosys-bluespec"; + version = "2021.01.14"; + + src = fetchFromGitHub { + owner = "thoughtpolice"; + repo = "yosys-bluespec"; + rev = "7a0c609e9b601560067c34b8ce41e89ea4a397d4"; + sha256 = "0xj9j5dwvq0dwqzfjd4ikmxkd28amj6d9m6ava7pwcrpjhyjnd0c"; + }; + + buildInputs = [ yosys readline zlib bluespec ]; + nativeBuildInputs = [ pkg-config ]; + + doCheck = true; + makeFlags = [ + "PREFIX=$(out)/share/yosys/plugins" + "STATIC_BSC_PATH=${bluespec}/bin/bsc" + "STATIC_BSC_LIBDIR=${bluespec}/lib" + ]; + + meta = with lib; { + description = "Bluespec plugin for Yosys"; + license = licenses.isc; + platforms = platforms.all; + maintainers = with maintainers; [ thoughtpolice ]; + }; +} diff --git a/pkgs/development/compilers/yosys/plugins/ghdl.nix b/pkgs/development/compilers/yosys/plugins/ghdl.nix new file mode 100644 index 000000000000..ccf8efc7c805 --- /dev/null +++ b/pkgs/development/compilers/yosys/plugins/ghdl.nix @@ -0,0 +1,31 @@ +{ stdenv, lib, fetchFromGitHub, pkg-config +, yosys, readline, zlib, ghdl +}: + +stdenv.mkDerivation { + pname = "yosys-ghdl"; + version = "2021.01.01"; + + src = fetchFromGitHub { + owner = "ghdl"; + repo = "ghdl-yosys-plugin"; + rev = "8b3e740fef9a653a20a838f1ade475960e1d379b"; + sha256 = "13kpcp37r11xgqd8aksddi40a5vpzqi7p8qgyjbs99lyscyli75x"; + }; + + buildInputs = [ yosys readline zlib ghdl ]; + nativeBuildInputs = [ pkg-config ]; + + doCheck = true; + installPhase = '' + mkdir -p $out/share/yosys/plugins + cp ghdl.so $out/share/yosys/plugins/ghdl.so + ''; + + meta = with lib; { + description = "GHDL plugin for Yosys"; + license = licenses.isc; + platforms = platforms.all; + maintainers = with maintainers; [ thoughtpolice ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index efac18edc021..300aa516668e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10832,6 +10832,8 @@ in yasm = callPackage ../development/compilers/yasm { }; yosys = callPackage ../development/compilers/yosys { }; + yosys-bluespec = callPackage ../development/compilers/yosys/plugins/bluespec.nix { }; + yosys-ghdl = callPackage ../development/compilers/yosys/plugins/ghdl.nix { }; z88dk = callPackage ../development/compilers/z88dk { }; From 365ef90263f991f329fdfc599d33e1f0b2cf8c99 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 15 Jan 2021 10:26:16 -0600 Subject: [PATCH 6/7] yosys: cherry-pick some minor fixes (cf d81e4d9f6) d81e4d9f66e0d1a1a6d contained some minor fixes to the yosys derivation that make it a little easier to read and maintain. Incorporate those. Signed-off-by: Austin Seipp --- pkgs/development/compilers/yosys/default.nix | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix index 3c292deabc61..9e1576434f5b 100644 --- a/pkgs/development/compilers/yosys/default.nix +++ b/pkgs/development/compilers/yosys/default.nix @@ -5,7 +5,7 @@ , fetchFromGitHub , flex , libffi -, pkgconfig +, pkg-config , protobuf , python3 , readline @@ -43,7 +43,7 @@ stdenv.mkDerivation rec { }; enableParallelBuilding = true; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ tcl readline libffi python3 bison flex protobuf zlib ]; makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"]; @@ -51,15 +51,10 @@ stdenv.mkDerivation rec { patchPhase = '' patch -p1 < ${./plugin-search-dirs.patch} 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 @@ -77,7 +72,7 @@ stdenv.mkDerivation rec { exit 1 fi - if ! grep -q "YOSYS_VER := ${version}" Makefile; then + 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 From 9a951db8462a9e41c4aeded3a8d6ecd69acd1896 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 15 Jan 2021 16:07:53 -0600 Subject: [PATCH 7/7] yosys: some more small fixes from review feedback Fixes up the usage of patches/postInstall. Also removes `stdenv.lib` and other minor tweaks. Based on feedback from Sandro and Mihai. Signed-off-by: Austin Seipp --- pkgs/development/compilers/yosys/default.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix index 9e1576434f5b..7d2191f8f456 100644 --- a/pkgs/development/compilers/yosys/default.nix +++ b/pkgs/development/compilers/yosys/default.nix @@ -1,4 +1,4 @@ -{ stdenv +{ stdenv, lib , abc-verifier , bash , bison @@ -43,13 +43,16 @@ stdenv.mkDerivation rec { }; enableParallelBuilding = true; - nativeBuildInputs = [ pkg-config ]; - 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 = '' - patch -p1 < ${./plugin-search-dirs.patch} + patches = [ + ./plugin-search-dirs.patch + ]; + + postPatch = '' substituteInPlace ./Makefile \ --replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}' @@ -94,7 +97,7 @@ stdenv.mkDerivation rec { setupHook = ./setup-hook.sh; - meta = with stdenv.lib; { + meta = with lib; { description = "Open RTL synthesis framework and tools"; homepage = "http://www.clifford.at/yosys/"; license = licenses.isc;