3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/games/tibia/default.nix
Shea Levy c45372f038 Merge commit 'cfb29ab882323d379aba20a95020c7c24f883eae'
Partial staging merge, including cc-wrapper fixes

Conflicts:
	pkgs/applications/audio/spotify/default.nix
	pkgs/build-support/cc-wrapper/default.nix
	pkgs/development/compilers/cryptol/1.8.x.nix
2015-02-02 21:14:28 -05:00

59 lines
1.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ stdenv, fetchurl, patchelf, glibc, libX11, mesa }:
with stdenv.lib;
assert stdenv.isi686;
stdenv.mkDerivation {
name = "tibia-10.74";
src = fetchurl {
url = http://static.tibia.com/download/tibia1074.tgz;
sha256 = "1q8bg33xial0bkagaf4iwn2sny1hglc1fhdxwjbiwrw0jg9w644x";
};
shell = stdenv.shell;
# These binaries come stripped already and trying to strip after the
# files are in $out/res and after patchelf just breaks them.
# Strangely it works if the files are in $out but then nix doesn't
# put them in our PATH. We set all the files to $out/res because
# we'll be using a wrapper to start the program which will go into
# $out/bin.
dontStrip = true;
installPhase = ''
mkdir -pv $out/res
cp -r * $out/res
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.cc.cc}/lib:${libX11}/lib:${mesa}/lib \
"$out/res/Tibia"
# We've patchelf'd the files. The main Tibia binary is a bit
# dumb so it looks for ./Tibia.dat. This requires us to be in
# the same directory as the file itself but that's very tedious,
# especially with nix which changes store hashes. Here we generate
# a simple wrapper that we put in $out/bin which will do the
# directory changing for us.
mkdir -pv $out/bin
# The wrapper script itself. We use $LD_LIBRARY_PATH for libGL.
cat << EOF > "$out/bin/Tibia"
#!${stdenv.shell}
cd $out/res
${glibc}/lib/ld-linux.so.2 --library-path \$LD_LIBRARY_PATH ./Tibia "\$@"
EOF
chmod +x $out/bin/Tibia
'';
meta = {
description = "Top-down MMORPG set in a fantasy world";
homepage = "http://tibia.com";
license = stdenv.lib.licenses.unfree;
platforms = ["i686-linux"];
maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
};
}