1{ lib
2, stdenv
3, fetchFromGitHub
4, gitUpdater
5, cmake
6, fetchpatch
7}:
8
9stdenv.mkDerivation rec {
10 pname = "yaml-cpp";
11 version = "0.7.0";
12
13 src = fetchFromGitHub {
14 owner = "jbeder";
15 repo = "yaml-cpp";
16 rev = "yaml-cpp-${version}";
17 hash = "sha256-2tFWccifn0c2lU/U1WNg2FHrBohjx8CXMllPJCevaNk=";
18 };
19
20 patches = [
21 # https://github.com/jbeder/yaml-cpp/issues/774
22 # https://github.com/jbeder/yaml-cpp/pull/1037
23 (fetchpatch {
24 name = "yaml-cpp-Fix-generated-cmake-config.patch";
25 url = "https://github.com/jbeder/yaml-cpp/commit/4f48727b365962e31451cd91027bd797bc7d2ee7.patch";
26 hash = "sha256-jarZAh7NgwL3xXzxijDiAQmC/EC2WYfNMkYHEIQBPhM=";
27 })
28 # TODO: Remove with the next release, when https://github.com/jbeder/yaml-cpp/pull/1058 is available
29 (fetchpatch {
30 name = "yaml-cpp-Fix-pc-paths-for-absolute-GNUInstallDirs.patch";
31 url = "https://github.com/jbeder/yaml-cpp/commit/328d2d85e833be7cb5a0ab246cc3f5d7e16fc67a.patch";
32 hash = "sha256-1M2rxfbVOrRH9kiImcwcEolXOP8DeDW9Cbu03+mB5Yk=";
33 })
34 ];
35
36 strictDeps = true;
37
38 nativeBuildInputs = [
39 cmake
40 ];
41
42 cmakeFlags = [
43 "-DYAML_CPP_BUILD_TOOLS=false"
44 "-DYAML_BUILD_SHARED_LIBS=${lib.boolToString (!stdenv.hostPlatform.isStatic)}"
45 "-DINSTALL_GTEST=false"
46 ];
47
48 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
49
50 passthru.updateScript = gitUpdater {
51 rev-prefix = "yaml-cpp-";
52 };
53
54 meta = with lib; {
55 description = "A YAML parser and emitter for C++";
56 homepage = "https://github.com/jbeder/yaml-cpp";
57 license = licenses.mit;
58 platforms = platforms.all;
59 maintainers = with maintainers; [ OPNA2608 ];
60 };
61}