1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6}:
7
8stdenv.mkDerivation rec {
9 pname = "ctpp2";
10 version = "2.8.3";
11
12 src = fetchurl {
13 url = "https://ctpp.havoc.ru/download/${pname}-${version}.tar.gz";
14 sha256 = "1z22zfw9lb86z4hcan9hlvji49c9b7vznh7gjm95gnvsh43zsgx8";
15 };
16
17 nativeBuildInputs = [ cmake ];
18
19 patchPhase = ''
20 # include <unistd.h> to fix undefined getcwd
21 sed -i -e 's/<stdlib.h>/<stdlib.h>\n#include <unistd.h>/' src/CTPP2FileSourceLoader.cpp
22 '';
23
24 cmakeFlags = [
25 # RPATH of binary /nix/store/.../bin/ctpp2json contains a forbidden reference to /build/
26 "-DCMAKE_SKIP_BUILD_RPATH=ON"
27 ];
28
29 doCheck = false; # fails
30
31 meta = with lib; {
32 description = "High performance templating engine";
33 homepage = "https://ctpp.havoc.ru/";
34 maintainers = [ maintainers.robbinch ];
35 platforms = platforms.linux;
36 license = licenses.bsd2;
37 };
38}