about summary refs log tree commit diff
path: root/pkgs/by-name/sd/SDL2_mixer/package.nix
blob: c271614d8f5f89a6c6baa0f66dfe1c5278e59813 (plain) (blame)
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
74
75
76
77
78
79
80
81
82
{
  lib,
  SDL2,
  darwin,
  fetchFromGitHub,
  flac,
  fluidsynth,
  libmodplug,
  libogg,
  libvorbis,
  mpg123,
  opusfile,
  pkg-config,
  smpeg2,
  stdenv,
  timidity,
}:

let
  inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "SDL2_mixer";
  version = "2.8.0";

  src = fetchFromGitHub {
    owner = "libsdl-org";
    repo = "SDL_mixer";
    rev = "release-${finalAttrs.version}";
    hash = "sha256-jLKawxnwP5dJglUhgHfWgmKh27i32Rr4LcJQdpXasco=";
  };

  nativeBuildInputs = [
    SDL2
    pkg-config
  ];

  buildInputs = lib.optionals stdenv.isDarwin [
    AudioToolbox
    AudioUnit
    CoreServices
  ];

  propagatedBuildInputs = [
    SDL2
    flac
    fluidsynth
    libmodplug
    libogg
    libvorbis
    mpg123
    opusfile
    smpeg2
    # MIDI patterns
    timidity
  ];

  outputs = [ "out" "dev" ];

  strictDeps = true;

  configureFlags = [
   (lib.enableFeature false "music-ogg-shared")
   (lib.enableFeature false "music-flac-shared")
   (lib.enableFeature false "music-mod-modplug-shared")
   (lib.enableFeature false "music-mp3-mpg123-shared")
   (lib.enableFeature false "music-opus-shared")
   (lib.enableFeature false "music-midi-fluidsynth-shared")
   (lib.enableFeature (!stdenv.isDarwin) "sdltest")
   (lib.enableFeature (!stdenv.isDarwin) "smpegtest")
   # override default path to allow MIDI files to be played
   (lib.withFeatureAs true "timidity-cfg" "${timidity}/share/timidity/timidity.cfg")
  ];

  meta = {
    homepage = "https://github.com/libsdl-org/SDL_mixer";
    description = "SDL multi-channel audio mixer library";
    license = lib.licenses.zlib;
    maintainers = with lib.maintainers; [ AndersonTorres ];
    platforms = lib.platforms.unix;
  };
})