nixpkgs/pkgs/development/libraries/snappy/default.nix

62 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, cmake
, fetchpatch
, static ? stdenv.hostPlatform.isStatic
}:
2013-02-18 21:12:11 +00:00
stdenv.mkDerivation rec {
pname = "snappy";
version = "1.1.9";
src = fetchFromGitHub {
owner = "google";
repo = "snappy";
2019-09-08 23:38:31 +00:00
rev = version;
sha256 = "sha256-JXWl63KVP+CDNWIXYtz+EKqWLJbPKl3ifhr8dKAp/w8=";
2013-02-18 21:12:11 +00:00
};
patches = [
(fetchpatch {
name = "clang-7-compat.patch";
url = "https://github.com/google/snappy/pull/142/commits/658cb2fcf67b626fff2122a3dbf7a3560c58f7ee.patch";
sha256 = "1kg3lxjwmhc7gjx36nylilnf444ddbnr3px1wpvyc6l1nh6zh4al";
})
];
outputs = [ "out" "dev" ];
nativeBuildInputs = [ cmake ];
2013-02-18 21:12:11 +00:00
2019-12-16 12:16:38 +00:00
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
"-DCMAKE_SKIP_BUILD_RPATH=OFF"
"-DSNAPPY_BUILD_TESTS=OFF"
"-DSNAPPY_BUILD_BENCHMARKS=OFF"
2019-12-16 12:16:38 +00:00
];
postInstall = ''
substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \
--replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"'
mkdir -p $dev/lib/pkgconfig
cat <<EOF > $dev/lib/pkgconfig/snappy.pc
Name: snappy
Description: Fast compressor/decompressor library.
Version: ${version}
Libs: -L$out/lib -lsnappy
Cflags: -I$dev/include
EOF
'';
#checkTarget = "test";
2014-09-14 02:13:43 +00:00
# requires gbenchmark and gtest but it also installs them out $dev
doCheck = false;
2013-02-18 21:12:11 +00:00
meta = with lib; {
2019-12-16 12:16:38 +00:00
homepage = "https://google.github.io/snappy/";
2014-09-14 02:13:43 +00:00
license = licenses.bsd3;
2013-02-18 21:12:11 +00:00
description = "Compression/decompression library for very high speeds";
2019-11-12 19:48:23 +00:00
platforms = platforms.all;
2013-02-18 21:12:11 +00:00
};
}