nixpkgs/pkgs/games/openarena/default.nix
aszlig 7982c3423a
openarena: Clean up and fix tarball evaluation.
It really doesn't make sense to pass stdenv.system to the builder and
check the value during build process. Also, we're now using
$NIX_CC/nix-support/dynamic-linker instead of pattern matching on
ld-linux*.so.?.

This is part of an attempt to fix nixpkgs tarball evaluation.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-01-03 18:26:40 +01:00

42 lines
1.3 KiB
Nix

{ fetchurl, makeWrapper, patchelf, pkgs, stdenv, SDL, libogg, libvorbis }:
stdenv.mkDerivation rec {
name = "openarena-${version}";
version = "0.8.8";
src = fetchurl {
name = "openarena.zip";
url = "http://openarena.ws/request.php?4";
sha256 = "0jmc1cmdz1rcvqc9ilzib1kilpwap6v0d331l6q53wsibdzsz3ss";
};
buildInputs = [ pkgs.unzip patchelf makeWrapper];
installPhase = let
gameDir = "$out/openarena-$version";
interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")";
in ''
mkdir -pv $out/bin
cd $out
unzip $src
${if stdenv.system == "x86_64-linux" then ''
patchelf --set-interpreter "${interpreter}" "${gameDir}/openarena.x86_64"
makeWrapper "${gameDir}/openarena.x86_64" "$out/bin/openarena" \
--prefix LD_LIBRARY_PATH : "${SDL}/lib:${libogg}/lib:${libvorbis}/lib"
'' else ''
patchelf --set-interpreter "${interpreter}" "${gameDir}/openarena.i386"
makeWrapper "${gameDir}/openarena.i386" "$out/bin/openarena" \
--prefix LD_LIBRARY_PATH : "${SDL}/lib:${libogg}/lib:${libvorbis}/lib"
''}
'';
meta = {
description = "Crossplatform openarena client";
homepage = http://openarena.ws/;
maintainers = [ stdenv.lib.maintainers.wyvie ];
platforms = stdenv.lib.platforms.linux;
license = stdenv.lib.licenses.gpl2;
};
}