forked from BlockstreamResearch/simplicity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimplicity.C.nix
29 lines (29 loc) · 1.16 KB
/
Simplicity.C.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
{ lib, stdenv, gcovr ? null, wideMultiply ? null, withCoverage ? false
, production ? false
, gcov-executable ? if stdenv.cc.isGNU then "gcov -r" else
if stdenv.cc.isClang then "${stdenv.cc.cc.libllvm}/bin/llvm-cov gcov"
else null
, doCheck ? true
}:
assert wideMultiply == null
|| wideMultiply == "int64"
|| wideMultiply == "int128"
|| wideMultiply == "int128_struct";
assert withCoverage -> gcovr != null && gcov-executable != null;
stdenv.mkDerivation {
name = "libSimplicity-0.0.0";
src = lib.sourceFilesBySuffices ./C ["Makefile" ".c" ".h" ".inc"];
enableParallelBuilding = true;
CPPFLAGS = lib.optional (builtins.isString wideMultiply) "-DUSE_FORCE_WIDEMUL_${lib.toUpper wideMultiply}=1";
CFLAGS = lib.optional withCoverage "--coverage"
++ lib.optional production "-DPRODUCTION";
LDFLAGS = lib.optional withCoverage "--coverage";
inherit doCheck;
postCheck = lib.optional withCoverage ''
mkdir -p $out/shared/coverage
${gcovr}/bin/gcovr --gcov-executable "${gcov-executable}" --verbose --html --html-details -o $out/shared/coverage/coverage.html
'';
meta = {
license = lib.licenses.mit;
};
}