From df6236e24aba434d5f0df53edf3795eb19fafbe1 Mon Sep 17 00:00:00 2001 From: Evy Garden Date: Sat, 19 Apr 2025 15:39:52 +0200 Subject: [PATCH] sld3-image: add option to disable stb --- pkgs/by-name/sd/sdl3-image/package.nix | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/sd/sdl3-image/package.nix b/pkgs/by-name/sd/sdl3-image/package.nix index cf9a89d5a125..7e3f265631c6 100644 --- a/pkgs/by-name/sd/sdl3-image/package.nix +++ b/pkgs/by-name/sd/sdl3-image/package.nix @@ -9,8 +9,11 @@ cmake, fetchFromGitHub, validatePkgConfig, + libpng, + libjpeg, # Boolean flags enableTests ? true, + enableSTB ? true, enableImageIO ? stdenv.hostPlatform.isDarwin, }: @@ -39,18 +42,26 @@ stdenv.mkDerivation (finalAttrs: { validatePkgConfig ]; - buildInputs = [ - sdl3 - libtiff - libwebp - libavif - ] ++ (lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Foundation); + buildInputs = + [ + sdl3 + libtiff + libwebp + libavif + ] + ++ (lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Foundation) + ++ (lib.optionals (!enableSTB) [ + libpng + libjpeg + ]); cmakeFlags = [ # fail when a dependency could not be found (lib.cmakeBool "SDLIMAGE_STRICT" true) # disable shared dependencies as they're opened at runtime using SDL_LoadObject otherwise. (lib.cmakeBool "SDLIMAGE_DEPS_SHARED" false) + # disable stbi + (lib.cmakeBool "SDLIMAGE_BACKEND_STB" enableSTB) # enable imageio backend (lib.cmakeBool "SDLIMAGE_BACKEND_IMAGEIO" enableImageIO) # enable tests