nixpkgs/pkgs/by-name/sd/SDL_image/package.nix
Randy Eckenrode 97d56a3365
SDL_image: fix build with clang 16
Use the correct function pointer types to avoid incompatible function pointer type assignment errors with clang 16. Also disable `webp-shared` like the other image formats already do and add it as an explicit dependency.
2024-07-24 23:51:35 -04:00

76 lines
1.6 KiB
Nix

{
lib,
SDL,
fetchpatch,
fetchurl,
giflib,
libXpm,
libjpeg,
libpng,
libtiff,
libwebp,
pkg-config,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_image";
version = "1.2.12";
src = fetchurl {
url = "https://www.libsdl.org/projects/SDL_image/release/SDL_image-${finalAttrs.version}.tar.gz";
hash = "sha256-C5ByKYRWEATehIR3RNVmgJ27na9zKp5QO5GhtahOVpk=";
};
patches = [
# Fixed security vulnerability in XCF image loader
(fetchpatch {
name = "CVE-2017-2887";
url = "https://github.com/libsdl-org/SDL_image/commit/e7723676825cd2b2ffef3316ec1879d7726618f2.patch";
includes = [ "IMG_xcf.c" ];
hash = "sha256-Z0nyEtE1LNGsGsN9SFG8ZyPDdunmvg81tUnEkrJQk5w=";
})
# Fixes incompatible function pointer type errors with clang 16
./clang16-webp-errors.patch
];
configureFlags = [
# Disable dynamic loading or else dlopen will fail because of no proper
# rpath
(lib.enableFeature false "jpg-shared")
(lib.enableFeature false "png-shared")
(lib.enableFeature false "tif-shared")
(lib.enableFeature false "webp-shared")
(lib.enableFeature (!stdenv.isDarwin) "sdltest")
];
nativeBuildInputs = [
SDL
pkg-config
];
buildInputs = [
SDL
giflib
libXpm
libjpeg
libpng
libtiff
libwebp
];
outputs = [
"out"
"dev"
];
strictDeps = true;
meta = {
homepage = "http://www.libsdl.org/projects/SDL_image/";
description = "SDL image library";
license = lib.licenses.zlib;
maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ ]);
inherit (SDL.meta) platforms;
};
})