Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libyamlcpp: actually build shared libraries #81051

Merged
merged 1 commit into from Feb 29, 2020

Conversation

lopsided98
Copy link
Contributor

Motivation for this change

This package uses a custom CMake variable to enable shared libraries, rather
than the standard BUILD_SHARED_LIBS.

All dependent packages build successfully except for ip2unix and scylladb (which was not built by nixpkgs-review for some reason in my last PR), both of which currently fail on master.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @andir

@veprbl
Copy link
Member

veprbl commented Feb 26, 2020

This breaks pkgsStatic.libyamlcpp, which should be working via the adapter

cmakeFlags = (args.cmakeFlags or []) ++ [ "-DBUILD_SHARED_LIBS:BOOL=OFF" ];

I propose a slightly different solution

diff --git a/pkgs/development/libraries/libyaml-cpp/default.nix b/pkgs/development/libraries/libyaml-cpp/default.nix
index 0dec9daee6a..68d2241b243 100644
--- a/pkgs/development/libraries/libyaml-cpp/default.nix
+++ b/pkgs/development/libraries/libyaml-cpp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake }:
+{ stdenv, fetchFromGitHub, fetchpatch, cmake }:
 
 stdenv.mkDerivation rec {
   pname = "libyaml-cpp";
@@ -11,6 +11,13 @@ stdenv.mkDerivation rec {
     sha256 = "0ykkxzxcwwiv8l8r697gyqh1nl582krpvi7m7l6b40ijnk4pw30s";
   };
 
+  # 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})'
+  '';
+
   outputs = [ "out" "dev" ];
 
   nativeBuildInputs = [ cmake ];

@lopsided98
Copy link
Contributor Author

Fixed.

@veprbl veprbl merged commit be41f70 into NixOS:master Feb 29, 2020
@lopsided98 lopsided98 deleted the libyamlcpp-shared branch February 29, 2020 20:38
veprbl pushed a commit that referenced this pull request Feb 29, 2020
@veprbl veprbl added the 8.has: port to stable A PR already has a backport to the stable release. label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants