2021-11-01 15:02:28 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, gflags
|
2021-01-03 21:40:14 +00:00
|
|
|
, staticOnly ? stdenv.hostPlatform.isStatic
|
|
|
|
}:
|
2020-09-21 13:09:15 +00:00
|
|
|
|
2019-07-31 19:51:15 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "crc32c";
|
2021-11-01 15:02:28 +00:00
|
|
|
version = "1.1.2";
|
2019-07-31 19:51:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "crc32c";
|
|
|
|
rev = version;
|
2021-11-01 15:02:28 +00:00
|
|
|
sha256 = "0c383p7vkfq9rblww6mqxz8sygycyl27rr0j3bzb8l8ga71710ii";
|
2019-07-31 19:51:15 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ gflags ];
|
2021-11-01 15:02:28 +00:00
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isAarch64 "-march=armv8-a+crc";
|
2021-11-01 15:02:28 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCRC32C_INSTALL=1"
|
|
|
|
"-DCRC32C_BUILD_TESTS=1"
|
|
|
|
"-DCRC32C_BUILD_BENCHMARKS=0"
|
|
|
|
"-DCRC32C_USE_GLOG=0"
|
2022-08-09 13:01:25 +00:00
|
|
|
"-DINSTALL_GTEST=0"
|
2021-11-01 15:02:28 +00:00
|
|
|
"-DBUILD_SHARED_LIBS=${if staticOnly then "0" else "1"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
ctest
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# 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
|
|
|
|
'';
|
2019-07-31 19:51:15 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/google/crc32c";
|
2019-07-31 19:51:15 +00:00
|
|
|
description = "CRC32C implementation with support for CPU-specific acceleration instructions";
|
|
|
|
license = with licenses; [ bsd3 ];
|
2022-01-19 23:24:52 +00:00
|
|
|
maintainers = with maintainers; [ cpcloud ];
|
2019-07-31 19:51:15 +00:00
|
|
|
};
|
|
|
|
}
|