snappy: add pkgsStatic support

This commit is contained in:
Tobias Mayer 2019-12-16 13:16:38 +01:00
parent 0aeacdeaae
commit a244885c63
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake }: { stdenv, fetchFromGitHub, cmake, static ? false }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "snappy"; pname = "snappy";
@ -17,7 +17,10 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_SKIP_BUILD_RPATH=OFF" ]; cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
"-DCMAKE_SKIP_BUILD_RPATH=OFF"
];
postInstall = '' postInstall = ''
substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \ substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \
@ -29,7 +32,7 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://google.github.io/snappy/; homepage = "https://google.github.io/snappy/";
license = licenses.bsd3; license = licenses.bsd3;
description = "Compression/decompression library for very high speeds"; description = "Compression/decompression library for very high speeds";
platforms = platforms.all; platforms = platforms.all;

View File

@ -206,6 +206,9 @@ in {
woff2 = super.woff2.override { woff2 = super.woff2.override {
static = true; static = true;
}; };
snappy = super.snappy.override {
static = true;
};
lz4 = super.lz4.override { lz4 = super.lz4.override {
enableShared = false; enableShared = false;
enableStatic = true; enableStatic = true;