1 { stdenv, lib, fetchurl, alsa-lib, libpulseaudio, undmg }:
4 bits = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
5 libPath = lib.makeLibraryPath [ stdenv.cc.cc alsa-lib libpulseaudio ];
8 stdenv.mkDerivation rec {
11 shortVersion = builtins.replaceStrings [ "." ] [ "" ] version;
13 src = fetchurl (if stdenv.isLinux then {
14 url = "https://zdoom.org/files/fmod/fmodapi${shortVersion}linux.tar.gz";
15 sha256 = "047hk92xapwwqj281f4zwl0ih821rrliya70gfj82sdfjh9lz8i1";
17 url = "https://zdoom.org/files/fmod/fmodapi${shortVersion}mac-installer.dmg";
18 sha256 = "1m1y4cpcwpkl8x31d3s68xzp107f343ma09w2437i2adn5y7m8ii";
21 nativeBuildInputs = [ undmg ];
27 installPhase = lib.optionalString stdenv.isLinux ''
28 install -Dm755 api/lib/libfmodex${bits}-${version}.so $out/lib/libfmodex-${version}.so
29 ln -s libfmodex-${version}.so $out/lib/libfmodex.so
30 patchelf --set-rpath ${libPath} $out/lib/libfmodex.so
31 '' + lib.optionalString stdenv.isDarwin ''
32 install -D api/lib/libfmodex.dylib $out/lib/libfmodex.dylib
33 install -D api/lib/libfmodexL.dylib $out/lib/libfmodexL.dylib
35 cp -r api/inc $out/include
39 description = "Programming library and toolkit for the creation and playback of interactive audio";
40 homepage = "http://www.fmod.org/";
41 license = licenses.unfreeRedistributable;
42 platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
43 maintainers = [ maintainers.lassulus ];