nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 staticOnly ? stdenv.hostPlatform.isStatic,
8 testers,
9}:
10
11# ?TODO: there's also python lib in there
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "brotli";
15 version = "1.1.0";
16
17 src = fetchFromGitHub {
18 owner = "google";
19 repo = "brotli";
20 rev = "v${finalAttrs.version}";
21 hash = "sha256-MvceRcle2dSkkucC2PlsCizsIf8iv95d8Xjqew266wc=";
22 };
23
24 patches = [
25 # revert runpath change, breaks curl on darwin:
26 # https://github.com/NixOS/nixpkgs/pull/254532#issuecomment-1722337476
27 (fetchpatch {
28 name = "revert-runpath.patch";
29 url = "https://github.com/google/brotli/commit/f842c1bcf9264431cd3b15429a72b7dafbe80509.patch";
30 hash = "sha256-W3LY3EjoHP74YsKOOcYQrzo+f0HbooOvEbnOibtN6TM=";
31 revert = true;
32 })
33 ];
34
35 nativeBuildInputs = [ cmake ];
36
37 cmakeFlags = lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF";
38
39 outputs = [
40 "out"
41 "dev"
42 "lib"
43 ];
44
45 doCheck = true;
46
47 checkTarget = "test";
48
49 # Don't bother with "man" output for now,
50 # it currently only makes the manpages hard to use.
51 postInstall = ''
52 mkdir -p $out/share/man/man{1,3}
53 cp ../docs/*.1 $out/share/man/man1/
54 cp ../docs/*.3 $out/share/man/man3/
55 '';
56
57 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
58
59 meta = with lib; {
60 homepage = "https://github.com/google/brotli";
61 description = "General-purpose lossless compression library with CLI";
62 longDescription = ''
63 Brotli is a generic-purpose lossless compression algorithm that
64 compresses data using a combination of a modern variant of the LZ77
65 algorithm, Huffman coding and 2nd order context modeling, with a
66 compression ratio comparable to the best currently available
67 general-purpose compression methods. It is similar in speed with
68 deflate but offers more dense compression.
69
70 The specification of the Brotli Compressed Data Format is defined
71 in the following Internet-Draft:
72 https://datatracker.ietf.org/doc/html/rfc7932
73 '';
74 license = licenses.mit;
75 maintainers = with maintainers; [ freezeboy ];
76 pkgConfigModules = [
77 "libbrotlidec"
78 "libbrotlienc"
79 ];
80 platforms = platforms.all;
81 mainProgram = "brotli";
82 };
83})