1{ lib, stdenv
2, fetchurl
3, pkg-config
4, AudioToolbox
5, AudioUnit
6, CoreServices
7, SDL2
8, flac
9, fluidsynth
10, libmodplug
11, libogg
12, libvorbis
13, mpg123
14, opusfile
15, smpeg2
16, timidity
17}:
18
19stdenv.mkDerivation rec {
20 pname = "SDL2_mixer";
21 version = "2.6.3";
22
23 src = fetchurl {
24 url = "https://www.libsdl.org/projects/SDL_mixer/release/${pname}-${version}.tar.gz";
25 sha256 = "sha256-emuoakeGSM5hfjpekncYG8Z/fOmHZgXupq/9Sg1u6o8=";
26 };
27
28 configureFlags = [
29 "--disable-music-ogg-shared"
30 "--disable-music-flac-shared"
31 "--disable-music-mod-modplug-shared"
32 "--disable-music-mp3-mpg123-shared"
33 "--disable-music-opus-shared"
34 "--disable-music-midi-fluidsynth-shared"
35
36 # override default path to allow MIDI files to be played
37 "--with-timidity-cfg=${timidity}/share/timidity/timidity.cfg"
38 ] ++ lib.optionals stdenv.isDarwin [
39 "--disable-sdltest"
40 "--disable-smpegtest"
41 ];
42
43 nativeBuildInputs = [ pkg-config ];
44
45 buildInputs = lib.optionals stdenv.isDarwin [
46 AudioToolbox
47 AudioUnit
48 CoreServices
49 ];
50
51 propagatedBuildInputs = [
52 SDL2
53 flac
54 fluidsynth
55 libmodplug
56 libogg
57 libvorbis
58 mpg123
59 opusfile
60 smpeg2
61 # MIDI patterns
62 timidity
63 ];
64
65 outputs = [ "out" "dev" ];
66
67 meta = with lib; {
68 description = "SDL multi-channel audio mixer library";
69 platforms = platforms.unix;
70 homepage = "https://github.com/libsdl-org/SDL_mixer";
71 maintainers = with maintainers; [ MP2E ];
72 license = licenses.zlib;
73 };
74}