aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nethack
diff options
context:
space:
mode:
authorJesse Young <jlyo@jlyo.org>2015-07-26 18:41:26 -0500
committerFrancesco Colista <fcolista@alpinelinux.org>2015-07-28 07:36:17 +0000
commitf35d8b1e5db9b63238f4078be508a46d246c9ab7 (patch)
tree23cf27c6c64af087f0124a7a66cca6ace96c9283 /testing/nethack
parent0e2ea514281e3204d2d09dcb1c46134428e55b7a (diff)
downloadaports-f35d8b1e5db9b63238f4078be508a46d246c9ab7.tar.bz2
aports-f35d8b1e5db9b63238f4078be508a46d246c9ab7.tar.xz
testing/nethack: new aport
Diffstat (limited to 'testing/nethack')
-rw-r--r--testing/nethack/APKBUILD72
-rwxr-xr-xtesting/nethack/nethack.bin74
2 files changed, 146 insertions, 0 deletions
diff --git a/testing/nethack/APKBUILD b/testing/nethack/APKBUILD
new file mode 100644
index 0000000000..eb3ce25c31
--- /dev/null
+++ b/testing/nethack/APKBUILD
@@ -0,0 +1,72 @@
+# Contributor: Jesse Young <jlyo@jlyo.org>
+
+pkgname=nethack
+pkgver=3.4.3
+pkgrel=0
+pkgdesc='A single player dungeon exploration game'
+arch='all'
+url='http://www.nethack.org/index.html'
+license='custom'
+depends='ncurses gzip'
+makedepends='ncurses-dev byacc flex'
+subpackages="$pkgname-doc"
+install=""
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-${pkgver//.}-src.tgz
+ nethack.bin"
+
+build(){
+ cd $srcdir/$pkgname-$pkgver/
+ sh sys/unix/setup.sh
+
+ sed -e '/define HACKDIR/ s|/usr/games/lib/nethackdir|/usr/lib/nethack/|' \
+ -e "/^#define COMPRESS\s/ s|/usr/bin/compress|$(which gzip)|" \
+ -e '/^#define COMPRESS_EXTENSION/ s|".Z"|".gz"|' \
+ -e 's|^/\* \(#define DLB\) \*/|\1|' -i include/config.h
+
+ sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
+ -e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' -i include/unixconf.h
+
+ sed -e 's|^# \(WINTTYLIB = -lncurses\)|\1|' \
+ -e 's|^WINTTYLIB = -ltermlib|#&|' -i src/Makefile
+
+ sed -e '/^GAMEDIR\s*=/ s|/games/.*$|/usr/lib/$(GAME)|' \
+ -e '/^GAMEPERM\s*=/ s|04755|0755|' \
+ -e '/^GAMEUID\s*=/ s|games|root|' \
+ -e '/^GAMEGRP\s*=/ s|bin|root|' \
+ -e '/^CHOWN\s*=/ s|chown|true|' \
+ -e '/^CHGRP\s*=/ s|chgrp|true|' \
+ -e '/^SHELLDIR\s*=/ s|/games|/usr/bin|' -i Makefile
+
+ sed -e "/^MANDIR\s*=/s|/usr/man/man6|$pkgdir/usr/share/man/man6|" -i doc/Makefile
+
+ sed -e "s/^LEX\s*=.*$/LEX=flex/" -i util/Makefile
+
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver/
+
+ install -dm755 $pkgdir/usr/share/man/man6
+ install -dm755 $pkgdir/usr/share/doc/nethack
+ install -dm755 $pkgdir/usr/share/nethack
+ make PREFIX=$pkgdir install manpages
+ rm -f $pkgdir/usr/bin/nethack
+ rm -f $pkgdir/usr/lib/nethack/license
+ rm -f $pkgdir/usr/lib/nethack/logfile
+ rm -f $pkgdir/usr/lib/nethack/perm
+ rm -f $pkgdir/usr/lib/nethack/record
+ rm -rf $pkgdir/usr/lib/nethack/save
+ mv $pkgdir/usr/lib/nethack/nhdat $pkgdir/usr/share/nethack/nhdat
+
+ install -m755 $srcdir/nethack.bin $pkgdir/usr/bin/nethack
+
+ install -Dm644 doc/Guidebook.txt $pkgdir/usr/share/doc/nethack/Guidebook.txt
+ install -Dm644 dat/license $pkgdir/usr/share/licenses/$pkgname/LICENSE
+}
+md5sums="21479c95990eefe7650df582426457f9 nethack-343-src.tgz
+2498972119efd501fbe9d3a0cacfa107 nethack.bin"
+sha256sums="bb39c3d2a9ee2df4a0c8fdde708fbc63740853a7608d2f4c560b488124866fe4 nethack-343-src.tgz
+e9efd10d5a57bfcfefda6720308fdff9c14a2e71b0b4c68f2267dc59e7b7e3cf nethack.bin"
+sha512sums="052342c19619219f291571d48cf7799f962eb6ec6f8a276427225c0abbd833eada18abeff9fbd647919f2a9e3bb097d7f154675e283fe48abc4752f24c192d8f nethack-343-src.tgz
+0846b0a22451e420366c790b128e8c6b9ba902595e963f51bbbb61c7b7bebdeee2a13e51fc7f786e2da95834372ec6a5792d7a0308250c98b6bd48026d881eb0 nethack.bin"
diff --git a/testing/nethack/nethack.bin b/testing/nethack/nethack.bin
new file mode 100755
index 0000000000..272e23f085
--- /dev/null
+++ b/testing/nethack/nethack.bin
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+set -e
+set -u
+
+die () { echo "nethack:" "$@" >&2 ; exit 1 ; }
+
+[ "x${HOME:-}" = x ] && die "\$HOME not set"
+cd "$HOME"
+[ -d .nethack ] || mkdir -p .nethack
+cd .nethack
+[ -f nhdat ] || ln -s /usr/share/nethack/nhdat nhdat
+[ -d save ] || mkdir -p save
+[ -f logfile ] || : > logfile
+[ -f perm ] || : > perm
+[ -f record ] || : > record
+
+HACKDIR="$HOME/.nethack"
+export HACKDIR
+HACK=/usr/lib/nethack/nethack
+MAXNROFPLAYERS=4
+
+# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
+case "x${XUSERFILESEARCHPATH:-}" in
+x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad"
+ ;;
+*) XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad"
+ ;;
+esac
+export XUSERFILESEARCHPATH
+
+# see if we can find the full path name of PAGER, so help files work properly
+# assume that if someone sets up a special variable (HACKPAGER) for NetHack,
+# it will already be in a form acceptable to NetHack
+# ideas from brian@radio.astro.utoronto.ca
+if test \( "xxx${PAGER:-}" != xxx \) -a \( "xxx${HACKPAGER:-}" = xxx \)
+then
+ HACKPAGER="$PAGER"
+# use only the first word of the pager variable
+# this prevents problems when looking for file names with trailing
+# options, but also makes the options unavailable for later use from
+# NetHack
+ for i in $HACKPAGER
+ do
+ HACKPAGER="$i"
+ break
+ done
+
+ if test ! -f "$HACKPAGER"
+ then
+ IFS=:
+ for i in $PATH
+ do
+ if test -f "$i/$HACKPAGER"
+ then
+ HACKPAGER="$i/$HACKPAGER"
+ export HACKPAGER
+ break
+ fi
+ done
+ IFS=' '
+ fi
+ if test ! -f "$HACKPAGER"
+ then
+ echo "Cannot find $PAGER -- unsetting PAGER." >&2
+ unset HACKPAGER
+ unset PAGER
+ fi
+fi
+
+case "x${1:-}" in
+ x-s*) exec "$HACK" "$@" ;;
+ x*) exec "$HACK" "$@" "$MAXNROFPLAYERS" ;;
+esac