2019-11-10 16:44:34 +00:00
|
|
|
|
{ stdenv, fetchurl, glibc, libX11, runtimeShell, libGLU, libGL }:
|
2014-04-25 18:35:18 +00:00
|
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
stdenv.mkDerivation {
|
2016-01-01 03:57:55 +00:00
|
|
|
|
name = "tibia-10.90";
|
2014-04-25 18:35:18 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2020-04-01 01:11:51 +00:00
|
|
|
|
url = "http://static.tibia.com/download/tibia1090.tgz";
|
2016-01-01 03:57:55 +00:00
|
|
|
|
sha256 = "11mkh2dynmbpay51yfaxm5dmcys3rnpk579s9ypfkhblsrchbkhx";
|
2014-04-25 18:35:18 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|
2014-09-22 22:16:37 +00:00
|
|
|
|
cp -r * $out/res
|
2014-04-25 18:35:18 +00:00
|
|
|
|
|
2015-04-26 17:54:51 +00:00
|
|
|
|
patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 \
|
2019-11-10 16:44:34 +00:00
|
|
|
|
--set-rpath ${stdenv.lib.makeLibraryPath [ stdenv.cc.cc libX11 libGLU libGL ]} \
|
2014-04-28 19:31:46 +00:00
|
|
|
|
"$out/res/Tibia"
|
2014-04-25 18:35:18 +00:00
|
|
|
|
|
|
|
|
|
# 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"
|
2019-02-26 11:45:54 +00:00
|
|
|
|
#!${runtimeShell}
|
2014-04-25 18:35:18 +00:00
|
|
|
|
cd $out/res
|
2015-04-26 17:54:51 +00:00
|
|
|
|
${glibc.out}/lib/ld-linux.so.2 --library-path \$LD_LIBRARY_PATH ./Tibia "\$@"
|
2014-04-25 18:35:18 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
chmod +x $out/bin/Tibia
|
|
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = {
|
2014-04-28 19:31:46 +00:00
|
|
|
|
description = "Top-down MMORPG set in a fantasy world";
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "http://tibia.com";
|
2014-06-19 04:19:00 +00:00
|
|
|
|
license = stdenv.lib.licenses.unfree;
|
2014-04-25 18:35:18 +00:00
|
|
|
|
platforms = ["i686-linux"];
|
2019-12-05 07:29:48 +00:00
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ ];
|
2014-04-25 18:35:18 +00:00
|
|
|
|
};
|
|
|
|
|
}
|