From a9a9833f0178b9f799de6fab9e3b236a25496296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Sun, 18 Aug 2024 19:24:08 -0400 Subject: [PATCH 1/3] libwebp: format --- .../development/libraries/libwebp/default.nix | 90 ++++++++++++------- 1 file changed, 59 insertions(+), 31 deletions(-) diff --git a/pkgs/development/libraries/libwebp/default.nix b/pkgs/development/libraries/libwebp/default.nix index f788a7f59b9c6..cf2285c7368f8 100644 --- a/pkgs/development/libraries/libwebp/default.nix +++ b/pkgs/development/libraries/libwebp/default.nix @@ -1,27 +1,39 @@ -{ 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, + 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 -# 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,10 +41,10 @@ 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 = [ @@ -50,9 +62,17 @@ stdenv.mkDerivation rec { (lib.enableFeature libwebpdecoderSupport "libwebpdecoder") ]; - nativeBuildInputs = [ autoreconfHook libtool ]; - buildInputs = [ ] - ++ lib.optionals openglSupport [ libglut libGL libGLU ] + nativeBuildInputs = [ + autoreconfHook + libtool + ]; + buildInputs = + [ ] + ++ lib.optionals openglSupport [ + libglut + libGL + libGLU + ] ++ lib.optionals pngSupport [ libpng ] ++ lib.optionals jpegSupport [ libjpeg ] ++ lib.optionals tiffSupport [ libtiff ] @@ -61,7 +81,15 @@ stdenv.mkDerivation rec { 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; }; From 909c4914937137a5b19a42a78eb9252e7ce2b3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Sun, 18 Aug 2024 19:25:14 -0400 Subject: [PATCH 2/3] libwebp: build with CMake --- .../development/libraries/libwebp/default.nix | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/pkgs/development/libraries/libwebp/default.nix b/pkgs/development/libraries/libwebp/default.nix index cf2285c7368f8..abd1e1bd9afe9 100644 --- a/pkgs/development/libraries/libwebp/default.nix +++ b/pkgs/development/libraries/libwebp/default.nix @@ -2,8 +2,7 @@ lib, stdenv, fetchFromGitHub, - autoreconfHook, - libtool, + cmake, threadingSupport ? true, # multi-threading openglSupport ? false, libglut, @@ -17,12 +16,8 @@ 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 # for passthru.tests gd, @@ -47,25 +42,19 @@ stdenv.mkDerivation rec { 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 - ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ ] ++ lib.optionals openglSupport [ @@ -78,8 +67,6 @@ stdenv.mkDerivation rec { ++ lib.optionals tiffSupport [ libtiff ] ++ lib.optionals gifSupport [ giflib ]; - enableParallelBuilding = true; - passthru.tests = { inherit gd From d7fda424a65c2c0f407e59cc126c2f3360e38a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Sat, 24 Aug 2024 17:53:35 -0400 Subject: [PATCH 3/3] ladybird: remove workaround for missing libwebp CMake targets --- .../networking/browsers/ladybird/default.nix | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pkgs/applications/networking/browsers/ladybird/default.nix b/pkgs/applications/networking/browsers/ladybird/default.nix index 2c610945e3964..0efc4e3e7748d 100644 --- a/pkgs/applications/networking/browsers/ladybird/default.nix +++ b/pkgs/applications/networking/browsers/ladybird/default.nix @@ -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 = ''