summary refs log tree commit diff
path: root/pkgs/development/libraries/libwebp/default.nix
blob: f90de7fc6effe941f3ffbc2583129b90e77ee679 (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
57
58
59
60
61
{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool
, threadingSupport ? true # multi-threading
, openglSupport ? false, freeglut, libGL, libGLU # OpenGL (required for vwebp)
, pngSupport ? true, libpng # PNG image format
, jpegSupport ? true, libjpeg # JPEG image format
, tiffSupport ? true, libtiff # TIFF image format
, gifSupport ? true, giflib # GIF image format
, alignedSupport ? false # Force aligned memory operations
, swap16bitcspSupport ? false # Byte swap for 16bit color spaces
, experimentalSupport ? false # Experimental code
, libwebpmuxSupport ? true # Build libwebpmux
, libwebpdemuxSupport ? true # Build libwebpdemux
, libwebpdecoderSupport ? true # Build libwebpdecoder
}:

stdenv.mkDerivation rec {
  pname = "libwebp";
  version = "1.2.2";

  src = fetchFromGitHub {
    owner  = "webmproject";
    repo   = pname;
    rev    = "v${version}";
    hash   = "sha256-WF2HZPS7mbotk+d1oLM/JC5l/FWfkrk+T3Z6EW9oYEI=";
  };

  prePatch = "patchShebangs .";

  configureFlags = [
    (lib.enableFeature threadingSupport "threading")
    (lib.enableFeature openglSupport "gl")
    (lib.enableFeature pngSupport "png")
    (lib.enableFeature jpegSupport "jpeg")
    (lib.enableFeature tiffSupport "tiff")
    (lib.enableFeature gifSupport "gif")
    (lib.enableFeature alignedSupport "aligned")
    (lib.enableFeature swap16bitcspSupport "swap-16bit-csp")
    (lib.enableFeature experimentalSupport "experimental")
    (lib.enableFeature libwebpmuxSupport "libwebpmux")
    (lib.enableFeature libwebpdemuxSupport "libwebpdemux")
    (lib.enableFeature libwebpdecoderSupport "libwebpdecoder")
  ];

  nativeBuildInputs = [ autoreconfHook libtool ];
  buildInputs = [ ]
    ++ lib.optionals openglSupport [ freeglut libGL libGLU ]
    ++ lib.optionals pngSupport [ libpng ]
    ++ lib.optionals jpegSupport [ libjpeg ]
    ++ lib.optionals tiffSupport [ libtiff ]
    ++ lib.optionals gifSupport [ giflib ];

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Tools and library for the WebP image format";
    homepage = "https://developers.google.com/speed/webp/";
    license = licenses.bsd3;
    platforms = platforms.all;
    maintainers = with maintainers; [ ajs124 ];
  };
}