libyaml-cpp: apply patch to fix cmake variables

This commit is contained in:
Artturin 2021-09-29 14:51:54 +03:00
parent 5763d8c2f4
commit 7cda65b81a
3 changed files with 43 additions and 14 deletions

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
pname = "libyaml-cpp";
version = "0.3.0";
src = fetchFromGitHub {
owner = "jbeder";
repo = "yaml-cpp";
rev = "release-${version}";
sha256 = "sha256-pmgcULTXhl83+Wc8ZsGebnJ1t0XybHhUEJxDnEZE5x8=";
};
# implement https://github.com/jbeder/yaml-cpp/commit/52a1378e48e15d42a0b755af7146394c6eff998c
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace 'option(YAML_BUILD_SHARED_LIBS "Build Shared Libraries" OFF)' \
'option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ''${BUILD_SHARED_LIBS})'
'';
nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DYAML_CPP_BUILD_TESTS=OFF" ];
meta = with lib; {
inherit (src.meta) homepage;
description = "A YAML parser and emitter for C++";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ andir ];
};
}

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake }:
{ lib, stdenv, fetchFromGitHub, cmake, fetchpatch }:
stdenv.mkDerivation rec {
pname = "libyaml-cpp";
@ -11,12 +11,14 @@ stdenv.mkDerivation rec {
sha256 = "sha256-2tFWccifn0c2lU/U1WNg2FHrBohjx8CXMllPJCevaNk=";
};
# implement https://github.com/jbeder/yaml-cpp/commit/52a1378e48e15d42a0b755af7146394c6eff998c
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace 'option(YAML_BUILD_SHARED_LIBS "Build Shared Libraries" OFF)' \
'option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ''${BUILD_SHARED_LIBS})'
'';
patches = [
# https://github.com/jbeder/yaml-cpp/issues/774
# https://github.com/jbeder/yaml-cpp/pull/1037
(fetchpatch {
url = "https://github.com/jbeder/yaml-cpp/commit/4f48727b365962e31451cd91027bd797bc7d2ee7.patch";
sha256 = "sha256-jarZAh7NgwL3xXzxijDiAQmC/EC2WYfNMkYHEIQBPhM=";
})
];
nativeBuildInputs = [ cmake ];

View file

@ -18152,17 +18152,12 @@ with pkgs;
libyamlcpp = callPackage ../development/libraries/libyaml-cpp { };
libyamlcpp_0_3 = callPackage ../development/libraries/libyaml-cpp/0.3.0.nix { };
libcyaml = callPackage ../development/libraries/libcyaml { };
rang = callPackage ../development/libraries/rang { };
libyamlcpp_0_3 = pkgs.libyamlcpp.overrideAttrs (oldAttrs: {
src = pkgs.fetchurl {
url = "https://github.com/jbeder/yaml-cpp/archive/release-0.3.0.tar.gz";
sha256 = "12aszqw6svwlnb6nzhsbqhz3c7vnd5ahd0k6xlj05w8lm83hx3db";
};
});
libykclient = callPackage ../development/libraries/libykclient { };
libykneomgr = callPackage ../development/libraries/libykneomgr { };