nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 112 lines 2.6 kB view raw
1{ 2 fetchFromGitHub, 3 gtest, 4 lib, 5 python3, 6 readline, 7 stdenv, 8 yosys, 9 zlib, 10 yosys-symbiflow, 11 pkg-config, 12}: 13let 14 15 version = "1.20230906"; 16 17 src = fetchFromGitHub { 18 owner = "chipsalliance"; 19 repo = "yosys-f4pga-plugins"; 20 rev = "v${version}"; 21 hash = "sha256-XIn5wFw8i2njDN0Arua5BdZ0u1q6a/aJAs48YICehsc="; 22 }; 23 24 # Supported symbiflow plugins. 25 # 26 # The following are disabled: 27 # 28 # "ql-qlf" builds but fails to load the plugin, so is not currently supported. 29 plugins = [ 30 "design_introspection" 31 "fasm" 32 "integrateinv" 33 "params" 34 "ql-iob" 35 # "ql-qlf" 36 "sdc" 37 "xdc" 38 ]; 39 40 static_gtest = gtest.overrideAttrs (old: { 41 dontDisableStatic = true; 42 cmakeFlags = old.cmakeFlags ++ [ "-DBUILD_SHARED_LIBS=OFF" ]; 43 }); 44 45in 46lib.genAttrs plugins ( 47 plugin: 48 stdenv.mkDerivation rec { 49 pname = "yosys-symbiflow-${plugin}-plugin"; 50 inherit src version plugin; 51 enableParallelBuilding = true; 52 53 nativeBuildInputs = [ 54 python3 55 pkg-config 56 ]; 57 buildInputs = [ 58 yosys 59 readline 60 zlib 61 ]; 62 63 # xdc has an incorrect path to a test which has yet to be patched 64 doCheck = plugin != "xdc"; 65 nativeCheckInputs = [ static_gtest ]; 66 67 # A Makefile rule tries to wget-fetch a yosys script from github. 68 # Link the script from our yosys sources in preBuild instead, so that 69 # the Makefile rule is a no-op. 70 preBuild = '' 71 ln -s ${yosys.src}/passes/pmgen/pmgen.py pmgen.py 72 ''; 73 74 # Providing a symlink avoids the need for patching the test makefile 75 postUnpack = '' 76 mkdir -p source/third_party/googletest/build/ 77 ln -s ${static_gtest}/lib source/third_party/googletest/build/lib 78 ''; 79 80 makeFlags = [ 81 "PLUGIN_LIST=${plugin}" 82 ]; 83 84 buildFlags = [ 85 "YOSYS_PLUGINS_DIR=\${out}/share/yosys/plugins/" 86 "YOSYS_DATA_DIR=\${out}/share/yosys/" 87 ]; 88 89 checkTarget = "test"; 90 checkFlags = [ 91 ( 92 "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin/build" 93 # sdc and xdc plugins use design introspection for their tests 94 + (lib.optionalString ( 95 plugin == "sdc" || plugin == "xdc" 96 ) ":${yosys-symbiflow.design_introspection}/share/yosys/plugins/") 97 ) 98 ]; 99 100 installFlags = buildFlags; 101 102 meta = { 103 description = "Symbiflow ${plugin} plugin for Yosys"; 104 license = lib.licenses.isc; 105 platforms = lib.platforms.all; 106 maintainers = with lib.maintainers; [ 107 ollieB 108 thoughtpolice 109 ]; 110 }; 111 } 112)