1{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, python3 }:
2
3stdenv.mkDerivation rec {
4 version = "0.6.3";
5 pname = "docopt.cpp";
6
7 src = fetchFromGitHub {
8 owner = "docopt";
9 repo = "docopt.cpp";
10 rev = "v${version}";
11 sha256 = "0cz3vv7g5snfbsqcf3q8bmd6kv5qp84gj3avwkn4vl00krw13bl7";
12 };
13
14 patches = [
15 (fetchpatch {
16 name = "python3-for-tests";
17 url = "https://github.com/docopt/docopt.cpp/commit/b3d909dc952ab102a4ad5a1541a41736f35b92ba.patch";
18 hash = "sha256-JJR09pbn3QhYaZAIAjs+pe28+g1VfgHUKspWorHzr8o=";
19 })
20 ];
21
22 nativeBuildInputs = [ cmake python3 ];
23
24 cmakeFlags = ["-DWITH_TESTS=ON"];
25
26 strictDeps = true;
27
28 doCheck = true;
29
30 postPatch = ''
31 substituteInPlace docopt.pc.in \
32 --replace "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" \
33 "@CMAKE_INSTALL_LIBDIR@"
34 '';
35
36 checkPhase = "python ./run_tests";
37
38 meta = with lib; {
39 description = "C++11 port of docopt";
40 homepage = "https://github.com/docopt/docopt.cpp";
41 license = with licenses; [ mit boost ];
42 platforms = platforms.all;
43 maintainers = with maintainers; [ knedlsepp ];
44 };
45}