Files
nixpkgs/pkgs/by-name/li/libwebp/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

105 lines
2.5 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
threadingSupport ? true, # multi-threading
openglSupport ? false,
libglut,
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
swap16bitcspSupport ? false, # Byte swap for 16bit color spaces
libwebpmuxSupport ? true, # Build libwebpmux
# for passthru.tests
gd,
graphicsmagick,
haskellPackages,
imagemagick,
imlib2,
libjxl,
opencv,
python3,
vips,
testers,
libwebp,
}:
stdenv.mkDerivation rec {
pname = "libwebp";
version = "1.6.0";
src = fetchFromGitHub {
owner = "webmproject";
repo = "libwebp";
rev = "v${version}";
hash = "sha256-7i4fGBTsTjAkBzCjVqXqX4n22j6dLgF/0mz4ajNA45U=";
};
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
(lib.cmakeBool "WEBP_USE_THREAD" threadingSupport)
(lib.cmakeBool "WEBP_BUILD_VWEBP" openglSupport)
(lib.cmakeBool "WEBP_BUILD_IMG2WEBP" (pngSupport || jpegSupport || tiffSupport))
(lib.cmakeBool "WEBP_BUILD_GIF2WEBP" gifSupport)
(lib.cmakeBool "WEBP_BUILD_ANIM_UTILS" false) # Not installed
(lib.cmakeBool "WEBP_BUILD_EXTRAS" false) # Not installed
(lib.cmakeBool "WEBP_ENABLE_SWAP_16BIT_CSP" swap16bitcspSupport)
(lib.cmakeBool "WEBP_BUILD_LIBWEBPMUX" libwebpmuxSupport)
];
nativeBuildInputs = [ cmake ];
buildInputs =
[ ]
++ lib.optionals openglSupport [
libglut
libGL
libGLU
]
++ lib.optionals pngSupport [ libpng ]
++ lib.optionals jpegSupport [ libjpeg ]
++ lib.optionals tiffSupport [ libtiff ]
++ lib.optionals gifSupport [ giflib ];
passthru.tests = {
inherit
gd
graphicsmagick
imagemagick
imlib2
libjxl
opencv
vips
;
inherit (python3.pkgs) pillow imread;
haskell-webp = haskellPackages.webp;
pkg-config = testers.hasPkgConfigModules { package = libwebp; };
};
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 ];
pkgConfigModules = [
# configure_pkg_config() calls for these are unconditional
"libwebp"
"libwebpdecoder"
"libwebpdemux"
"libsharpyuv"
]
++ lib.optionals libwebpmuxSupport [
"libwebpmux"
];
};
}