zandronum: bundle fmod, fix libraries

This commit is contained in:
Nikolay Amiantov 2016-12-17 15:31:45 +03:00
parent 1cc9d9ef2c
commit dca2e720bc
3 changed files with 70 additions and 13 deletions

View File

@ -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;
};
}

View File

@ -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 ];
};
}

View File

@ -16124,7 +16124,6 @@ in
xsokoban = callPackage ../games/xsokoban { };
zandronum = callPackage ../games/zandronum {
fmod = fmod42416;
cmake = cmake_2_8;
};