Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
74 lines
1.8 KiB
Nix
74 lines
1.8 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
fetchFromGitHub,
|
|
fetchpatch,
|
|
cmake,
|
|
gflags,
|
|
staticOnly ? stdenv.hostPlatform.isStatic,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "crc32c";
|
|
version = "1.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "google";
|
|
repo = "crc32c";
|
|
tag = version;
|
|
sha256 = "0c383p7vkfq9rblww6mqxz8sygycyl27rr0j3bzb8l8ga71710ii";
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
name = "crc32c-fix-cmake-4.patch";
|
|
url = "https://github.com/google/crc32c/commit/2bbb3be42e20a0e6c0f7b39dc07dc863d9ffbc07.patch";
|
|
excludes = [ "third_party/*" ];
|
|
hash = "sha256-XYH0Mwvmf8RkXscVo6pAejTbRmVl9tY+lpp1sqbNXa0=";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
buildInputs = [ gflags ];
|
|
|
|
env.NIX_CFLAGS_COMPILE =
|
|
lib.optionalString stdenv.hostPlatform.isAarch64 "-march=armv8-a+crc"
|
|
# TODO: probably fixed for version > 1.1.2
|
|
+ lib.optionalString stdenv.cc.isClang " -Wno-error=character-conversion";
|
|
|
|
cmakeFlags = [
|
|
"-DCRC32C_INSTALL=1"
|
|
"-DCRC32C_BUILD_TESTS=1"
|
|
"-DCRC32C_BUILD_BENCHMARKS=0"
|
|
"-DCRC32C_USE_GLOG=0"
|
|
"-DINSTALL_GTEST=0"
|
|
"-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
|
|
'';
|
|
|
|
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; [ cpcloud ];
|
|
};
|
|
}
|