| 1 | # Crashes with "Dungeon description not valid" |
| 2 | TERMUX_PKG_HOMEPAGE=http://sourceforge.net/apps/trac/unnethack |
| 3 | TERMUX_PKG_DESCRIPTION="Dungeon crawling game, fork of NetHack" |
| 4 | TERMUX_PKG_VERSION=5.1.0 |
| 5 | TERMUX_PKG_SRCURL=http://downloads.sourceforge.net/project/unnethack/unnethack/${TERMUX_PKG_VERSION}/unnethack-${TERMUX_PKG_VERSION}-20131208.tar.gz |
| 6 | # --with-owner=$USER to avoid unnethack trying to use a "games" user, --with-groups to avoid "bin" group |
| 7 | TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-owner=$USER --with-group=`groups | cut -d ' ' -f 1`" |
| 8 | TERMUX_PKG_DEPENDS="gsl, ncurses" |
| 9 | |
| 10 | # unnethack builds util/{makedefs,lev_comp,dgn_comp} binaries which are later used during the build. |
| 11 | # we first build these host tools in $TERMUX_PKG_TMPDIR/host-build and copy them into the ordinary |
| 12 | # cross compile tree after configure, bumping their modification time so that they do not get rebuilt. |
| 13 | |
| 14 | CFLAGS="$CFLAGS $CPPFLAGS $LDFLAGS" |
| 15 | export LFLAGS="$LDFLAGS" |
| 16 | LD="$CC" |
| 17 | |
| 18 | termux_step_pre_configure () { |
| 19 | # Create a host build for the makedefs binary |
| 20 | mkdir $TERMUX_PKG_TMPDIR/host-build |
| 21 | cd $TERMUX_PKG_TMPDIR/host-build |
| 22 | ORIG_CC=$CC; export CC=gcc |
| 23 | ORIG_CFLAGS=$CFLAGS; export CFLAGS="" |
| 24 | ORIG_CPPFLAGS=$CPPFLAGS; export CPPFLAGS="" |
| 25 | ORIG_CXXFLAGS=$CXXFLAGS; export CXXFLAGS="" |
| 26 | ORIG_LDFLAGS=$LDFLAGS; export LDFLAGS="" |
| 27 | ORIG_LFLAGS=$LFLAGS; export LFLAGS="" |
| 28 | $TERMUX_PKG_SRCDIR/configure --with-owner=$USER |
| 29 | make |
| 30 | make spec_levs |
| 31 | make dungeon |
| 32 | set +e |
| 33 | make dlb |
| 34 | set -e |
| 35 | export CC=$ORIG_CC |
| 36 | export CFLAGS=$ORIG_CFLAGS |
| 37 | export CPPFLAGS=$ORIG_CPPFLAGS |
| 38 | export CXXFLAGS=$ORIG_CXXFLAGS |
| 39 | export LDFLAGS=$ORIG_LDFLAGS |
| 40 | export LFLAGS=$ORIG_LFLAGS |
| 41 | } |
| 42 | |
| 43 | termux_step_post_configure () { |
| 44 | # Use the host built makedefs |
| 45 | cp $TERMUX_PKG_TMPDIR/host-build/util/makedefs $TERMUX_PKG_BUILDDIR/util/makedefs |
| 46 | cp $TERMUX_PKG_TMPDIR/host-build/util/lev_comp $TERMUX_PKG_BUILDDIR/util/lev_comp |
| 47 | cp $TERMUX_PKG_TMPDIR/host-build/util/dgn_comp $TERMUX_PKG_BUILDDIR/util/dgn_comp |
| 48 | cp $TERMUX_PKG_TMPDIR/host-build/util/dlb $TERMUX_PKG_BUILDDIR/util/dlb |
| 49 | # Update timestamp so the binary does not get rebuilt |
| 50 | $TERMUX_TOUCH -d "next hour" $TERMUX_PKG_BUILDDIR/util/makedefs $TERMUX_PKG_BUILDDIR/util/lev_comp $TERMUX_PKG_BUILDDIR/util/dgn_comp $TERMUX_PKG_BUILDDIR/util/dlb |
| 51 | } |
| 52 | |
| 53 | termux_step_post_make_install () { |
| 54 | # Add directory which must exist: |
| 55 | mkdir -p $TERMUX_PREFIX/var/unnethack/level |
| 56 | echo "This directory stores locks" > $TERMUX_PREFIX/var/unnethack/level/README |
| 57 | } |