Skip to content

Commit

Permalink
libyaml-cpp: apply patch to fix cmake variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Artturin committed Oct 13, 2021
1 parent 5763d8c commit 7cda65b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
32 changes: 32 additions & 0 deletions pkgs/development/libraries/libyaml-cpp/0.3.0.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
16 changes: 9 additions & 7 deletions pkgs/development/libraries/libyaml-cpp/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake }:
{ lib, stdenv, fetchFromGitHub, cmake, fetchpatch }:

stdenv.mkDerivation rec {
pname = "libyaml-cpp";
Expand All @@ -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 ];

Expand Down
9 changes: 2 additions & 7 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down

0 comments on commit 7cda65b

Please sign in to comment.