2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool
|
2020-04-24 23:36:52 +00:00
|
|
|
, threadingSupport ? true # multi-threading
|
2022-05-18 14:49:53 +00:00
|
|
|
, 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
|
2020-04-24 23:36:52 +00:00
|
|
|
, 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
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
# for passthru.tests
|
|
|
|
, freeimage
|
|
|
|
, gd
|
|
|
|
, graphicsmagick
|
|
|
|
, haskellPackages
|
|
|
|
, imagemagick
|
|
|
|
, imlib2
|
|
|
|
, libjxl
|
|
|
|
, opencv
|
|
|
|
, python3
|
|
|
|
, vips
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libwebp";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "1.2.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "webmproject";
|
|
|
|
repo = pname;
|
2021-12-26 17:43:05 +00:00
|
|
|
rev = "v${version}";
|
2022-09-09 14:08:57 +00:00
|
|
|
hash = "sha256-XX6qOWlIl8TqOQMiGpmmDVKwQnM1taG6lrqq1ZFVk5s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [
|
2022-08-12 12:06:08 +00:00
|
|
|
(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")
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook libtool ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ ]
|
2022-08-12 12:06:08 +00:00
|
|
|
++ lib.optionals openglSupport [ freeglut libGL libGLU ]
|
|
|
|
++ lib.optionals pngSupport [ libpng ]
|
|
|
|
++ lib.optionals jpegSupport [ libjpeg ]
|
|
|
|
++ lib.optionals tiffSupport [ libtiff ]
|
|
|
|
++ lib.optionals gifSupport [ giflib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit freeimage gd graphicsmagick imagemagick imlib2 libjxl opencv vips;
|
|
|
|
inherit (python3.pkgs) pillow imread;
|
|
|
|
haskell-webp = haskellPackages.webp;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tools and library for the WebP image format";
|
|
|
|
homepage = "https://developers.google.com/speed/webp/";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ ajs124 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|