-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslang_3.nix
67 lines (59 loc) · 1.77 KB
/
slang_3.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib, stdenv, fetchFromGitHub
, cmake
, python3
, catch2_3
}:
let
tag = "3.0";
fmt_src = fetchFromGitHub {
owner = "fmtlib";
repo = "fmt";
rev = "9.1.0";
sha256 = "rP6ymyRc7LnKxUXwPpzhHOQvpJkpnRFOt2ctvUNlYI0=";
};
# 2.0.0 maybe, but this seems to work too.
unordered_dense_src = fetchFromGitHub {
owner = "martinus";
repo = "unordered_dense";
rev = "v3.1.1";
sha256 = "7tx7s2j/UjsAjo47isQfqD+U2U6TAcMgG9VXJz4GDWQ=";
};
in stdenv.mkDerivation {
pname = "slang";
version = "v${tag}";
nativeBuildInputs = [ cmake python3 ];
buildInputs = [ python3 catch2_3 ];
src = fetchFromGitHub {
owner = "MikePopoloski";
repo = "slang";
rev = "v${tag}";
sha256 = "v2sStvukLFMRXGeATxvizmnwEPDE4kwnS06n+37OrJA=";
};
patches = [
./patches/slang_3-pkgconfig.patch
./patches/slang_3-don-t-fetch-fmt-unordered_dense.patch
];
postPatch = ''
ln -s ${fmt_src} external/fmt
ln -s ${unordered_dense_src} external/unordered_dense
substituteInPlace source/util/Version.cpp.in \
--subst-var SLANG_VERSION_MAJOR \
--subst-var SLANG_VERSION_MINOR \
--subst-var SLANG_VERSION_PATCH \
--subst-var SLANG_VERSION_HASH
substituteInPlace CMakeLists.txt \
--replace-fail 'VERSION ''${SLANG_VERSION_STRING}' \
'VERSION "${tag}"'
'';
SLANG_VERSION_MAJOR = lib.versions.major tag;
SLANG_VERSION_MINOR = lib.versions.minor tag;
SLANG_VERSION_PATCH = 0; # patch isn't safe if no patch level :(
SLANG_VERSION_HASH = "";
# TODO: tests
meta = with lib; {
description = "SystemVerilog compiler and language services";
homepage = "https://sv-lang.com";
license = with licenses; [ mit ]; # (ASL2.0 w/LLVM Exception)
maintainers = with maintainers; [ dtzWill ];
};
}