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