Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / SDL_mixer / default.nix
blob12b50cd476ba92cfac04436d70469eab4c3652af
1 { stdenv, lib, fetchurl, fetchpatch
2 , SDL, libogg, libvorbis, smpeg, libmikmod
3 , fluidsynth, pkg-config
4 , enableNativeMidi ? false
5 }:
7 stdenv.mkDerivation rec {
8   pname   = "SDL_mixer";
9   version = "1.2.12";
11   src = fetchurl {
12     url    = "http://www.libsdl.org/projects/${pname}/release/${pname}-${version}.tar.gz";
13     sha256 = "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n";
14   };
16   patches = [
17     # Fixes implicit declaration of `Mix_QuitFluidSynth`, which causes build failures with clang.
18     # https://github.com/libsdl-org/SDL_mixer/issues/287
19     (fetchpatch {
20       name = "fluidsynth-fix-implicit-declaration.patch";
21       url = "https://github.com/libsdl-org/SDL_mixer/commit/05b12a3c22c0746c29dc5478f5b7fbd8a51a1303.patch";
22       hash = "sha256-MDuViLD1w1tAVLoX2yFeJ865v21S2roi0x7Yi7GYRVU=";
23     })
24     # Backport of 2.0 fixes for incompatible function pointer conversions, fixing builds with clang.
25     (fetchpatch {
26       name = "fluidsynth-fix-function-pointer-conversions.patch";
27       url = "https://github.com/libsdl-org/SDL_mixer/commit/0c504159d212b710a47cb25c669b21730fc78edd.patch";
28       hash = "sha256-FSj7JLE2MbGVYCspoq3trXP5Ho+lAtnro2IUOHkto/U";
29     })
30     # Backport of MikMod fixes, which includes incompatible function pointer conversions.
31     (fetchpatch {
32       name = "mikmod-fixes.patch";
33       url = "https://github.com/libsdl-org/SDL_mixer/commit/a3e5ff8142cf3530cddcb27b58f871f387796ab6.patch";
34       hash = "sha256-dqD8hxx6U2HaelUx0WsGPiWuso++LjwasaAeTTGqdbk";
35     })
36     # More incompatible function pointer conversion fixes (this time in Vorbis-decoding code).
37     (fetchpatch {
38       name = "vorbis-fix-function-pointer-conversion.patch";
39       url = "https://github.com/libsdl-org/SDL_mixer/commit/9e6d7b67a00656a68ea0c2eace75c587871549b9.patch";
40       hash = "sha256-rZI3bFb/KxnduTkA/9CISccKHUgrX22KXg69sl/uXvU=";
41     })
42     (fetchpatch {
43       name = "vorbis-fix-function-pointer-conversion-header-part.patch";
44       url = "https://github.com/libsdl-org/SDL_mixer/commit/03bd4ca6aa38c1a382c892cef86296cd621ecc1d.patch";
45       hash = "sha256-7HrSHYFYVgpamP7Q9znrFZMZ72jvz5wYpJEPqWev/I4=";
46     })
47     (fetchpatch {
48       name = "vorbis-fix-function-pointer-signature.patch";
49       url = "https://github.com/libsdl-org/SDL_mixer/commit/d28cbc34d63dd20b256103c3fe506ecf3d34d379.patch";
50       hash = "sha256-sGbtF+Tcjf+6a28nJgawefeeKXnhcwu7G55e94oS9AU=";
51     })
52   ];
54   nativeBuildInputs = [ pkg-config ];
55   buildInputs = [ SDL libogg libvorbis fluidsynth smpeg libmikmod ];
57   configureFlags = [ "--disable-music-ogg-shared" "--disable-music-mod-shared" ]
58     ++ lib.optional enableNativeMidi " --enable-music-native-midi-gpl"
59     ++ lib.optionals stdenv.isDarwin [ "--disable-sdltest" "--disable-smpegtest" ];
61   meta = with lib; {
62     description = "SDL multi-channel audio mixer library";
63     homepage    = "http://www.libsdl.org/projects/SDL_mixer/";
64     maintainers = with maintainers; [ lovek323 ];
65     platforms   = platforms.unix;
66     license     = licenses.zlib;
67   };