1 { lib, stdenv, fetchFromGitHub, autoreconfHook, libtool
2 , threadingSupport ? true # multi-threading
3 , openglSupport ? false, freeglut ? null, libGL ? null, libGLU ? null # OpenGL (required for vwebp)
4 , pngSupport ? true, libpng ? null # PNG image format
5 , jpegSupport ? true, libjpeg ? null # JPEG image format
6 , tiffSupport ? true, libtiff ? null # TIFF image format
7 , gifSupport ? true, giflib ? null # GIF image format
8 #, wicSupport ? true # Windows Imaging Component
9 , alignedSupport ? false # Force aligned memory operations
10 , swap16bitcspSupport ? false # Byte swap for 16bit color spaces
11 , experimentalSupport ? false # Experimental code
12 , libwebpmuxSupport ? true # Build libwebpmux
13 , libwebpdemuxSupport ? true # Build libwebpdemux
14 , libwebpdecoderSupport ? true # Build libwebpdecoder
17 assert openglSupport -> freeglut != null && libGL != null && libGLU != null;
18 assert pngSupport -> (libpng != null);
19 assert jpegSupport -> (libjpeg != null);
20 assert tiffSupport -> (libtiff != null);
21 assert gifSupport -> (giflib != null);
24 mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
28 stdenv.mkDerivation rec {
32 src = fetchFromGitHub {
33 owner = "webmproject";
36 sha256 = "1kl6qqa29ygqb2fpv140y59v539gdqx4vcf3mlaxhca2bks98qgm";
39 prePatch = "patchShebangs .";
42 (mkFlag threadingSupport "threading")
43 (mkFlag openglSupport "gl")
44 (mkFlag pngSupport "png")
45 (mkFlag jpegSupport "jpeg")
46 (mkFlag tiffSupport "tiff")
47 (mkFlag gifSupport "gif")
48 #(mkFlag (wicSupport && stdenv.isCygwin) "wic")
49 (mkFlag alignedSupport "aligned")
50 (mkFlag swap16bitcspSupport "swap-16bit-csp")
51 (mkFlag experimentalSupport "experimental")
52 (mkFlag libwebpmuxSupport "libwebpmux")
53 (mkFlag libwebpdemuxSupport "libwebpdemux")
54 (mkFlag libwebpdecoderSupport "libwebpdecoder")
57 nativeBuildInputs = [ autoreconfHook libtool ];
59 ++ optionals openglSupport [ freeglut libGL libGLU ]
60 ++ optional pngSupport libpng
61 ++ optional jpegSupport libjpeg
62 ++ optional tiffSupport libtiff
63 ++ optional gifSupport giflib;
65 enableParallelBuilding = true;
68 description = "Tools and library for the WebP image format";
69 homepage = "https://developers.google.com/speed/webp/";
70 license = licenses.bsd3;
71 platforms = platforms.all;
72 maintainers = with maintainers; [ codyopel ];