You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.8 KiB
Nix

{ stdenv, pkgs, requireFile, SDL2, makeWrapper, mono46,
libX11, libXext, libXcursor, libXxf86vm, libXi, libXinerama, libXrandr,
libgcrypt, libgpgerror,
alsaLib, libpulseaudio, libogg, libvorbis,
mesa_glu, libudev, lzma, dbus,
gtk2-x11, gdk_pixbuf, glib, # For ScreenSelector.so
unzip, strace, ... }:
let
originalArchive = "dungeons_3_en_v1_3_3_build13_503b949_16621.sh";
fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; };
in
stdenv.mkDerivation rec {
name = "dungeons-3-${version}";
version = "1.3.3-build13";
src = fetchfile {
path = ../../../nixrc-src-games/dungeons_3_en_v1_3_3_build13_503b949_16621.sh;
storeHash = "psbxibb92w8afffhy4558wjgy4npnj1m";
};
phases = "unpackPhase installPhase";
unpackCmd = "${unzip}/bin/unzip -qq $src || true";
sourceRoot = "data";
# FIXME: Check that there are no unnecessary dependencies here
libPath = stdenv.lib.makeLibraryPath [
"./Dungeons3.app/Contents/Data/server/mono/lib"
"./Dungeons3_Data/Plugins/x86_64"
alsaLib
libpulseaudio
mesa_glu
libX11
libXext
libXcursor
libXxf86vm
libXi
libXinerama
libXrandr
libgcrypt
libgpgerror
libudev
libogg
libvorbis
lzma
dbus
mono46
stdenv.cc.cc.lib
SDL2
gtk2-x11
gdk_pixbuf
glib
];
buildInputs = [
makeWrapper
];
installPhase = ''
mkdir -p $out
mv noarch/game/* $out/
mkdir -p $out/bin
chmod +x $out/Dungeons3.x86_64
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/Dungeons3.x86_64
for lib in {Dungeons3.app/Contents/Data/server/mono/lib,Dungeons3_Data/Plugins/x86_64}/*.so{,.*}; do
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib
done
makeWrapper ${strace}/bin/strace $out/dungeons-3-strace \
--run 'cd "`dirname "$0"`"' \
--add-flags -f \
--add-flags $out/Dungeons3.x86_64 \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
makeWrapper $out/Dungeons3.x86_64 $out/dungeons-3 \
--run 'cd "`dirname "$0"`"' \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
# FIXME: Verify that the base path workaround is necessary for this game too
echo "cd $out; pwd; ./dungeons-3" > $out/bin/dungeons-3
chmod +x $out/bin/dungeons-3
echo "cd $out; pwd; ./dungeons-3-strace" > $out/bin/dungeons-3-strace
chmod +x $out/bin/dungeons-3-strace
'';
}