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