base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / sd / SDL_mixer / package.nix
blob84af162a738469e87c3dce53680cc2680513c052
2   lib,
3   SDL,
4   fetchpatch,
5   fetchurl,
6   fluidsynth,
7   libmikmod,
8   libogg,
9   libvorbis,
10   pkg-config,
11   smpeg,
12   stdenv,
13   # Boolean flags
14   enableNativeMidi ? false,
15   enableSdltest ? (!stdenv.hostPlatform.isDarwin),
16   enableSmpegtest ? (!stdenv.hostPlatform.isDarwin),
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "SDL_mixer";
21   version = "1.2.12";
23   src = fetchurl {
24     url = "http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-${finalAttrs.version}.tar.gz";
25     hash = "sha256-FkQwgnmpdXmQSeSCavLPx4fK0quxGqFFYuQCUh+GmSo=";
26   };
28   patches = [
29     # Fixes implicit declaration of `Mix_QuitFluidSynth`, which causes build failures with clang.
30     # https://github.com/libsdl-org/SDL_mixer/issues/287
31     (fetchpatch {
32       name = "fluidsynth-fix-implicit-declaration.patch";
33       url = "https://github.com/libsdl-org/SDL_mixer/commit/05b12a3c22c0746c29dc5478f5b7fbd8a51a1303.patch";
34       hash = "sha256-MDuViLD1w1tAVLoX2yFeJ865v21S2roi0x7Yi7GYRVU=";
35     })
36     # Backport of 2.0 fixes for incompatible function pointer conversions, fixing builds with clang.
37     (fetchpatch {
38       name = "fluidsynth-fix-function-pointer-conversions.patch";
39       url = "https://github.com/libsdl-org/SDL_mixer/commit/0c504159d212b710a47cb25c669b21730fc78edd.patch";
40       hash = "sha256-FSj7JLE2MbGVYCspoq3trXP5Ho+lAtnro2IUOHkto/U";
41     })
42     # Backport of MikMod fixes, which includes incompatible function pointer conversions.
43     (fetchpatch {
44       name = "mikmod-fixes.patch";
45       url = "https://github.com/libsdl-org/SDL_mixer/commit/a3e5ff8142cf3530cddcb27b58f871f387796ab6.patch";
46       hash = "sha256-dqD8hxx6U2HaelUx0WsGPiWuso++LjwasaAeTTGqdbk=";
47     })
48     # More incompatible function pointer conversion fixes (this time in Vorbis-decoding code).
49     (fetchpatch {
50       name = "vorbis-fix-function-pointer-conversion.patch";
51       url = "https://github.com/libsdl-org/SDL_mixer/commit/9e6d7b67a00656a68ea0c2eace75c587871549b9.patch";
52       hash = "sha256-rZI3bFb/KxnduTkA/9CISccKHUgrX22KXg69sl/uXvU=";
53     })
54     (fetchpatch {
55       name = "vorbis-fix-function-pointer-conversion-header-part.patch";
56       url = "https://github.com/libsdl-org/SDL_mixer/commit/03bd4ca6aa38c1a382c892cef86296cd621ecc1d.patch";
57       hash = "sha256-7HrSHYFYVgpamP7Q9znrFZMZ72jvz5wYpJEPqWev/I4=";
58     })
59     (fetchpatch {
60       name = "vorbis-fix-function-pointer-signature.patch";
61       url = "https://github.com/libsdl-org/SDL_mixer/commit/d28cbc34d63dd20b256103c3fe506ecf3d34d379.patch";
62       hash = "sha256-sGbtF+Tcjf+6a28nJgawefeeKXnhcwu7G55e94oS9AU=";
63     })
64   ];
66   nativeBuildInputs = [
67     SDL
68     pkg-config
69     smpeg
70   ];
72   buildInputs = [
73     SDL
74     fluidsynth
75     libmikmod
76     libogg
77     libvorbis
78     smpeg
79   ];
81   configureFlags = [
82     (lib.enableFeature false "music-ogg-shared")
83     (lib.enableFeature false "music-mod-shared")
84     (lib.enableFeature enableNativeMidi "music-native-midi-gpl")
85     (lib.enableFeature enableSdltest "sdltest")
86     (lib.enableFeature enableSmpegtest "smpegtest")
87   ];
89   outputs = [ "out" "dev" ];
91   strictDeps = true;
93   meta = {
94     description = "SDL multi-channel audio mixer library";
95     homepage = "http://www.libsdl.org/projects/SDL_mixer/";
96     maintainers = lib.teams.sdl.members
97                   ++ (with lib.maintainers; [ ]);
98     license = lib.licenses.zlib;
99     inherit (SDL.meta) platforms;
100   };