about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-05-10 23:54:38 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-05-10 23:58:12 -0500
commitb45552c35aea6e2cd3ef1edb877574fcec191859 (patch)
treeaedff2f6d5dffca3b99a0fac9461996e09449d5d /pkgs/games
parenta0ab41ca96cc632ee8f840e66a27101e73683db2 (diff)
downloadnixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar.gz
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar.bz2
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar.lz
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar.xz
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.tar.zst
nixlib-b45552c35aea6e2cd3ef1edb877574fcec191859.zip
fmod: supports darwin
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/zandronum/fmod.nix22
1 files changed, 16 insertions, 6 deletions
diff --git a/pkgs/games/zandronum/fmod.nix b/pkgs/games/zandronum/fmod.nix
index 7f76101d8ce1..2c53d93e4011 100644
--- a/pkgs/games/zandronum/fmod.nix
+++ b/pkgs/games/zandronum/fmod.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, alsaLib, libpulseaudio }:
+{ stdenv, lib, fetchurl, alsaLib, libpulseaudio, undmg }:
 
 let
   bits = stdenv.lib.optionalString (stdenv.system == "x86_64-linux") "64";
@@ -8,20 +8,30 @@ in
 stdenv.mkDerivation rec {
   name = "fmod-${version}";
   version = "4.44.64";
+  shortVersion = builtins.replaceStrings [ "." ] [ "" ] version;
 
-  src = fetchurl {
-    url = "https://zdoom.org/files/fmod/fmodapi44464linux.tar.gz";
+  src = fetchurl (if stdenv.isLinux then {
+    url = "https://zdoom.org/files/fmod/fmodapi${shortVersion}linux.tar.gz";
     sha256 = "047hk92xapwwqj281f4zwl0ih821rrliya70gfj82sdfjh9lz8i1";
-  };
+  } else {
+    url = "https://zdoom.org/files/fmod/fmodapi${shortVersion}mac-installer.dmg";
+    sha256 = "1m1y4cpcwpkl8x31d3s68xzp107f343ma09w2437i2adn5y7m8ii";
+  });
+
+  nativeBuildInputs = [ undmg ];
 
   dontStrip = true;
   dontPatchELF = true;
   dontBuild = true;
 
-  installPhase = ''
+  installPhase = lib.optionalString stdenv.isLinux ''
     install -Dm755 api/lib/libfmodex${bits}-${version}.so $out/lib/libfmodex-${version}.so
     ln -s libfmodex-${version}.so $out/lib/libfmodex.so
     patchelf --set-rpath ${libPath} $out/lib/libfmodex.so
+  '' + lib.optionalString stdenv.isDarwin ''
+    install -D api/lib/libfmodex.dylib $out/lib/libfmodex.dylib
+    install -D api/lib/libfmodexL.dylib $out/lib/libfmodexL.dylib
+  '' + ''
     cp -r api/inc $out/include
   '';
 
@@ -29,7 +39,7 @@ stdenv.mkDerivation rec {
     description = "Programming library and toolkit for the creation and playback of interactive audio";
     homepage    = http://www.fmod.org/;
     license     = licenses.unfreeRedistributable;
-    platforms   = [ "x86_64-linux" "i686-linux" ];
+    platforms   = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
     maintainers = [ maintainers.lassulus ];
   };
 }