1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools-rust,
6 rustPlatform,
7 cargo,
8 rustc,
9 autoPatchelfHook,
10 pkg-config,
11 llvmPackages_15,
12 libxml2,
13 ncurses,
14 zlib,
15}:
16
17buildPythonPackage rec {
18 pname = "verilogae";
19 version = "1.0.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "pascalkuthe";
24 repo = "OpenVAF";
25 rev = "VerilogAE-v${version}";
26 hash = "sha256-TILKKmgSyhyxp88sdflDXAoH++iP6CMpdoXN1/1fsjU=";
27 };
28
29 postPatch = ''
30 substituteInPlace openvaf/llvm/src/initialization.rs \
31 --replace-fail "i8" "libc::c_char"
32 substituteInPlace openvaf/osdi/build.rs \
33 --replace-fail "-fPIC" ""
34 '';
35
36 cargoDeps = rustPlatform.fetchCargoVendor {
37 inherit pname version src;
38 hash = "sha256-/gSqaxqOZUkUmJJ5PGMkAG/5PSeAjwDjT2ce+tL7xmY";
39 };
40
41 nativeBuildInputs = [
42 setuptools-rust
43 rustPlatform.cargoSetupHook
44 rustPlatform.bindgenHook
45 cargo
46 rustc
47 autoPatchelfHook
48 pkg-config
49 llvmPackages_15.clang
50 llvmPackages_15.llvm
51 ];
52
53 buildInputs = [
54 libxml2.dev
55 llvmPackages_15.libclang
56 ncurses
57 zlib
58 ];
59
60 cargoBuildType = "release";
61
62 pythonImportsCheck = [ "verilogae" ];
63
64 hardeningDisable = [ "pic" ];
65
66 meta = {
67 description = "Verilog-A tool useful for compact model parameter extraction";
68 homepage = "https://man.sr.ht/~dspom/openvaf_doc/verilogae/";
69 license = lib.licenses.gpl3Only;
70 maintainers = with lib.maintainers; [
71 jasonodoom
72 jleightcap
73 ];
74 platforms = lib.platforms.linux;
75 sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
76 };
77}