Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, fetchpatch 6, staticOnly ? stdenv.hostPlatform.isStatic 7, testers 8}: 9 10# ?TODO: there's also python lib in there 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "brotli"; 14 version = "1.0.9"; 15 16 src = fetchFromGitHub { 17 owner = "google"; 18 repo = "brotli"; 19 rev = "v${finalAttrs.version}"; 20 sha256 = "z6Dhrabav1MDQ4rAcXaDv0aN+qOoh9cvoXZqEWBB13c="; 21 }; 22 23 nativeBuildInputs = [ cmake ]; 24 25 patches = lib.optional staticOnly (fetchpatch { 26 # context from https://github.com/google/brotli/pull/655 27 # updated patch from https://github.com/google/brotli/pull/655 28 url = "https://github.com/google/brotli/commit/47a554804ceabb899ae924aaee54df806053d0d1.patch"; 29 sha256 = "sOeXNVsCaBSD9i82GRUDrkyreGeQ7qaJWjjy/uLL0/0="; 30 }); 31 32 cmakeFlags = lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF"; 33 34 outputs = [ "out" "dev" "lib" ]; 35 36 doCheck = true; 37 38 checkTarget = "test"; 39 40 # This breaks on Darwin because our cmake hook tries to make a build folder 41 # and the wonderful bazel BUILD file is already there (yay case-insensitivity?) 42 prePatch = '' 43 rm BUILD 44 45 # Upstream fixed this reference to runtime-path after the release 46 # and with this references g++ complains about invalid option -R 47 sed -i 's/ -R''${libdir}//' scripts/libbrotli*.pc.in 48 cat scripts/libbrotli*.pc.in 49 ''; 50 51 # Don't bother with "man" output for now, 52 # it currently only makes the manpages hard to use. 53 postInstall = '' 54 mkdir -p $out/share/man/man{1,3} 55 cp ../docs/*.1 $out/share/man/man1/ 56 cp ../docs/*.3 $out/share/man/man3/ 57 ''; 58 59 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 60 61 meta = with lib; { 62 homepage = "https://github.com/google/brotli"; 63 description = "A generic-purpose lossless compression algorithm and tool"; 64 longDescription = 65 '' Brotli is a generic-purpose lossless compression algorithm that 66 compresses data using a combination of a modern variant of the LZ77 67 algorithm, Huffman coding and 2nd order context modeling, with a 68 compression ratio comparable to the best currently available 69 general-purpose compression methods. It is similar in speed with 70 deflate but offers more dense compression. 71 72 The specification of the Brotli Compressed Data Format is defined 73 in the following internet draft: 74 http://www.ietf.org/id/draft-alakuijala-brotli 75 ''; 76 license = licenses.mit; 77 maintainers = with maintainers; [ freezeboy ]; 78 pkgConfigModules = [ 79 "libbrotlidec" 80 "libbrotlienc" 81 ]; 82 platforms = platforms.all; 83 }; 84})