about summary refs log tree commit diff
path: root/pkgs/development/libraries/xxHash/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/xxHash/default.nix')
-rw-r--r--pkgs/development/libraries/xxHash/default.nix47
1 files changed, 33 insertions, 14 deletions
diff --git a/pkgs/development/libraries/xxHash/default.nix b/pkgs/development/libraries/xxHash/default.nix
index f4fa061128148..d5a8df6f437e6 100644
--- a/pkgs/development/libraries/xxHash/default.nix
+++ b/pkgs/development/libraries/xxHash/default.nix
@@ -1,4 +1,9 @@
-{ lib, stdenv, fetchFromGitHub }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, fetchpatch
+}:
 
 stdenv.mkDerivation rec {
   pname = "xxHash";
@@ -11,21 +16,35 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-2WoYCO6QRHWrbGP2mK04/sLNTyQLOuL3urVktilAwMA=";
   };
 
-  # Upstream Makefile does not anticipate that user may not want to
-  # build .so library.
-  postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
-    sed -i 's/lib: libxxhash.a libxxhash/lib: libxxhash.a/' Makefile
-    sed -i '/LIBXXH) $(DESTDIR/ d' Makefile
-  '';
+  # CMake build fixes
+  patches = [
+    # Merged in https://github.com/Cyan4973/xxHash/pull/649
+    # Should be present in next release
+    (fetchpatch {
+      name = "cmake-install-fix";
+      url = "https://github.com/Cyan4973/xxHash/commit/636f966ecc713c84ddd3b7ccfde2bfb2cc7492a0.patch";
+      sha256 = "sha256-B1PZ/0BXlOrSiPvgCPLvI/sjQvnR0n5PQHOO38LOij0=";
+    })
 
-  outputs = [ "out" "dev" ];
+    # Submitted at https://github.com/Cyan4973/xxHash/pull/723
+    (fetchpatch {
+      name = "cmake-pkgconfig-fix";
+      url = "https://github.com/Cyan4973/xxHash/commit/5db353bbd05ee5eb1f90afc08d10da9416154e55.patch";
+      sha256 = "sha256-dElgSu9DVo2hY6TTVHLTtt0zkXmQV3nc9i/KbrDkK8s=";
+    })
+  ];
 
-  makeFlags = [ "PREFIX=$(dev)" "EXEC_PREFIX=$(out)" ];
 
-  # pkgs/build-support/setup-hooks/compress-man-pages.sh hook fails
-  # to compress symlinked manpages. Avoid compressing manpages until
-  # it's fixed.
-  dontGzipMan = true;
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  # Using unofficial CMake build script to install CMake module files.
+  cmakeDir = "../cmake_unofficial";
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
+  ];
 
   meta = with lib; {
     description = "Extremely fast hash algorithm";
@@ -39,6 +58,6 @@ stdenv.mkDerivation rec {
     homepage = "https://github.com/Cyan4973/xxHash";
     license = with licenses; [ bsd2 gpl2 ];
     maintainers = with maintainers; [ orivej ];
-    platforms = platforms.unix;
+    platforms = platforms.all;
   };
 }