about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/brunsli/default.nix
blob: 03c9b02f7f9ffd801d1dff53a927db148aea0562 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, brotli
}:

stdenv.mkDerivation rec {
  pname = "brunsli";
  version = "0.1";

  outputs = [ "out" "dev" ];

  src = fetchFromGitHub {
    owner = "google";
    repo = "brunsli";
    rev = "v${version}";
    hash = "sha256-ZcrRz2xSoRepgG8KZYY/JzgONerItW0e6mH1PYsko98=";
  };

  patches = [
    # unvendor brotli
    (fetchpatch {
      url = "https://cgit.freebsd.org/ports/plain/graphics/brunsli/files/patch-CMakeLists.txt";
      extraPrefix = "";
      hash = "sha256-/WPOG9OcEDj9ObBSXEM8Luq4Rix+PS2MvsYyHhK5mns=";
    })
    (fetchpatch {
      url = "https://cgit.freebsd.org/ports/plain/graphics/brunsli/files/patch-brunsli.cmake";
      extraPrefix = "";
      hash = "sha256-+HXA9Tin+l2St7rRUEBM0AfhAjSoFxz8UX7hsg12aFg=";
    })
  ];

  postPatch = ''
    rm -r third_party
  '' + lib.optionalString stdenv.isDarwin ''
    rm -r build
  '';

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    brotli
  ];

  meta = {
    description = "Lossless JPEG repacking library";
    homepage = "https://github.com/google/brunsli";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}