libwebp: build with cmake (#335702)
This commit is contained in:
commit
1be025f885
@ -74,18 +74,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
substituteInPlace Meta/CMake/lagom_install_options.cmake \
|
||||
--replace-fail "\''${CMAKE_INSTALL_BINDIR}" "bin" \
|
||||
--replace-fail "\''${CMAKE_INSTALL_LIBDIR}" "lib"
|
||||
|
||||
# libwebp is not built with cmake support yet
|
||||
# https://github.com/NixOS/nixpkgs/issues/334148
|
||||
cat > Meta/CMake/FindWebP.cmake <<'EOF'
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(WEBP libwebp REQUIRED)
|
||||
include_directories(''${WEBP_INCLUDE_DIRS})
|
||||
link_directories(''${WEBP_LIBRARY_DIRS})
|
||||
EOF
|
||||
substituteInPlace Userland/Libraries/LibGfx/CMakeLists.txt \
|
||||
--replace-fail 'WebP::' "" \
|
||||
--replace-fail libwebpmux webpmux
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
|
@ -1,27 +1,34 @@
|
||||
{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool
|
||||
, 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
|
||||
, 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
|
||||
{
|
||||
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
|
||||
# for passthru.tests
|
||||
gd,
|
||||
graphicsmagick,
|
||||
haskellPackages,
|
||||
imagemagick,
|
||||
imlib2,
|
||||
libjxl,
|
||||
opencv,
|
||||
python3,
|
||||
vips,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -29,39 +36,47 @@ stdenv.mkDerivation rec {
|
||||
version = "1.4.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "webmproject";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-OR/VzKNn3mnwjf+G+RkEGAaaKrhVlAu1e2oTRwdsPj8=";
|
||||
owner = "webmproject";
|
||||
repo = "libwebp";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-OR/VzKNn3mnwjf+G+RkEGAaaKrhVlAu1e2oTRwdsPj8=";
|
||||
};
|
||||
|
||||
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")
|
||||
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 = [ autoreconfHook libtool ];
|
||||
buildInputs = [ ]
|
||||
++ lib.optionals openglSupport [ libglut libGL libGLU ]
|
||||
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 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.tests = {
|
||||
inherit gd graphicsmagick imagemagick imlib2 libjxl opencv vips;
|
||||
inherit
|
||||
gd
|
||||
graphicsmagick
|
||||
imagemagick
|
||||
imlib2
|
||||
libjxl
|
||||
opencv
|
||||
vips
|
||||
;
|
||||
inherit (python3.pkgs) pillow imread;
|
||||
haskell-webp = haskellPackages.webp;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user