summary refs log tree commit diff
path: root/pkgs/games/zandronum
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-12-17 15:31:45 +0300
committerNikolay Amiantov <ab@fmap.me>2016-12-17 15:47:20 +0300
commitdca2e720bc2882edfa6589abe2fea0392e200519 (patch)
tree1ec78576138c45d27b27b67fde5c922cffaeb6a5 /pkgs/games/zandronum
parent1cc9d9ef2ce80dee5c8f2ef9f8ae20ae76337d73 (diff)
downloadnixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar.gz
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar.bz2
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar.lz
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar.xz
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.tar.zst
nixpkgs-dca2e720bc2882edfa6589abe2fea0392e200519.zip
zandronum: bundle fmod, fix libraries
Diffstat (limited to 'pkgs/games/zandronum')
-rw-r--r--pkgs/games/zandronum/default.nix30
-rw-r--r--pkgs/games/zandronum/fmod.nix52
2 files changed, 70 insertions, 12 deletions
diff --git a/pkgs/games/zandronum/default.nix b/pkgs/games/zandronum/default.nix
index 39c1ea6b746..7b418559418 100644
--- a/pkgs/games/zandronum/default.nix
+++ b/pkgs/games/zandronum/default.nix
@@ -1,9 +1,11 @@
-{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper
-, SDL, mesa, bzip2, zlib, fmod, libjpeg, fluidsynth, openssl, sqlite-amalgamation
+{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper, callPackage
+, soundfont-fluid, SDL, mesa, bzip2, zlib, libjpeg, fluidsynth, openssl, sqlite-amalgamation, gtk2
 , serverOnly ? false
 }:
 
-let suffix = lib.optionalString serverOnly "-server";
+let
+  suffix = lib.optionalString serverOnly "-server";
+  fmod = callPackage ./fmod.nix { };
 
 # FIXME: drop binary package when upstream fixes their protocol versioning
 in stdenv.mkDerivation {
@@ -18,7 +20,7 @@ in stdenv.mkDerivation {
   # I have no idea why would SDL and libjpeg be needed for the server part!
   # But they are.
   buildInputs = [ openssl bzip2 zlib SDL libjpeg ]
-             ++ lib.optionals (!serverOnly) [ mesa fmod fluidsynth ];
+             ++ lib.optionals (!serverOnly) [ mesa fmod fluidsynth gtk2 ];
 
   nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
 
@@ -26,6 +28,11 @@ in stdenv.mkDerivation {
     ln -s ${sqlite-amalgamation}/* sqlite/
     sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
                                        dumb/src/it/*.c
+  '' + lib.optionalString serverOnly ''
+    sed -i \
+      -e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
+      -e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
+      src/sound/music_fluidsynth_mididevice.cpp
   '';
 
   cmakeFlags =
@@ -39,27 +46,26 @@ in stdenv.mkDerivation {
 
   installPhase = ''
     mkdir -p $out/bin
-    mkdir -p $out/share/zandronum
+    mkdir -p $out/lib/zandronum
     cp zandronum${suffix} \
-       zandronum.pk3 \
-       skulltag_actors.pk3 \
+       *.pk3 \
        ${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
-       $out/share/zandronum
+       $out/lib/zandronum
 
     # For some reason, while symlinks work for binary version, they don't for source one.
-    makeWrapper $out/share/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
+    makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
   '';
 
   postFixup = lib.optionalString (!serverOnly) ''
-    patchelf --set-rpath $(patchelf --print-rpath $out/share/zandronum/zandronum):$out/share/zandronum \
-      $out/share/zandronum/zandronum
+    patchelf --set-rpath $(patchelf --print-rpath $out/lib/zandronum/zandronum):$out/lib/zandronum \
+      $out/lib/zandronum/zandronum
   '';
 
   meta = with stdenv.lib; {
     homepage = http://zandronum.com/;
     description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
     maintainers = with maintainers; [ lassulus ];
-    license = stdenv.lib.licenses.unfree;
+    license = licenses.unfreeRedistributable;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/games/zandronum/fmod.nix b/pkgs/games/zandronum/fmod.nix
new file mode 100644
index 00000000000..b45ec24ca6b
--- /dev/null
+++ b/pkgs/games/zandronum/fmod.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl }:
+
+assert (stdenv.system == "x86_64-linux") || (stdenv.system == "i686-linux");
+let
+  bits = stdenv.lib.optionalString (stdenv.system == "x86_64-linux") "64";
+
+  libPath = stdenv.lib.makeLibraryPath
+    [ stdenv.cc.libc stdenv.cc.cc ] + ":${stdenv.cc.cc.lib}/lib64";
+  patchLib = x: "patchelf --set-rpath ${libPath} ${x}";
+
+  src =
+    (if (bits == "64") then
+      fetchurl {
+        url = "http://zandronum.com/essentials/fmod/fmodapi42416linux64.tar.gz";
+        sha256 = "0hkwlzchzzgd7fanqznbv5bs53z2qy8iiv9l2y77l4sg1jwmlm6y";
+      }
+    else
+      fetchurl {
+        url = "http://zandronum.com/essentials/fmod/fmodapi42416linux.tar.gz";
+        sha256 = "13diw3ax2slkr99mwyjyc62b8awc30k0z08cvkpk2p3i1j6f85m5";
+      }
+    );
+in
+stdenv.mkDerivation rec {
+  inherit src;
+
+  name    = "fmod-${version}";
+  version = "4.24.16";
+
+  dontStrip = true;
+  dontPatchELF = true;
+  dontBuild = true;
+
+  makeFlags = [ "DESTLIBDIR=$(out)/lib" "DESTHDRDIR=$(out)/include" ];
+
+  preInstall = ''
+    mkdir -p $out/lib
+  '';
+
+  postInstall = ''
+    mv $out/lib/libfmodex${bits}-${version}.so $out/lib/libfmodex.so
+    mv $out/lib/libfmodexp${bits}-${version}.so $out/lib/libfmodexp.so
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Programming library and toolkit for the creation and playback of interactive audio";
+    homepage    = "http://www.fmod.org/";
+    license     = licenses.unfreeRedistributable;
+    platforms   = platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.lassulus ];
+  };
+}