dwarf-fortress: Clean up expression & config file handling.
This commit is contained in:
parent
73f4466a90
commit
bc03398930
@ -1,7 +1,6 @@
|
|||||||
{ stdenv, fetchgit, fetchurl, cmake, glew, ncurses, SDL, SDL_image, SDL_ttf, gtk2, glib, mesa, openal, pango, atk, gdk_pixbuf, glibc, libsndfile
|
{ stdenv, fetchgit, fetchurl, cmake, glew, ncurses
|
||||||
, copyDataDirectory ? true }:
|
, SDL, SDL_image, SDL_ttf, gtk2, glib
|
||||||
|
, mesa, openal, pango, atk, gdk_pixbuf, glibc, libsndfile }:
|
||||||
/* set copyDataDirectory as true by default since df 40 does not seem to run without it */
|
|
||||||
|
|
||||||
let
|
let
|
||||||
baseVersion = "40";
|
baseVersion = "40";
|
||||||
@ -38,8 +37,6 @@ stdenv.mkDerivation rec {
|
|||||||
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2}/lib/gtk-2.0/include"
|
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2}/lib/gtk-2.0/include"
|
||||||
];
|
];
|
||||||
|
|
||||||
/* :TODO: Game options should be configurable by patching the default configuration files */
|
|
||||||
|
|
||||||
permission = ./df_permission;
|
permission = ./df_permission;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
@ -57,55 +54,45 @@ stdenv.mkDerivation rec {
|
|||||||
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
|
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
|
||||||
|
|
||||||
cat > $out/bin/dwarf-fortress << EOF
|
cat > $out/bin/dwarf-fortress << EOF
|
||||||
#!${stdenv.shell}
|
#!${stdenv.shell}
|
||||||
export DF_DIR="\$HOME/.config/df_linux"
|
|
||||||
if [ -n "\$XDG_DATA_HOME" ]
|
set -ex
|
||||||
then export DF_DIR="\$XDG_DATA_HOME/df_linux"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Recreate a directory structure reflecting the original
|
export DF_DIR="\$HOME/.config/df_linux"
|
||||||
# distribution in the user directory (for modding support)
|
if [ -n "\$XDG_DATA_HOME" ]
|
||||||
${if copyDataDirectory then ''
|
then export DF_DIR="\$XDG_DATA_HOME/df_linux"
|
||||||
if [ ! -d "\$DF_DIR" ];
|
|
||||||
then
|
|
||||||
mkdir -p \$DF_DIR
|
|
||||||
cp -r $out/share/df_linux/* \$DF_DIR/
|
|
||||||
chmod -R u+rw \$DF_DIR/
|
|
||||||
fi
|
fi
|
||||||
'' else ''
|
|
||||||
# Link in the static stuff
|
|
||||||
mkdir -p \$DF_DIR
|
|
||||||
ln -sf $out/share/df_linux/libs \$DF_DIR/
|
|
||||||
ln -sf $out/share/df_linux/raw \$DF_DIR/
|
|
||||||
ln -sf $out/share/df_linux/df \$DF_DIR/
|
|
||||||
|
|
||||||
# Delete old data directory
|
if [[ ! -d "\$DF_DIR" ]]; then
|
||||||
rm -rf \$DF_DIR/data
|
mkdir -p "\$DF_DIR"
|
||||||
|
ln -s $out/share/df_linux/raw "\$DF_DIR/raw"
|
||||||
|
ln -s $out/share/df_linux/libs "\$DF_DIR/libs"
|
||||||
|
mkdir -p "\$DF_DIR/data/init"
|
||||||
|
cp -rn $out/share/df_linux/data/init "\$DF_DIR/data/"
|
||||||
|
fi
|
||||||
|
|
||||||
# Link in the static data directory
|
for link in announcement art dipscript help index initial_movies movies shader.fs shader.vs sound speech; do
|
||||||
mkdir \$DF_DIR/data
|
cp -r $out/share/df_linux/data/\$link "\$DF_DIR/data/\$link"
|
||||||
for i in $out/share/df_linux/data/*
|
chmod -R u+rw "\$DF_DIR/data/\$link"
|
||||||
do
|
|
||||||
ln -s \$i \$DF_DIR/data/
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# link in persistant data
|
# now run Dwarf Fortress!
|
||||||
mkdir -p \$DF_DIR/save
|
export LD_LIBRARY_PATH=\${stdenv.gcc}/lib:${SDL}/lib:${SDL_image}/lib/:${SDL_ttf}/lib/:${gtk2}/lib/:${glib}/lib/:${mesa}/lib/:${openal}/lib/:${libsndfile}/lib:\$DF_DIR/df_linux/libs/
|
||||||
ln -s \$DF_DIR/save \$DF_DIR/data/
|
|
||||||
''}
|
|
||||||
|
|
||||||
# now run Dwarf Fortress!
|
export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch.
|
||||||
export LD_LIBRARY_PATH=\${stdenv.gcc}/lib:${SDL}/lib:${SDL_image}/lib/:${SDL_ttf}/lib/:${gtk2}/lib/:${glib}/lib/:${mesa}/lib/:${openal}/lib/:${libsndfile}/lib:$DF_DIR/df_linux/libs/
|
#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing.
|
||||||
\$DF_DIR/df "\$@"
|
|
||||||
|
cd \$DF_DIR
|
||||||
|
$out/share/df_linux/libs/Dwarf_Fortress "$@"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x $out/bin/dwarf-fortress
|
chmod +x $out/bin/dwarf-fortress
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "control a dwarven outpost or an adventurer in a randomly generated, persistent world";
|
description = "A single-player fantasy game with a randomly generated adventure world";
|
||||||
homepage = http://www.bay12games.com/dwarves;
|
homepage = http://www.bay12games.com/dwarves;
|
||||||
license = stdenv.lib.licenses.unfreeRedistributable;
|
license = stdenv.lib.licenses.unfreeRedistributable;
|
||||||
maintainers = with stdenv.lib.maintainers; [ roconnor the-kenny ];
|
maintainers = with stdenv.lib.maintainers; [ roconnor the-kenny ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11379,10 +11379,6 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dwarf_fortress_modable = appendToName "moddable" (dwarf_fortress.override {
|
|
||||||
copyDataDirectory = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
dwarf-therapist = callPackage ../games/dwarf-therapist { };
|
dwarf-therapist = callPackage ../games/dwarf-therapist { };
|
||||||
|
|
||||||
d1x_rebirth = callPackage ../games/d1x-rebirth { };
|
d1x_rebirth = callPackage ../games/d1x-rebirth { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user