summary refs log tree commit diff
path: root/pkgs/development/libraries/crc32c
diff options
context:
space:
mode:
authorPhillip Cloud <417981+cpcloud@users.noreply.github.com>2021-11-01 11:02:28 -0400
committerGitHub <noreply@github.com>2021-11-01 16:02:28 +0100
commit1fe2aba063bd4001308fb2b14f26e7c74dde926e (patch)
tree7dbb815b24c5f115f6650b5c2f202e6ba7325c98 /pkgs/development/libraries/crc32c
parentcd92b903012d97235bfecc7b24397850daa365ab (diff)
downloadnixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar.gz
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar.bz2
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar.lz
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar.xz
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.tar.zst
nixpkgs-1fe2aba063bd4001308fb2b14f26e7c74dde926e.zip
crc32c: 1.1.0 -> 1.1.2 (#143839)
Diffstat (limited to 'pkgs/development/libraries/crc32c')
-rw-r--r--pkgs/development/libraries/crc32c/default.nix53
1 files changed, 48 insertions, 5 deletions
diff --git a/pkgs/development/libraries/crc32c/default.nix b/pkgs/development/libraries/crc32c/default.nix
index bc46e80db9b..521ae7f216d 100644
--- a/pkgs/development/libraries/crc32c/default.nix
+++ b/pkgs/development/libraries/crc32c/default.nix
@@ -1,28 +1,71 @@
-{ stdenv, lib, fetchFromGitHub, cmake, gflags
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, gflags
 , staticOnly ? stdenv.hostPlatform.isStatic
 }:
 
 stdenv.mkDerivation rec {
   pname = "crc32c";
-  version = "1.1.0";
+  version = "1.1.2";
 
   src = fetchFromGitHub {
     owner = "google";
     repo = "crc32c";
     rev = version;
-    sha256 = "1sazkis9rzbrklfrvk7jn1mqywnq4yghmzg94mxd153h8b1sb149";
+    sha256 = "0c383p7vkfq9rblww6mqxz8sygycyl27rr0j3bzb8l8ga71710ii";
     fetchSubmodules = true;
   };
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ gflags ];
+
   NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc";
-  cmakeFlags = lib.optionals (!staticOnly) [ "-DBUILD_SHARED_LIBS=1"  ];
+
+  cmakeFlags = [
+    "-DCRC32C_INSTALL=1"
+    "-DCRC32C_BUILD_TESTS=1"
+    "-DCRC32C_BUILD_BENCHMARKS=0"
+    "-DCRC32C_USE_GLOG=0"
+    "-DBUILD_SHARED_LIBS=${if staticOnly then "0" else "1"}"
+  ];
+
+  doCheck = false;
+  doInstallCheck = true;
+
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    ctest
+
+    runHook postInstallCheck
+  '';
+
+  postInstallCheck = ''
+    # without removing these libraries, dependents will look for
+    # libgtest/libgmock etc here, which can result in link time errors
+    rm $out/lib/libg*
+  '';
+
+  postFixup = ''
+    # dependents shouldn't be able to find gtest libraries as dependencies of
+    # this package
+    rm -r $out/lib/pkgconfig
+
+    # remove GTest cmake config files
+    rm -r $out/lib/cmake/GTest
+
+    # fix bogus include paths
+    for f in $(find $out/lib/cmake -name '*.cmake'); do
+      substituteInPlace "$f" --replace "\''${_IMPORT_PREFIX}/$out/include" "\''${_IMPORT_PREFIX}/include"
+    done
+  '';
 
   meta = with lib; {
     homepage = "https://github.com/google/crc32c";
     description = "CRC32C implementation with support for CPU-specific acceleration instructions";
     license = with licenses; [ bsd3 ];
-    maintainers = with maintainers; [ andir ];
+    maintainers = with maintainers; [ andir cpcloud ];
   };
 }