@@ -0,0 +1,41 @@
1+{ fetchurl, makeWrapper, patchelf, pkgs, stdenv, SDL, libogg, libvorbis }:
2+
3+stdenv.mkDerivation rec {
4+ name = "openarena-${version}";
5+ version = "0.8.8";
6+
7+ src = fetchurl {
8+ name = "openarena.zip";
9+ url = "http://openarena.ws/request.php?4";
10+ sha256 = "0jmc1cmdz1rcvqc9ilzib1kilpwap6v0d331l6q53wsibdzsz3ss";
11+ };
12+
13+ buildInputs = [ pkgs.unzip patchelf makeWrapper];
14+
15+ installPhase = let
16+ gameDir = "$out/openarena-$version";
17+ interpreter = "${stdenv.glibc}/lib/ld-linux*.so.?";
18+ in ''
19+ mkdir -pv $out/bin
20+ cd $out
21+ unzip $src
22+
23+ if [ "${stdenv.system}" == "x86_64-linux" ]; then
24+ patchelf --set-interpreter ${interpreter} ${gameDir}/openarena.x86_64
25+ makeWrapper "${gameDir}/openarena.x86_64" "$out/bin/openarena" \
26+ --prefix LD_LIBRARY_PATH : "${SDL}/lib:${libogg}/lib:${libvorbis}/lib"
27+ else
28+ patchelf --set-interpreter ${interpreter} ${gameDir}/openarena.i386
29+ makeWrapper "${gameDir}/openarena.i386" "$out/bin/openarena" \
30+ --prefix LD_LIBRARY_PATH : "${SDL}/lib:${libogg}/lib:${libvorbis}/lib"
31+ fi
32+ '';
33+
34+ meta = {
35+ description = "Crossplatform openarena client";
36+ homepage = http://openarena.ws/;
37+ maintainers = [ stdenv.lib.maintainers.wyvie ];
38+ platforms = stdenv.lib.platforms.linux;
39+ license = stdenv.lib.licenses.gpl2;
40+ };
41+}