3
0
Fork 0
forked from mirrors/nixpkgs

zandronum: unify packages, fix building, cleanup

This commit is contained in:
Nikolay Amiantov 2015-12-12 20:29:39 +03:00
parent 94a07ab3ae
commit 2678e0ce02
4 changed files with 63 additions and 91 deletions

View file

@ -18,10 +18,9 @@
, zlib
}:
assert stdenv.system == "x86_64-linux";
stdenv.mkDerivation rec {
name = "zandronum-2.1.2";
src = fetchurl {
url = "http://zandronum.com/downloads/zandronum2.1.2-linux-x86_64.tar.bz2";
sha256 = "1f5aw2m8c0bl3lrvi2k3rrzq3q9x1ikxnxxjgh3k9qvanfn7ykbk";
@ -49,38 +48,30 @@ stdenv.mkDerivation rec {
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
tar xf $src
'';
sourceRoot = ".";
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share
cp * $out/share
mkdir -p $out/share/zandronum
cp *.so *.pk3 zandronum zandronum-server $out/share/zandronum
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $out/share/zandronum
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $out/share/zandronum-server
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath $libPath:$out/share/zandronum \
$out/share/zandronum/zandronum
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath $libPath \
$out/share/zandronum/zandronum-server
cat > $out/bin/zandronum << EOF
#!/bin/sh
LD_LIBRARY_PATH=$libPath:$out/share $out/share/zandronum "\$@"
EOF
cat > $out/bin/zandronum-server << EOF
#!/bin/sh
LD_LIBRARY_PATH=$libPath:$out/share $out/share/zandronum-server "\$@"
EOF
chmod +x "$out/bin/zandronum"
chmod +x "$out/bin/zandronum-server"
ln -s $out/share/zandronum/zandronum $out/bin/zandronum
ln -s $out/share/zandronum/zandronum-server $out/bin/zandronum-server
'';
meta = {
homepage = http://zandronum.com/;
description = "multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software. Binary version for online play.";
maintainer = [ stdenv.lib.maintainers.lassulus ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -1,43 +1,61 @@
{ stdenv, fetchhg, cmake, SDL, mesa, fmod42416, openssl, sqlite, sqlite-amalgamation }:
{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper
, SDL, mesa, bzip2, zlib, fmod, libjpeg, fluidsynth, openssl, sqlite-amalgamation
, serverOnly ? false
}:
let suffix = lib.optionalString serverOnly "-server";
# FIXME: drop binary package when upstream fixes their protocol versioning
in stdenv.mkDerivation {
name = "zandronum${suffix}-2.1.2";
stdenv.mkDerivation {
name = "zandronum-2.1.2";
src = fetchhg {
url = "https://bitbucket.org/Torr_Samaho/zandronum-stable";
rev = "a3663b0061d5";
sha256 = "0qwsnbwhcldwrirfk6hpiklmcj3a7dzh6pn36nizci6pcza07p56";
};
phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ];
# 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 ];
buildInputs = [ cmake SDL mesa fmod42416 openssl sqlite sqlite-amalgamation ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
preConfigure = ''
cp ${sqlite-amalgamation}/* sqlite/
ln -s ${sqlite-amalgamation}/* sqlite/
'';
cmakeFlags = [
"-DFMOD_LIBRARY=${fmod42416}/lib/libfmodex.so"
];
cmakeFlags =
lib.optional (!serverOnly) "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so"
++ lib.optional serverOnly "-DSERVERONLY=ON"
;
enableParallelBuilding = true;
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share
cp zandronum zandronum.pk3 skulltag_actors.pk3 liboutput_sdl.so $out/share
mkdir -p $out/share/zandronum
cp zandronum${suffix} \
zandronum.pk3 \
skulltag_actors.pk3 \
${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
$out/share/zandronum
cat > $out/bin/zandronum << EOF
#!/bin/sh
LD_LIBRARY_PATH=$out/share $out/share/zandronum "\$@"
EOF
chmod +x "$out/bin/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}
'';
meta = {
postFixup = lib.optionalString (!serverOnly) ''
patchelf --set-rpath $(patchelf --print-rpath $out/share/zandronum/zandronum):$out/share/zandronum \
$out/share/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.";
maintainer = [ stdenv.lib.maintainers.lassulus ];
maintainer = with maintainers; [ lassulus ];
platforms = platforms.linux;
license = licenses.bsdOriginal;
};
}

View file

@ -1,44 +0,0 @@
{ stdenv, fetchhg, cmake, openssl, sqlite, sqlite-amalgamation, SDL }:
stdenv.mkDerivation {
name = "zandronum-server-2.1.2";
src = fetchhg {
url = "https://bitbucket.org/Torr_Samaho/zandronum-stable";
rev = "a3663b0061d5";
sha256 = "0qwsnbwhcldwrirfk6hpiklmcj3a7dzh6pn36nizci6pcza07p56";
};
phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ];
buildInputs = [ cmake openssl sqlite sqlite-amalgamation SDL ];
preConfigure = ''
cp ${sqlite-amalgamation}/* sqlite/
'';
cmakeFlags = [
"-DSERVERONLY=ON"
];
installPhase = ''
find
mkdir -p $out/bin
mkdir -p $out/share
cp zandronum-server zandronum.pk3 skulltag_actors.pk3 $out/share
cat > $out/bin/zandronum-server << EOF
#!/bin/sh
LD_LIBRARY_PATH=$out/share $out/share/zandronum-server "\$@"
EOF
chmod +x "$out/bin/zandronum-server"
'';
meta = {
homepage = http://zandronum.com/;
description = "Server of the multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
maintainer = [ stdenv.lib.maintainers.lassulus ];
};
}

View file

@ -14421,8 +14421,15 @@ let
xsokoban = callPackage ../games/xsokoban { };
zandronum = callPackage ../games/zandronum { };
zandronum-server = callPackage ../games/zandronum/server.nix { };
zandronum = callPackage ../games/zandronum {
fmod = fmod42416;
cmake = cmake-2_8;
};
zandronum-server = zandronum.override {
serverOnly = true;
};
zandronum-bin = callPackage ../games/zandronum/bin.nix { };
zangband = builderDefsPackage (callPackage ../games/zangband) {};