about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/snappy
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/snappy')
-rw-r--r--nixpkgs/pkgs/development/libraries/snappy/default.nix40
-rw-r--r--nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch5
2 files changed, 45 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/snappy/default.nix b/nixpkgs/pkgs/development/libraries/snappy/default.nix
new file mode 100644
index 000000000000..e626db8efb78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/snappy/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, cmake, static ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "snappy";
+  version = "1.1.8";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "snappy";
+    rev = version;
+    sha256 = "1j0kslq2dvxgkcxl1gakhvsa731yrcvcaipcp5k8k7ayicvkv9jv";
+  };
+
+  patches = [ ./disable-benchmark.patch ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
+    "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+  ];
+
+  postInstall = ''
+    substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \
+      --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"'
+  '';
+
+  checkTarget = "test";
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://google.github.io/snappy/";
+    license = licenses.bsd3;
+    description = "Compression/decompression library for very high speeds";
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch b/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch
new file mode 100644
index 000000000000..c891c13fe74c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/snappy/disable-benchmark.patch
@@ -0,0 +1,5 @@
+--- a/snappy-test.cc
++++ b/snappy-test.cc
+@@ -46 +46 @@
+-DEFINE_bool(run_microbenchmarks, true,
++DEFINE_bool(run_microbenchmarks, false,