diff --git a/pkgs/by-name/sd/SDL_image/package.nix b/pkgs/by-name/sd/SDL_image/package.nix index 30f71bd3e520..7d8576bb5662 100644 --- a/pkgs/by-name/sd/SDL_image/package.nix +++ b/pkgs/by-name/sd/SDL_image/package.nix @@ -1,38 +1,69 @@ -{ lib, stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, giflib, libXpm, pkg-config }: +{ + lib, + SDL, + fetchpatch, + fetchurl, + giflib, + libXpm, + libjpeg, + libpng, + libtiff, + pkg-config, + stdenv, +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL_image"; version = "1.2.12"; src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_image/release/${pname}-${version}.tar.gz"; - sha256 = "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"; + 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" ]; - sha256 = "174ka2r95i29nlshzgp6x5vc68v7pi8lhzf33and2b1ms49g4jb7"; + hash = "sha256-Z0nyEtE1LNGsGsN9SFG8ZyPDdunmvg81tUnEkrJQk5w="; }) ]; configureFlags = [ - # Disable its dynamic loading or dlopen will fail because of no proper rpath - "--disable-jpg-shared" - "--disable-png-shared" - "--disable-tif-shared" - ] ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + # 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 (!stdenv.isDarwin) "sdltest") + ]; - nativeBuildInputs = [ pkg-config ]; - buildInputs = [ SDL libpng libjpeg libtiff giflib libXpm ]; + nativeBuildInputs = [ + SDL + pkg-config + ]; - meta = with lib; { + buildInputs = [ + SDL + giflib + libXpm + libjpeg + libpng + libtiff + ]; + + outputs = [ "out" "dev" ]; + + strictDeps = true; + + meta = { + homepage = "http://www.libsdl.org/projects/SDL_image/"; description = "SDL image library"; - homepage = "http://www.libsdl.org/projects/SDL_image/"; - maintainers = with maintainers; [ lovek323 ]; - platforms = platforms.unix; - license = licenses.zlib; + license = lib.licenses.zlib; + maintainers = lib.teams.sdl.members + ++ (with lib.maintainers; [ lovek323 ]); + inherit (SDL.meta) platforms; }; -} +})