Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 67 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.10"; 9 10 src = fetchFromGitHub { 11 owner = "google"; 12 repo = "snappy"; 13 rev = version; 14 hash = "sha256-wYZkKVDXKCugycx/ZYhjV0BjM/NrEM0R6A4WFhs/WPU="; 15 }; 16 17 patches = [ 18 # Re-enable RTTI, without which other applications can't subclass 19 # snappy::Source (this breaks Ceph, as one example) 20 # https://tracker.ceph.com/issues/53060 21 # https://build.opensuse.org/package/show/openSUSE:Factory/snappy 22 (fetchpatch { 23 url = "https://build.opensuse.org/public/source/openSUSE:Factory/snappy/reenable-rtti.patch?rev=a759aa6fba405cd40025e3f0ab89941d"; 24 sha256 = "sha256-RMuM5yd6zP1eekN/+vfS54EyY4cFbGDVor1E1vj3134="; 25 }) 26 ]; 27 28 outputs = [ "out" "dev" ]; 29 30 nativeBuildInputs = [ cmake ]; 31 32 # See https://github.com/NixOS/nixpkgs/pull/219778#issuecomment-1464884412 33 # and https://github.com/NixOS/nixpkgs/pull/221215#issuecomment-1482564003. 34 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-sign-compare"; 35 36 cmakeFlags = [ 37 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" 38 "-DSNAPPY_BUILD_TESTS=OFF" 39 "-DSNAPPY_BUILD_BENCHMARKS=OFF" 40 ]; 41 42 postInstall = '' 43 substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \ 44 --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"' 45 46 mkdir -p $dev/lib/pkgconfig 47 cat <<EOF > $dev/lib/pkgconfig/snappy.pc 48 Name: snappy 49 Description: Fast compressor/decompressor library. 50 Version: ${version} 51 Libs: -L$out/lib -lsnappy 52 Cflags: -I$dev/include 53 EOF 54 ''; 55 56 #checkTarget = "test"; 57 58 # requires gbenchmark and gtest but it also installs them out $dev 59 doCheck = false; 60 61 meta = with lib; { 62 homepage = "https://google.github.io/snappy/"; 63 license = licenses.bsd3; 64 description = "Compression/decompression library for very high speeds"; 65 platforms = platforms.all; 66 }; 67}