at 23.05-pre 68 lines 2.1 kB view raw
1{ lib, stdenv, fetchFromGitHub, cmake 2, fetchpatch 3, static ? stdenv.hostPlatform.isStatic 4}: 5 6stdenv.mkDerivation rec { 7 pname = "snappy"; 8 version = "1.1.9"; 9 10 src = fetchFromGitHub { 11 owner = "google"; 12 repo = "snappy"; 13 rev = version; 14 sha256 = "sha256-JXWl63KVP+CDNWIXYtz+EKqWLJbPKl3ifhr8dKAp/w8="; 15 }; 16 17 patches = [ 18 (fetchpatch { 19 name = "clang-7-compat.patch"; 20 url = "https://github.com/google/snappy/pull/142/commits/658cb2fcf67b626fff2122a3dbf7a3560c58f7ee.patch"; 21 sha256 = "1kg3lxjwmhc7gjx36nylilnf444ddbnr3px1wpvyc6l1nh6zh4al"; 22 }) 23 # Re-enable RTTI, without which other applications can't subclass 24 # snappy::Source (this breaks Ceph, as one example) 25 # https://tracker.ceph.com/issues/53060 26 # https://build.opensuse.org/package/show/openSUSE:Factory/snappy 27 (fetchpatch { 28 url = "https://build.opensuse.org/public/source/openSUSE:Factory/snappy/reenable-rtti.patch?rev=a759aa6fba405cd40025e3f0ab89941d"; 29 sha256 = "sha256-RMuM5yd6zP1eekN/+vfS54EyY4cFbGDVor1E1vj3134="; 30 }) 31 ]; 32 33 outputs = [ "out" "dev" ]; 34 35 nativeBuildInputs = [ cmake ]; 36 37 cmakeFlags = [ 38 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" 39 "-DSNAPPY_BUILD_TESTS=OFF" 40 "-DSNAPPY_BUILD_BENCHMARKS=OFF" 41 ]; 42 43 postInstall = '' 44 substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \ 45 --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"' 46 47 mkdir -p $dev/lib/pkgconfig 48 cat <<EOF > $dev/lib/pkgconfig/snappy.pc 49 Name: snappy 50 Description: Fast compressor/decompressor library. 51 Version: ${version} 52 Libs: -L$out/lib -lsnappy 53 Cflags: -I$dev/include 54 EOF 55 ''; 56 57 #checkTarget = "test"; 58 59 # requires gbenchmark and gtest but it also installs them out $dev 60 doCheck = false; 61 62 meta = with lib; { 63 homepage = "https://google.github.io/snappy/"; 64 license = licenses.bsd3; 65 description = "Compression/decompression library for very high speeds"; 66 platforms = platforms.all; 67 }; 68}