1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{
lib,
SDL2,
darwin,
fetchurl,
giflib,
libXpm,
libjpeg,
libpng,
libtiff,
libwebp,
pkg-config,
stdenv,
zlib,
# Boolean flags
## Darwin headless will hang when trying to run the SDL test program
enableSdltest ? (!stdenv.isDarwin),
}:
let
inherit (darwin.apple_sdk.frameworks) Foundation;
in
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_image";
version = "2.8.2";
src = fetchurl {
url = "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-${finalAttrs.version}.tar.gz";
hash = "sha256-j0hrv7z4Rk3VjJ5dkzlKsCVc5otRxalmqRgkSCCnbdw=";
};
nativeBuildInputs = [
SDL2
pkg-config
];
buildInputs = [
SDL2
giflib
libXpm
libjpeg
libpng
libtiff
libwebp
zlib
] ++ lib.optionals stdenv.isDarwin [ Foundation ];
configureFlags = [
# Disable dynamically loaded dependencies
(lib.enableFeature false "jpg-shared")
(lib.enableFeature false "png-shared")
(lib.enableFeature false "tif-shared")
(lib.enableFeature false "webp-shared")
(lib.enableFeature enableSdltest "sdltest")
] ++ lib.optionals stdenv.isDarwin [
# Don't use native macOS frameworks
# Caution: do not set this as (!stdenv.isDarwin) since it would be true
# outside Darwin - and ImageIO does not exist outisde Darwin
(lib.enableFeature false "imageio")
];
strictDeps = true;
enableParallelBuilding = true;
meta = {
description = "SDL image library";
homepage = "https://github.com/libsdl-org/SDL_image";
license = lib.licenses.zlib;
maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ ]);
platforms = lib.platforms.unix;
};
})
|