zandronum: sound improvements

* Update fmod version to one with PulseAudio support;
* Dynamically link FluidSynth instead of using LD_LIBRARY_PATH;
* Use system libgme.

Fixes sound on some machines.
This commit is contained in:
Nikolay Amiantov 2018-03-05 17:32:10 +03:00
parent 94f0ef6628
commit f7c2288cfc
2 changed files with 31 additions and 44 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper, callPackage
, soundfont-fluid, SDL, libGLU_combined, glew, bzip2, zlib, libjpeg, fluidsynth, openssl, gtk2, python3
, soundfont-fluid, SDL, libGL, glew, bzip2, zlib, libjpeg, fluidsynth, openssl, gtk2, python3, libgme
, serverOnly ? false
}:
@ -7,6 +7,7 @@ let
suffix = lib.optionalString serverOnly "-server";
fmod = callPackage ./fmod.nix { };
sqlite = callPackage ./sqlite.nix { };
clientLibPath = lib.makeLibraryPath [ fluidsynth ];
in stdenv.mkDerivation {
name = "zandronum${suffix}-3.0";
@ -27,8 +28,8 @@ 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 sqlite ]
++ lib.optionals (!serverOnly) [ libGLU_combined glew fmod fluidsynth gtk2 ];
buildInputs = [ openssl bzip2 zlib SDL libjpeg sqlite libgme ]
++ lib.optionals (!serverOnly) [ libGL glew fmod fluidsynth gtk2 ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper python3 ];
@ -44,9 +45,10 @@ in stdenv.mkDerivation {
'';
cmakeFlags =
lib.optional (!serverOnly) "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so"
++ lib.optional serverOnly "-DSERVERONLY=ON"
;
[ "-DFORCE_INTERNAL_GME=OFF" ]
++ (if serverOnly
then [ "-DSERVERONLY=ON" ]
else [ "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so" ]);
enableParallelBuilding = true;
@ -59,16 +61,18 @@ in stdenv.mkDerivation {
*.pk3 \
${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
$out/lib/zandronum
'' + (if (!serverOnly) then
''makeWrapper $out/lib/zandronum/zandronum $out/bin/zandronum --prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH:${fluidsynth}/lib"''
else
''makeWrapper $out/lib/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/lib/zandronum/zandronum):$out/lib/zandronum \
patchelf --set-rpath $(patchelf --print-rpath $out/lib/zandronum/zandronum):$out/lib/zandronum:${clientLibPath} \
$out/lib/zandronum/zandronum
'';
passthru = {
inherit fmod sqlite;
};
meta = with stdenv.lib; {
homepage = http://zandronum.com/;
description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";

View File

@ -1,52 +1,35 @@
{ stdenv, fetchurl }:
{ stdenv, lib, fetchurl, alsaLib, libpulseaudio }:
assert (stdenv.system == "x86_64-linux") || (stdenv.system == "i686-linux");
let
bits = stdenv.lib.optionalString (stdenv.system == "x86_64-linux") "64";
libPath = lib.makeLibraryPath [ stdenv.cc.cc alsaLib libpulseaudio ];
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.44.64";
name = "fmod-${version}";
version = "4.24.16";
src = fetchurl {
url = "https://zdoom.org/files/fmod/fmodapi44464linux.tar.gz";
sha256 = "047hk92xapwwqj281f4zwl0ih821rrliya70gfj82sdfjh9lz8i1";
};
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
installPhase = ''
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
cp -r api/inc $out/include
'';
meta = with stdenv.lib; {
description = "Programming library and toolkit for the creation and playback of interactive audio";
homepage = "http://www.fmod.org/";
homepage = http://www.fmod.org/;
license = licenses.unfreeRedistributable;
platforms = platforms.linux;
maintainers = [ stdenv.lib.maintainers.lassulus ];
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = [ maintainers.lassulus ];
};
}