aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Clausecker <fuz@fuz.su>2021-04-27 21:43:23 +0000
committerLi-Wen Hsu <lwhsu@FreeBSD.org>2021-05-24 00:09:09 +0000
commit7ef30eed0cf6f5626f708259518981a293a7645a (patch)
treec2d72570729f45c45c837c74cbc4c17017330b13
parentcd4b02d068b203b0eeed5d7477c9ca54705e2c3b (diff)
downloadports-7ef30eed0cf6f5626f708259518981a293a7645a.tar.gz
ports-7ef30eed0cf6f5626f708259518981a293a7645a.zip
games/xnethack: (new port) Experimental features and improvements applied to NetHack 3.7-dev
xNetHack is a fork of the dungeon exploration game NetHack. It is a distant descendent of Rogue and Hack, and a direct descendant of the development version of NetHack 3.7. The main goals of xNetHack are to take vanilla NetHack and: - Fix gameplay balance issues. - Remove tedious and frustrating parts of the game. - Make uninteresting parts of the game more interesting. - Experiment with new ideas from the community. In general, the game design takes a conservative approach to changing the gameplay compared to other variants, with focus on deepening elements of the game rather than broadening them. For example, this philosophy would prefer to differentiate monsters in a class that all tend to play the same way, instead of adding new monsters to that class. WWW: https://nethackwiki.com/wiki/XNetHack PR: 255456
-rw-r--r--games/Makefile2
-rw-r--r--games/xnethack-nox11/Makefile9
-rw-r--r--games/xnethack/Makefile105
-rw-r--r--games/xnethack/distinfo3
-rw-r--r--games/xnethack/files/patch-doc_dlb.611
-rw-r--r--games/xnethack/files/patch-doc_nethack.638
-rw-r--r--games/xnethack/files/patch-doc_recover.620
-rw-r--r--games/xnethack/files/patch-include-config.h36
-rw-r--r--games/xnethack/files/patch-include-system.h13
-rw-r--r--games/xnethack/files/patch-include-unixconf.h27
-rw-r--r--games/xnethack/files/patch-src-files.c10
-rw-r--r--games/xnethack/files/patch-sys-unix-Makefile.doc39
-rw-r--r--games/xnethack/files/patch-sys-unix-Makefile.src154
-rw-r--r--games/xnethack/files/patch-sys-unix-Makefile.top175
-rw-r--r--games/xnethack/files/patch-sys-unix-Makefile.utl33
-rw-r--r--games/xnethack/files/patch-sys-unix-sysconf11
-rw-r--r--games/xnethack/files/patch-util-makedefs.c71
-rw-r--r--games/xnethack/files/patch-win-tty-termcap.c13
-rw-r--r--games/xnethack/files/patch-win_Qt_qt__win.cpp14
-rw-r--r--games/xnethack/files/pkg-deinstall.in14
-rw-r--r--games/xnethack/pkg-descr19
-rw-r--r--games/xnethack/pkg-plist180
22 files changed, 997 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile
index 065babe2c7fa..af565d0f0816 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -1084,6 +1084,8 @@
SUBDIR += xmris
SUBDIR += xmulti
SUBDIR += xneko
+ SUBDIR += xnethack
+ SUBDIR += xnethack-nox11
SUBDIR += xoct
SUBDIR += xoids
SUBDIR += xoj
diff --git a/games/xnethack-nox11/Makefile b/games/xnethack-nox11/Makefile
new file mode 100644
index 000000000000..e8199d9acbd6
--- /dev/null
+++ b/games/xnethack-nox11/Makefile
@@ -0,0 +1,9 @@
+# Created by: Jeremy Chadwick <yoshi@parodius.com>
+
+MASTERDIR= ${.CURDIR}/../xnethack
+
+MAINTAINER= fuz@fuz.su
+
+PKGNAMESUFFIX= -nox11
+
+.include "${MASTERDIR}/Makefile"
diff --git a/games/xnethack/Makefile b/games/xnethack/Makefile
new file mode 100644
index 000000000000..6147cdf98c8f
--- /dev/null
+++ b/games/xnethack/Makefile
@@ -0,0 +1,105 @@
+# Created by: asami
+
+PORTNAME= xNetHack
+DISTVERSIONPREFIX= xnh
+DISTVERSION= 6.1
+CATEGORIES= games
+
+MAINTAINER= fuz@fuz.su
+COMMENT= Experimental features and improvements applied to NetHack 3.7-dev
+
+LICENSE= nethack
+LICENSE_NAME= NETHACK GENERAL PUBLIC LICENSE
+LICENSE_FILE= ${WRKSRC}/dat/license
+LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+
+USES= alias compiler:c11 gmake ncurses tar:tgz lua
+USE_GITHUB= yes
+
+GH_ACCOUNT= copperwater
+GH_PROJECT= xNetHack
+
+MAKE_ENV= GRAPHICS="${GRAPHICS}"
+PLIST_SUB= HACKNAME="${HACKNAME}" \
+ HACKEXT="${HACKEXT}"
+TRUEPORTNAME= xnethack
+
+# Configure these variables as you want them to be.
+HACKEXT?=
+HACKNAME?= ${TRUEPORTNAME}${HACKEXT}
+HACKDIR?= share/${HACKNAME}
+HACKLINK= ${TRUEPORTNAME}
+
+DATADIR= ${PREFIX}/${HACKDIR}
+DOCSDIR= ${PREFIX}/share/doc/${HACKNAME}
+PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
+
+.if !defined(PKGNAMESUFFIX)
+USES+= xorg
+USE_XORG= xaw xpm xmu xext xt x11 sm ice
+CFLAGS+= -DX11_GRAPHICS -DUSE_TILES
+GRAPHICS= X11_GRAPHICS
+.else
+.if ${PKGNAMESUFFIX} == "-nox11"
+GRAPHICS= # none
+.endif
+.endif
+CFLAGS+= -DNOMAIL -DCURSES_GRAPHICS
+
+OPTIONS_DEFINE= DOCS
+
+.include <bsd.port.pre.mk>
+
+.if !exists(${PREFIX}/bin/${HACKLINK}) && ${HACKNAME} != ${HACKLINK}
+PLIST_SUB+= HACKLINK=""
+.else
+PLIST_SUB+= HACKLINK="@comment "
+.endif
+
+post-patch:
+.for f in include/config.h sys/unix/Makefile.doc sys/unix/Makefile.src sys/unix/Makefile.top
+ @${REINPLACE_CMD} -e 's|%%HACKNAME%%|${HACKNAME}|g' \
+ -e 's|%%HACKDIR%%|${PREFIX}/${HACKDIR}|g' \
+ -e 's|%%HACKEXT%%|${HACKEXT}|g' \
+ ${WRKSRC}/${f}
+.endfor
+.for f in dlb.6 nethack.6 recover.6
+ @${REINPLACE_CMD} -e 's|%%HACKNAME%%|${HACKNAME}|g' \
+ -e 's|%%HACKDIR%%|${PREFIX}/${HACKDIR}|g' \
+ -e 's|%%HACKEXT%%|${HACKEXT}|g' \
+ ${WRKSRC}/doc/${f}
+.endfor
+.if defined(WITHOUT_SHELL)
+ @${REINPLACE_CMD} -e 's|#define SHELL|/* #define SHELL|' ${WRKSRC}/include/unixconf.h
+.endif
+.if defined(WITH_MAIL)
+ @${REINPLACE_CMD} -e 's|/\* #define MAIL \*/|#define MAIL|' ${WRKSRC}/include/unixconf.h
+.endif
+
+do-configure:
+ @cd ${WRKSRC}/sys/unix; ${SH} setup.sh
+
+pre-install:
+ @${CAT} ${FILESDIR}/pkg-deinstall.in | ${SED} \
+ -e 's|%%HACKDIR%%|${HACKDIR}|g' > ${PKGDEINSTALL}
+
+post-install:
+.if !exists(${PREFIX}/bin/${HACKLINK}) && ${HACKNAME} != ${HACKLINK}
+ @${LN} -s -f ${PREFIX}/bin/${HACKNAME} ${STAGEDIR}${PREFIX}/bin/${HACKLINK}
+.endif
+ @cd ${WRKSRC}/doc; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS} manpages
+ @${MKDIR} ${STAGEDIR}${DATADIR}/save
+ @${CP} ${WRKSRC}/sys/unix/sysconf ${STAGEDIR}/${DATADIR}/sysconf
+ # Make sysconf a sample to prevent it being removed if altered
+ @${CP} ${STAGEDIR}/${DATADIR}/sysconf ${STAGEDIR}/${DATADIR}/sysconf.sample
+ # Make "sample" files from records to prevent them being removed
+ # if they have been altered
+ @${CP} ${STAGEDIR}/${DATADIR}/logfile ${STAGEDIR}/${DATADIR}/logfile.sample
+ @${CP} ${STAGEDIR}/${DATADIR}/record ${STAGEDIR}/${DATADIR}/record.sample
+ @${CP} ${STAGEDIR}/${DATADIR}/xlogfile ${STAGEDIR}/${DATADIR}/xlogfile.sample
+.if ${PORT_OPTIONS:MDOCS}
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/doc/Guidebook.txt ${STAGEDIR}${DOCSDIR}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/games/xnethack/distinfo b/games/xnethack/distinfo
new file mode 100644
index 000000000000..b414821b5fcf
--- /dev/null
+++ b/games/xnethack/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1620650405
+SHA256 (copperwater-xNetHack-xnh6.1_GH0.tar.gz) = 48cdb14a0b30cd439e04ccc3daa21d4db8b2abe9090dd7dcb2fdfa839a9572d8
+SIZE (copperwater-xNetHack-xnh6.1_GH0.tar.gz) = 5850953
diff --git a/games/xnethack/files/patch-doc_dlb.6 b/games/xnethack/files/patch-doc_dlb.6
new file mode 100644
index 000000000000..942fb1fdf506
--- /dev/null
+++ b/games/xnethack/files/patch-doc_dlb.6
@@ -0,0 +1,11 @@
+--- doc/dlb.6.orig 2021-03-22 22:28:14 UTC
++++ doc/dlb.6
+@@ -96,7 +96,7 @@ List the contents of the archive 'foo':
+ Kenneth Lorber
+ .SH "SEE ALSO"
+ .PP
+-nethack(6), tar(1)
++xnethack%%HACKEXT%%(6), tar(1)
+ .SH BUGS
+ .PP
+ Not a good tar emulation; - does not mean stdin or stdout.
diff --git a/games/xnethack/files/patch-doc_nethack.6 b/games/xnethack/files/patch-doc_nethack.6
new file mode 100644
index 000000000000..6040c8d826c9
--- /dev/null
+++ b/games/xnethack/files/patch-doc_nethack.6
@@ -0,0 +1,38 @@
+--- doc/nethack.6.orig 2021-03-22 22:28:14 UTC
++++ doc/nethack.6
+@@ -17,7 +17,7 @@ nethack \- Exploring The Mazes of Menace
+ .SH SYNOPSIS
+ .na
+ .hy 0
+-.B nethack
++.B xnethack
+ [
+ .B \-d
+ .I directory
+@@ -219,7 +219,7 @@ option, which must be the first argument if it appears
+ supplies a directory which is to serve as the playground.
+ It overrides the value from NETHACKDIR, HACKDIR,
+ or the directory specified by the game administrator during compilation
+-(usually /usr/games/lib/nethackdir).
++(usually %%HACKDIR%%).
+ This option is usually only useful to the game administrator.
+ The playground must contain several auxiliary files such as help files,
+ the list of top scorers, and a subdirectory
+@@ -265,7 +265,7 @@ name is '.xnethackrc' in the user's home directory.
+
+ .br
+ All other files are in the playground directory,
+-normally /usr/games/lib/nethackdir.
++normally %%HACKDIR%%.
+ If DLB was defined during the compile, the data files and special levels
+ will be inside a larger file, normally nhdat, instead of being separate
+ files.
+@@ -392,7 +392,7 @@ SHOPTYPE and SPLEVTYPE can be used in debugging (wizar
+ DEBUGFILES can be used if the program was built with 'DEBUG' enabled.
+ .SH "SEE ALSO"
+ .PP
+-recover(6)
++recover%%HACKEXT%%(6)
+ .SH BUGS
+ .PP
+ Probably infinite.
diff --git a/games/xnethack/files/patch-doc_recover.6 b/games/xnethack/files/patch-doc_recover.6
new file mode 100644
index 000000000000..2ee7bb286566
--- /dev/null
+++ b/games/xnethack/files/patch-doc_recover.6
@@ -0,0 +1,20 @@
+--- doc/recover.6.orig 2021-03-22 22:28:14 UTC
++++ doc/recover.6
+@@ -43,7 +43,7 @@ option, which must be the first argument if it appears
+ supplies a directory which is the NetHack playground.
+ It overrides the value from NETHACKDIR, HACKDIR, or the directory
+ specified by the game administrator during compilation
+-(usually /usr/games/lib/nethackdir).
++(usually %%HACKDIR%%).
+ .PP
+ ^?ALLDOCS
+ For recovery to be possible,
+@@ -130,7 +130,7 @@ but even a compression-using
+ .I nethack
+ will find them in the uncompressed form.
+ .SH "SEE ALSO"
+-nethack(6)
++xnethack%%HACKEXT%%(6)
+ .SH BUGS
+ .PP
+ .I recover
diff --git a/games/xnethack/files/patch-include-config.h b/games/xnethack/files/patch-include-config.h
new file mode 100644
index 000000000000..09e486a83591
--- /dev/null
+++ b/games/xnethack/files/patch-include-config.h
@@ -0,0 +1,36 @@
+--- include/config.h.orig 2021-03-22 22:28:14 UTC
++++ include/config.h
+@@ -294,11 +294,11 @@
+
+ #if defined(UNIX) && !defined(ZLIB_COMP) && !defined(COMPRESS)
+ /* path and file name extension for compression program */
+-#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
+-#define COMPRESS_EXTENSION ".Z" /* compress's extension */
++/* #define COMPRESS "/usr/bin/compress" */ /* Lempel-Ziv compression */
++/* #define COMPRESS_EXTENSION ".Z" */ /* compress's extension */
+ /* An example of one alternative you might want to use: */
+-/* #define COMPRESS "/usr/local/bin/gzip" */ /* FSF gzip compression */
+-/* #define COMPRESS_EXTENSION ".gz" */ /* normal gzip extension */
++#define COMPRESS "/usr/bin/gzip" /* FSF gzip compression */
++#define COMPRESS_EXTENSION ".gz" /* normal gzip extension */
+ #endif
+
+ #ifndef COMPRESS
+@@ -383,7 +383,7 @@
+ * otherwise it will be the current directory.
+ */
+ #ifndef HACKDIR
+-#define HACKDIR "/usr/games/lib/xnethackdir"
++#define HACKDIR "%%HACKDIR%%"
+ #endif
+
+ /*
+@@ -646,7 +646,7 @@ typedef unsigned char uchar;
+ #ifdef DUMPLOG
+
+ #ifndef DUMPLOG_FILE
+-#define DUMPLOG_FILE "/tmp/xnethack.%n.%d.log"
++#define DUMPLOG_FILE "/tmp/xnethack.%v.%u.%n.%D.log"
+ /* DUMPLOG_FILE allows following placeholders:
+ %% literal '%'
+ %v version (eg. "3.6.3-0")
diff --git a/games/xnethack/files/patch-include-system.h b/games/xnethack/files/patch-include-system.h
new file mode 100644
index 000000000000..1b10bc127749
--- /dev/null
+++ b/games/xnethack/files/patch-include-system.h
@@ -0,0 +1,13 @@
+--- include/system.h.orig 2021-03-22 22:28:14 UTC
++++ include/system.h
+@@ -82,7 +82,9 @@ typedef long off_t;
+ #if !defined(__SC__) && !defined(LINUX)
+ E long random(void);
+ #endif
+-#if (!defined(SUNOS4) && !defined(bsdi) && !defined(__FreeBSD__)) \
++# if defined(__FreeBSD__)
++#include <stdlib.h> /* srandom() differs between versions of FreeBSD. */
++#elif (!defined(SUNOS4) && !defined(bsdi) && !defined(__FreeBSD__)) \
+ || defined(RANDOM)
+ E void srandom(unsigned int);
+ #else
diff --git a/games/xnethack/files/patch-include-unixconf.h b/games/xnethack/files/patch-include-unixconf.h
new file mode 100644
index 000000000000..790f7ccdbedd
--- /dev/null
+++ b/games/xnethack/files/patch-include-unixconf.h
@@ -0,0 +1,27 @@
+--- include/unixconf.h.orig 2021-03-22 22:28:14 UTC
++++ include/unixconf.h
+@@ -20,13 +20,13 @@
+ */
+
+ /* define exactly one of the following four choices */
+-/* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */
++#define BSD 1 /* define for 4.n/Free/Open/Net BSD */
+ /* also for relatives like SunOS 4.x, DG/UX, and */
+ /* older versions of Linux */
+ /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */
+ /* Use BSD for < v3.0 */
+ /* "ULTRIX" not to be confused with "ultrix" */
+-#define SYSV /* define for System V, Solaris 2.x, newer versions */
++/* #define SYSV */ /* define for System V, Solaris 2.x, newer versions */
+ /* of Linux */
+ /* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */
+ /* use SYSV for < v6.5 */
+@@ -315,7 +315,7 @@
+ #endif
+
+ #if defined(BSD) || defined(ULTRIX)
+-#if !defined(DGUX) && !defined(SUNOS4)
++#if !defined(DGUX) && !defined(SUNOS4) && !defined(__FreeBSD__)
+ #define memcpy(d, s, n) bcopy(s, d, n)
+ #define memcmp(s1, s2, n) bcmp(s2, s1, n)
+ #endif
diff --git a/games/xnethack/files/patch-src-files.c b/games/xnethack/files/patch-src-files.c
new file mode 100644
index 000000000000..1b6b782cbaa3
--- /dev/null
+++ b/games/xnethack/files/patch-src-files.c
@@ -0,0 +1,10 @@
+--- src/files.c.orig 2021-03-22 22:28:14 UTC
++++ src/files.c
+@@ -51,6 +51,7 @@ const
+
+ #if defined(UNIX) && defined(SELECTSAVED)
+ #include <sys/types.h>
++#include <limits.h>
+ #include <dirent.h>
+ #include <stdlib.h>
+ #endif
diff --git a/games/xnethack/files/patch-sys-unix-Makefile.doc b/games/xnethack/files/patch-sys-unix-Makefile.doc
new file mode 100644
index 000000000000..fecd35c0dda4
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-Makefile.doc
@@ -0,0 +1,39 @@
+--- sys/unix/Makefile.doc.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/Makefile.doc
+@@ -66,15 +66,15 @@ Guidebook.dvi: Guidebook.tex
+ latex Guidebook.tex
+
+
+-GAME = nethack
+-MANDIR = /usr/man/man6
++GAME = xnethack%%HACKEXT%%
++MANDIR = ${PREFIX}/man/man6
+ MANEXT = 6
+
+ # manual installation for most BSD-style systems
+-GAMEMANCREATE = cat nethack.6 | $(NHGREP) >
+-RCVRMANCREATE = cat recover.6 | $(NHGREP) >
+-DLBMANCREATE = cat dlb.6 | $(NHGREP) >
+-MDMANCREATE = cat makedefs.6 | $(NHGREP) >
++GAMEMANCREATE = cat nethack.6 | $(NHGREP) > nethack.6.out ; ${BSD_INSTALL_MAN} nethack.6.out
++RCVRMANCREATE = cat recover.6 | $(NHGREP) > recover.6.out ; ${BSD_INSTALL_MAN} recover.6.out
++DLBMANCREATE = cat dlb.6 | $(NHGREP) > dlb.6.out ; ${BSD_INSTALL_MAN} dlb.6.out
++MDMANCREATE = cat makedefs.6 | $(NHGREP) > makedefs.6.out ; ${BSD_INSTALL_MAN} makedefs.6.out
+ # manual installation for most SYSV-style systems
+ # GAMEMANCREATE = cat nethack.6 | $(NHGREP) | nroff -man - >
+ # RCVRMANCREATE = cat recover.6 | $(NHGREP) | nroff -man - >
+@@ -82,10 +82,10 @@ MDMANCREATE = cat makedefs.6 | $(NHGREP) >
+ # MDMANCREATE = cat makedefs.6 | $(NHGREP) | nroff -man - >
+
+ manpages:
+- -$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
+- -$(RCVRMANCREATE) $(MANDIR)/recover.$(MANEXT)
+- -$(DLBMANCREATE) $(MANDIR)/dlb.$(MANEXT)
+- -$(MDMANCREATE) $(MANDIR)/makedefs.$(MANEXT)
++ -$(GAMEMANCREATE) ${DESTDIR}$(MANDIR)/$(GAME)%%HACKEXT%%.$(MANEXT)
++ -$(RCVRMANCREATE) ${DESTDIR}$(MANDIR)/recover%%HACKEXT%%.$(MANEXT)
++ -$(DLBMANCREATE) ${DESTDIR}$(MANDIR)/dlb%%HACKEXT%%.$(MANEXT)
++ -$(MDMANCREATE) ${DESTDIR}$(MANDIR)/makedefs%%HACKEXT%%.$(MANEXT)
+
+ # manual creation for distribution
+ DISTRIB = Guidebook.txt nethack.txt recover.txt \
diff --git a/games/xnethack/files/patch-sys-unix-Makefile.src b/games/xnethack/files/patch-sys-unix-Makefile.src
new file mode 100644
index 000000000000..bcf8a95aaf6f
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-Makefile.src
@@ -0,0 +1,154 @@
+--- sys/unix/Makefile.src.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/Makefile.src
+@@ -169,9 +169,17 @@ SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(
+
+ # flags for debugging:
+ # CFLAGS = -g -I../include
++CFLAGS += -I../include -I${LUA_INCDIR}
++ifeq ("$(GRAPHICS)","X11_GRAPHICS")
++CFLAGS += -DX11_GRAPHICS -I${LOCALBASE}/include
++endif
++ifeq ("$(GRAPHICS)","QT_GRAPHICS")
++CFLAGS += -DQT_GRAPHICS
++endif
+
+ #CFLAGS = -O -I../include
+-#LFLAGS =
++LFLAGS += -L${LUA_LIBDIR}
++LINK = $(CC)
+
+ # The Qt and Be window systems are written in C++, while the rest of
+ # NetHack is standard C. If using Qt, uncomment the LINK line here to get
+@@ -297,6 +305,29 @@ WINBEOBJ =
+ # Curses - Karl Garrison, Tangles
+ #WINSRC = $(WINCURSESSRC)
+ #WINOBJ = $(WINCURSESOBJ)
++
++WINSRC = $(WINTTYSRC) $(WINCURSESSRC)
++ifeq ("$(GRAPHICS)","X11_GRAPHICS")
++WINSRC += $(WINX11SRC)
++endif
++ifeq ("$(GRAPHICS)","QT_GRAPHICS")
++WINSRC += $(WINQTSRC)
++endif
++ifeq ("$(GRAPHICS)","GNOME_GRAPHICS")
++WINSRC += $(WINGNOMESRC)
++endif
++
++WINOBJ = $(WINTTYOBJ) $(WINCURSESOBJ)
++ifeq ("$(GRAPHICS)","X11_GRAPHICS")
++WINOBJ += $(WINX11OBJ)
++endif
++ifeq ("$(GRAPHICS)","QT_GRAPHICS")
++WINOBJ += $(WINQTOBJ)
++endif
++ifeq ("$(GRAPHICS)","GNOME_GRAPHICS")
++WINOBJ += $(WINGNOMEOBJ)
++endif
++
+ #
+ # on some systems the termcap library is in -ltermcap or -lcurses
+ # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
+@@ -313,6 +344,7 @@ WINBEOBJ =
+ # WINTTYLIB = -lcurses16
+ # WINTTYLIB = -lncurses
+ #WINTTYLIB = -ltermlib
++WINTTYLIB = -lncurses -L${LOCALBASE}/lib
+ #
+ # libraries for X11
+ # If USE_XPM is defined in config.h, you will also need -lXpm here.
+@@ -320,10 +352,13 @@ WINBEOBJ =
+ # WINX11LIB = -lXaw -lXmu -lXt -lX11
+ # WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
+ # WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0
++WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -L${LOCALBASE}/lib
+ #
+ #
+ # libraries for Qt 3
+-WINQT3LIB = -L$(QTDIR)/lib -lqt
++#WINQTLIB = -L$(QTDIR)/lib -lqt
++WINQT3LIB = ${QTCFGLIBS} ${LIBQT}
++WINQTLIB = ${QTCFGLIBS} ${LIBQT}
+ #
+ # libraries for Qt 4
+ WINQT4LIB = `pkg-config QtGui --libs`
+@@ -339,7 +374,7 @@ WINBELIB = -lbe
+ #
+ # libraries for curses port
+ # link with ncurses
+-WINCURSESLIB = -lncurses
++WINCURSESLIB = -lncurses -L${LOCALBASE}/lib
+ # link with pdcurses for SDL, installed in a separate directory
+ #WINCURSESLIB = -L/usr/local/lib/pdcurses -lpdcurses -lSDL
+ # same as above, for XCurses
+@@ -349,6 +384,18 @@ WINCURSESLIB = -lncurses
+ #
+ # For Curses
+ #WINLIB = $(WINCURSESLIB)
++
++WINLIB = $(WINTTYLIB)
++ifeq ("$(GRAPHICS)","X11_GRAPHICS")
++WINLIB += $(WINX11LIB)
++endif
++ifeq ("$(GRAPHICS)","QT_GRAPHICS")
++WINLIB += $(WINQTLIB)
++endif
++ifeq ("$(GRAPHICS)","GNOME_GRAPHICS")
++WINLIB += $(WINGNOMELIB)
++endif
++
+ #
+ # some platforms need to build the support libraries
+ # BUILDMORE = $(TARGETPFX)pdcurses.a
+@@ -384,7 +431,7 @@ WINCURSESLIB = -lncurses
+ # LIBS =
+
+ # make NetHack
+-GAME = xnethack
++GAME = xnethack%%HACKEXT%%
+ # GAME = nethack.prg
+ GAMEBIN = $(GAME)
+
+@@ -412,7 +459,7 @@ GITINFO=1
+ # (rather than just in suffix default rule), such as is implemented by
+ # gnu make and others which have picked up its extensions;
+ # allowed values are 0, 1, and empty (which behaves like 0)
+-QUIETCC=1
++QUIETCC=0
+
+ # ----------------------------------------
+ #
+@@ -465,7 +512,8 @@ PACKAGE=@true
+ MAKEDEFS = ../util/makedefs
+
+ # -lm required by lua
+-LUALIB = ../lib/lua/liblua.a -lm
++#LUALIB = ../lib/lua/liblua.a -lm
++LUALIB = -llua-${LUA_VER} -lm
+
+ # timestamp files to reduce `make' overhead and shorten .o dependency lists
+ CONFIG_H = ../src/config.h-t
+@@ -654,7 +702,7 @@ DUMB.Setup: ../include/extern.h
+ cp ../include/extern.DUMB ../include/extern.h
+ @touch DUMB.Setup
+
+-../lib/lua/liblua.a ../include/nhlua.h:
++../include/nhlua.h:
+ @( cd .. ; $(MAKE) lua_support )
+
+ # dependencies for makedefs and its outputs, which the util
+@@ -673,11 +721,11 @@ objects.o:
+
+ # Qt 3 windowport meta-object-compiler output
+ qt3_kde0.moc: ../win/Qt3/qt3_kde0.h
+- $(QTDIR)/bin/moc -o qt3kde0.moc ../win/Qt3/qt3_kde0.h
++ ${MOC} -o qt3kde0.moc ../win/Qt3/qt3_kde0.h
+ qt3_win.moc: ../win/Qt3/qt3_win.h
+- $(QTDIR)/bin/moc -o qt3win.moc ../win/Qt3/qt3_win.h
++ ${MOC} -o qt3win.moc ../win/Qt3/qt3_win.h
+ qt3tableview.moc: ../win/Qt3/qt3tableview.h
+- $(QTDIR)/bin/moc -o qt3tableview.moc ../win/Qt/qt3tableview.h
++ ${MOC} -o qt3tableview.moc ../win/Qt/qt3tableview.h
+
+ # Qt 4 windowport meta-object-compiler output
+ qt_kde0.moc : ../win/Qt/qt_kde0.h
diff --git a/games/xnethack/files/patch-sys-unix-Makefile.top b/games/xnethack/files/patch-sys-unix-Makefile.top
new file mode 100644
index 000000000000..44a4ffef3d57
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-Makefile.top
@@ -0,0 +1,175 @@
+--- sys/unix/Makefile.top.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/Makefile.top
+@@ -20,18 +20,18 @@ NHSROOT=.
+
+ # make NetHack
+ #PREFIX = /usr
+-GAME = xnethack
++GAME = xnethack%%HACKEXT%%
+ # GAME = nethack.prg
+ #GAMEUID = games
+-#GAMEGRP = bin
++GAMEGRP = games
+
+ # Permissions - some places use setgid instead of setuid, for instance
+ # See also the option "SECURE" in include/config.h
+-#GAMEPERM = 04755
+-FILEPERM = 0644
++GAMEPERM = 02755
++FILEPERM = 0664
+ # VARFILEPERM = 0644
+ EXEPERM = 0755
+-DIRPERM = 0755
++DIRPERM = 0775
+ # VARDIRPERM = 0755
+
+ # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
+@@ -41,14 +41,15 @@ DIRPERM = 0755
+ # therefore there should not be anything in HACKDIR that you want to keep
+ # (if there is, you'll have to do the installation by hand or modify the
+ # instructions)
+-#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
+-#VARDIR = $(HACKDIR)
++HACKDIR = %%HACKDIR%%
++VARDIR = $(HACKDIR)
++INSTDIR = $(HACKDIR)
+ # Where nethack.sh in installed. If this is not defined, the wrapper is not used.
+-#SHELLDIR = $(PREFIX)/games
++SHELLDIR = ${PREFIX}/bin
+
+ # per discussion in Install.X11 and Install.Qt
+ #VARDATND =
+ # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
+-# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
++VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
+ # for Atari/Gem
+ # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
+@@ -75,7 +76,7 @@ VARDAT = $(VARDATD) $(VARDATND)
+ #CHGRP = chgrp
+
+ # Lua version
+-LUA_VERSION = 5.4.2
++LUA_VERSION = ${LUA_VER}
+
+ #
+ # end of configuration
+@@ -108,7 +109,7 @@ all: $(ALLDEP)
+ $(GAME): lua_support
+ ( cd src ; $(MAKE) $(GAME) )
+
+-lua_support: $(TOPLUALIB) include/nhlua.h
++lua_support: include/nhlua.h
+ @true
+ lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h
+ ( cd lib/lua-$(LUA_VERSION)/src \
+@@ -116,13 +117,11 @@ lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VER
+ lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
+ @( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi )
+ cp lib/lua-$(LUA_VERSION)/src/liblua.a $@
+-include/nhlua.h: $(TOPLUALIB)
++include/nhlua.h:
+ echo '/* nhlua.h - generated by top Makefile */' > $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@
+- @sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \
+- < lib/lua-$(LUA_VERSION)/src/lua.h >> $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@
++ @echo '#include <lua.h>' >> $@
++ @echo '#include <lualib.h>' >> $@
++ @echo '#include <lauxlib.h>' >> $@
+ @echo '/*nhlua.h*/' >> $@
+
+ # Note: many of the dependencies below are here to allow parallel make
+@@ -234,39 +233,22 @@ dofiles:
+ -e '}' \
+ -e '$$s/.*/nodlb/p' < dat/options` ; \
+ $(MAKE) dofiles-$${target-nodlb}
+- cp src/$(GAME) $(INSTDIR)
+- cp util/recover $(INSTDIR)
+- -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
++ cp src/$(GAME) ${DESTDIR}$(INSTDIR)/$(GAME)
++ cp util/recover ${DESTDIR}$(INSTDIR)
++ -if test -n '${DESTDIR}$(SHELLDIR)'; then rm -f ${DESTDIR}$(SHELLDIR)/$(GAME); fi
+ if test -n '$(SHELLDIR)'; then \
+ sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
+ -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
+ < sys/unix/nethack.sh \
+- > $(SHELLDIR)/$(GAME) ; fi
+-# set up their permissions
+- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
+- $(CHGRP) $(GAMEGRP) $(GAME) recover )
+- chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
+- chmod $(EXEPERM) $(INSTDIR)/recover
+- -if test -n '$(SHELLDIR)'; then \
+- $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
+- if test -n '$(SHELLDIR)'; then \
+- $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
+- chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
++ > ${DESTDIR}$(SHELLDIR)/$(GAME) ; fi
+
+ dofiles-dlb: check-dlb
+- ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
+-# set up their permissions
+- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
+- $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
+- chmod $(FILEPERM) nhdat $(DATNODLB) )
++ ( cd dat ; cp nhdat $(DATNODLB) ${DESTDIR}$(INSTDIR) )
+
+ dofiles-nodlb:
+ # copy over the game files
+- ( cd dat ; cp $(DAT) $(INSTDIR) )
+-# set up their permissions
+- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
+- $(CHGRP) $(GAMEGRP) $(DAT) ; \
+- chmod $(FILEPERM) $(DAT) )
++ ( cd dat ; cp $(DAT) ${DESTDIR}$(INSTDIR) )
++
+ #
+ # This is not part of the dependency build hierarchy.
+ # It requires an explicit "make fetch-Lua".
+@@ -283,13 +265,9 @@ fetch-Lua:
+ update: $(GAME) recover $(VARDAT) spec_levs
+ # (don't yank the old version out from under people who're playing it)
+ -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
+- -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
++ -mv ${DESTDIR}$(INSTDIR)/nhdat ${DESTDIR}$(INSTDIR)/nhdat.old
+ # set up new versions of the game files
+ ( $(MAKE) dofiles )
+-# touch time-sensitive files
+- -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
+- -touch -c $(VARDIR)/save/* $(VARDIR)/whereis/*
+- touch $(VARDIR)/perm $(VARDIR)/record
+ # and a reminder
+ @echo You may also want to install the man pages via the doc Makefile.
+
+@@ -300,25 +278,16 @@ install: rootcheck $(GAME) recover $(VARDAT) spec_levs
+ true; $(PREINSTALL)
+ # set up the directories
+ # not all mkdirs have -p; those that don't will create a -p directory
+- -if test -n '$(SHELLDIR)'; then \
+- mkdir -p $(SHELLDIR); fi
+- rm -rf $(INSTDIR) $(VARDIR)
+- -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
++ -if test -n '${DESTDIR}$(SHELLDIR)'; then \
++ mkdir -p ${DESTDIR}$(SHELLDIR); fi
++ rm -rf ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR)
++ -mkdir -p ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR) ${DESTDIR}$(VARDIR)/save ${DESTDIR}$(VARDIR)/whereis
+ if test -d ./-p; then rmdir ./-p; fi
+- -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
+- $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
+ # order counts here:
+- chmod $(DIRPERM) $(INSTDIR)
+- chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
+ # set up the game files
+ ( $(MAKE) dofiles )
+ # set up some additional files
+- touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile \
+- $(VARDIR)/xlogfile $(VARDIR)/livelog
+- -( cd $(VARDIR) ; \
+- $(CHOWN) $(GAMEUID) perm record logfile xlogfile livelog ; \
+- $(CHGRP) $(GAMEGRP) perm record logfile xlogfile livelog ; \
+- chmod $(VARFILEPERM) perm record logfile xlogfile livelog )
++ touch ${DESTDIR}$(VARDIR)/perm ${DESTDIR}$(VARDIR)/record ${DESTDIR}$(VARDIR)/logfile ${DESTDIR}$(VARDIR)/xlogfile
+ true; $(POSTINSTALL)
+ # and a reminder
+ @echo You may also want to reinstall the man pages via the doc Makefile.
diff --git a/games/xnethack/files/patch-sys-unix-Makefile.utl b/games/xnethack/files/patch-sys-unix-Makefile.utl
new file mode 100644
index 000000000000..10fd6bc5aa42
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-Makefile.utl
@@ -0,0 +1,33 @@
+--- sys/unix/Makefile.utl.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/Makefile.utl
+@@ -93,18 +93,25 @@ NHSROOT=..
+ # flags for debugging:
+ # CFLAGS = -g -I../include
+
+-#CFLAGS = -O -I../include
+-#LFLAGS =
++CFLAGS += -I../include -I${LUA_INCDIR}
++ifeq ("$(GRAPHICS)","X11_GRAPHICS")
++CFLAGS += -DX11_GRAPHICS
++endif
++ifeq ("$(GRAPHICS)","QT_GRAPHICS")
++CFLAGS += -DQT_GRAPHICS
++endif
++ifeq ("$(GRAPHICS)","GNOME_GRAPHICS")
++CFLAGS += -DGNOME_GRAPHICS
++endif
+
+-# -lm required by lua
+-LFLAGS += -lm
++LFLAGS = -L${LUA_LIBDIR}
+
+ # we specify C preprocessor flags via CFLAGS; files built with default rules
+ # might include $(CPPFLAGS) which could get a value from user's environment;
+ # we avoid that by forcing it empty rather than by overriding default rules
+ CPPFLAGS =
+
+-LIBS =
++LIBS = -llua-${LUA_VER} -lm
+
+ OBJDIR = ../src
+
diff --git a/games/xnethack/files/patch-sys-unix-sysconf b/games/xnethack/files/patch-sys-unix-sysconf
new file mode 100644
index 000000000000..4629279cc86d
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-sysconf
@@ -0,0 +1,11 @@
+--- sys/unix/sysconf.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/sysconf
+@@ -136,7 +136,7 @@ LLC_TURNS=3000
+ # %D current time, YYYYMMDDhhmmss format
+ # %n player name
+ # %N first character of player name
+-DUMPLOGFILE=/tmp/xnethack.%n.%d.log
++DUMPLOGFILE=/tmp/nethack.%v.%u.%n.%D.log
+
+ # End of game HTML dump.
+ # Only available if NetHack was compiled with DUMPHTML
diff --git a/games/xnethack/files/patch-util-makedefs.c b/games/xnethack/files/patch-util-makedefs.c
new file mode 100644
index 000000000000..13d38f3bfba0
--- /dev/null
+++ b/games/xnethack/files/patch-util-makedefs.c
@@ -0,0 +1,71 @@
+--- util/makedefs.c.orig 2021-03-22 22:28:14 UTC
++++ util/makedefs.c
+@@ -116,6 +116,7 @@ static struct version_info version;
+ #define MAXFNAMELEN 600
+
+ static char filename[MAXFNAMELEN];
++static char tempfilename[MAXFNAMELEN];
+
+ #ifdef FILE_PREFIX
+ /* if defined, a first argument not starting with - is
+@@ -229,6 +230,12 @@ main(int argc, char *argv[])
+ return 1;
+ }
+
++ if (snprintf(tempfilename, sizeof(tempfilename), "%s.%d", "grep.tmp", getpid()) >= sizeof(tempfilename)) {
++ Fprintf(stderr, "Cannot create temporary filename.");
++ (void) fflush(stderr);
++ return 1;
++ }
++
+ #ifdef FILE_PREFIX
+ if (argc >= 2 && argv[1][0] != '-') {
+ file_prefix = argv[1];
+@@ -964,12 +971,12 @@ do_rnd_access_file(const char* fname, const char* defl
+ more likely to be picked than normal but it's nothing to worry about */
+ (void) fputs(xcrypt(deflt_content), ofp);
+
+- tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE, FLG_TEMPFILE);
++ tfp = getfp(DATA_TEMPLATE, tempfilename, WRTMODE, FLG_TEMPFILE);
+ grep0(ifp, tfp, FLG_TEMPFILE);
+ #ifndef HAS_NO_MKSTEMP
+ ifp = tfp;
+ #else
+- ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE, 0);
++ ifp = getfp(DATA_TEMPLATE, tempfilename, RDTMODE, 0);
+ #endif
+ while ((line = fgetline(ifp)) != 0) {
+ if (line[0] != '#' && line[0] != '\n')
+@@ -980,7 +987,7 @@ do_rnd_access_file(const char* fname, const char* defl
+ Fclose(ofp);
+
+ #ifdef HAS_NO_MKSTEMP
+- delete_file(DATA_TEMPLATE, "grep.tmp");
++ delete_file(DATA_TEMPLATE, templfilename);
+ #endif
+ return;
+ }
+@@ -1758,12 +1765,12 @@ do_dungeon(void)
+ }
+ Fprintf(ofp, "%s", Dont_Edit_Data);
+
+- tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE, FLG_TEMPFILE);
++ tfp = getfp(DATA_TEMPLATE, tempfilename, WRTMODE, FLG_TEMPFILE);
+ grep0(ifp, tfp, FLG_TEMPFILE);
+ #ifndef HAS_NO_MKSTEMP
+ ifp = tfp;
+ #else
+- ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE, 0);
++ ifp = getfp(DATA_TEMPLATE, tempfilename, RDTMODE, 0);
+ #endif
+ while ((line = fgetline(ifp)) != 0) {
+ SpinCursor(3);
+@@ -1779,7 +1786,7 @@ do_dungeon(void)
+ Fclose(ofp);
+
+ #ifdef HAS_NO_MKSTEMP
+- delete_file(DATA_TEMPLATE, "grep.tmp");
++ delete_file(DATA_TEMPLATE, tempfilename);
+ #endif
+ return;
+ }
diff --git a/games/xnethack/files/patch-win-tty-termcap.c b/games/xnethack/files/patch-win-tty-termcap.c
new file mode 100644
index 000000000000..9338a9c87743
--- /dev/null
+++ b/games/xnethack/files/patch-win-tty-termcap.c
@@ -0,0 +1,13 @@
+--- win/tty/termcap.c.orig 2021-03-22 22:28:14 UTC
++++ win/tty/termcap.c
+@@ -185,10 +185,6 @@ tty_startup(int *wid, int *hgt)
+ error("Terminal must backspace.");
+ #else
+ if (!(BC = Tgetstr("bc"))) { /* termcap also uses bc/bs */
+-#ifndef MINIMAL_TERM
+- if (!tgetflag("bs"))
+- error("Terminal must backspace.");
+-#endif
+ BC = tbufptr;
+ tbufptr += 2;
+ *BC = '\b';
diff --git a/games/xnethack/files/patch-win_Qt_qt__win.cpp b/games/xnethack/files/patch-win_Qt_qt__win.cpp
new file mode 100644
index 000000000000..1837d29fc918
--- /dev/null
+++ b/games/xnethack/files/patch-win_Qt_qt__win.cpp
@@ -0,0 +1,14 @@
+--- win/Qt/qt_win.cpp.orig 2021-03-22 22:28:14 UTC
++++ win/Qt/qt_win.cpp
+@@ -57,6 +57,11 @@ extern "C" {
+ #endif
+ #include "qt_post.h"
+
++#ifdef Invisible
++/* Invisible was added to an enum in Qt 3.2, #defined in youprop.h */
++#undef Invisible
++#endif
++
+ // Many of these headers are not needed here. It's a holdover
+ // from when most of the Qt code was in one big file.
+ #include "qt_win.h"
diff --git a/games/xnethack/files/pkg-deinstall.in b/games/xnethack/files/pkg-deinstall.in
new file mode 100644
index 000000000000..04e356acdf02
--- /dev/null
+++ b/games/xnethack/files/pkg-deinstall.in
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ "${2}" = "POST-DEINSTALL" ]; then
+ if [ -d "${PKG_PREFIX}/%%HACKDIR%%" ]; then
+ echo
+ echo "The ${1} save files have not been removed."
+ echo
+ echo "If you are deleting ${1} permanently then you can "
+ echo "remove the save files with the command:"
+ echo
+ echo " rm -rf ${PKG_PREFIX}/%%HACKDIR%%"
+ echo
+ fi
+fi
diff --git a/games/xnethack/pkg-descr b/games/xnethack/pkg-descr
new file mode 100644
index 000000000000..83815936b4ca
--- /dev/null
+++ b/games/xnethack/pkg-descr
@@ -0,0 +1,19 @@
+xNetHack is a fork of the dungeon exploration game NetHack. It is a
+distant descendent of Rogue and Hack, and a direct descendant of the
+development version of NetHack 3.7.
+
+The main goals of xNetHack are to take vanilla NetHack and:
+
+ - Fix gameplay balance issues.
+ - Remove tedious and frustrating parts of the game.
+ - Make uninteresting parts of the game more interesting.
+ - Experiment with new ideas from the community.
+
+In general, the game design takes a conservative approach to changing
+the gameplay compared to other variants, with focus on deepening
+elements of the game rather than broadening them. For example, this
+philosophy would prefer to differentiate monsters in a class that all
+tend to play the same way, instead of adding new monsters to that class.
+
+
+WWW: https://nethackwiki.com/wiki/XNetHack
diff --git a/games/xnethack/pkg-plist b/games/xnethack/pkg-plist
new file mode 100644
index 000000000000..5733415fcb2e
--- /dev/null
+++ b/games/xnethack/pkg-plist
@@ -0,0 +1,180 @@
+%%HACKLINK%%bin/xnethack
+@mode 555
+bin/%%HACKNAME%%
+@owner games
+@group games
+@mode 02755
+%%DATADIR%%/%%HACKNAME%%
+@mode
+%%DATADIR%%/Arc-fila.lua
+%%DATADIR%%/Arc-filb.lua
+%%DATADIR%%/Arc-goal.lua
+%%DATADIR%%/Arc-loca.lua
+%%DATADIR%%/Arc-strt.lua
+%%DATADIR%%/Bar-fila.lua
+%%DATADIR%%/Bar-filb.lua
+%%DATADIR%%/Bar-goal.lua
+%%DATADIR%%/Bar-loca.lua
+%%DATADIR%%/Bar-strt.lua
+%%DATADIR%%/Cav-fila.lua
+%%DATADIR%%/Cav-filb.lua
+%%DATADIR%%/Cav-goal.lua
+%%DATADIR%%/Cav-loca.lua
+%%DATADIR%%/Cav-strt.lua
+%%DATADIR%%/Hea-fila.lua
+%%DATADIR%%/Hea-filb.lua
+%%DATADIR%%/Hea-goal.lua
+%%DATADIR%%/Hea-loca.lua
+%%DATADIR%%/Hea-strt.lua
+%%DATADIR%%/Kni-fila.lua
+%%DATADIR%%/Kni-filb.lua
+%%DATADIR%%/Kni-goal.lua
+%%DATADIR%%/Kni-loca.lua
+%%DATADIR%%/Kni-strt.lua
+%%DATADIR%%/Mon-fila.lua
+%%DATADIR%%/Mon-filb.lua
+%%DATADIR%%/Mon-goal.lua
+%%DATADIR%%/Mon-loca.lua
+%%DATADIR%%/Mon-strt.lua
+%%DATADIR%%/NHdump.css
+%%DATADIR%%/NetHack.ad
+%%DATADIR%%/Pri-fila.lua
+%%DATADIR%%/Pri-filb.lua
+%%DATADIR%%/Pri-goal.lua
+%%DATADIR%%/Pri-loca.lua
+%%DATADIR%%/Pri-strt.lua
+%%DATADIR%%/Ran-fila.lua
+%%DATADIR%%/Ran-filb.lua
+%%DATADIR%%/Ran-goal.lua
+%%DATADIR%%/Ran-loca.lua
+%%DATADIR%%/Ran-strt.lua
+%%DATADIR%%/Rog-fila.lua
+%%DATADIR%%/Rog-filb.lua
+%%DATADIR%%/Rog-goal.lua
+%%DATADIR%%/Rog-loca.lua
+%%DATADIR%%/Rog-strt.lua
+%%DATADIR%%/Sam-fila.lua
+%%DATADIR%%/Sam-filb.lua
+%%DATADIR%%/Sam-goal.lua
+%%DATADIR%%/Sam-loca.lua
+%%DATADIR%%/Sam-strt.lua
+%%DATADIR%%/Tou-fila.lua
+%%DATADIR%%/Tou-filb.lua
+%%DATADIR%%/Tou-goal.lua
+%%DATADIR%%/Tou-loca.lua
+%%DATADIR%%/Tou-strt.lua
+%%DATADIR%%/Val-fila.lua
+%%DATADIR%%/Val-filb.lua
+%%DATADIR%%/Val-goal.lua
+%%DATADIR%%/Val-loca.lua
+%%DATADIR%%/Val-strt.lua
+%%DATADIR%%/Wiz-fila.lua
+%%DATADIR%%/Wiz-filb.lua
+%%DATADIR%%/Wiz-goal.lua
+%%DATADIR%%/Wiz-loca.lua
+%%DATADIR%%/Wiz-strt.lua
+%%DATADIR%%/air.lua
+%%DATADIR%%/asmodeus.lua
+%%DATADIR%%/astral.lua
+%%DATADIR%%/baalz.lua
+%%DATADIR%%/bigrm-1.lua
+%%DATADIR%%/bigrm-10.lua
+%%DATADIR%%/bigrm-11.lua
+%%DATADIR%%/bigrm-2.lua
+%%DATADIR%%/bigrm-3.lua
+%%DATADIR%%/bigrm-4.lua
+%%DATADIR%%/bigrm-5.lua
+%%DATADIR%%/bigrm-6.lua
+%%DATADIR%%/bigrm-7.lua
+%%DATADIR%%/bigrm-8.lua
+%%DATADIR%%/bigrm-9.lua
+%%DATADIR%%/bogusmon
+%%DATADIR%%/castle.lua
+%%DATADIR%%/cmdhelp
+%%DATADIR%%/data
+%%DATADIR%%/dungeon.lua
+%%DATADIR%%/earth.lua
+%%DATADIR%%/engrave
+%%DATADIR%%/epitaph
+%%DATADIR%%/fakewiz1.lua
+%%DATADIR%%/fakewiz2.lua
+%%DATADIR%%/fire.lua
+%%DATADIR%%/help
+%%DATADIR%%/hh
+%%DATADIR%%/history
+%%DATADIR%%/juiblex.lua
+%%DATADIR%%/keyhelp
+%%DATADIR%%/knox.lua
+%%DATADIR%%/license
+@sample(games,games,664) %%DATADIR%%/logfile.sample
+%%DATADIR%%/medusa-1.lua
+%%DATADIR%%/medusa-2.lua
+%%DATADIR%%/medusa-3.lua
+%%DATADIR%%/medusa-4.lua
+%%DATADIR%%/minefill.lua
+%%DATADIR%%/minend-1.lua
+%%DATADIR%%/minend-2.lua
+%%DATADIR%%/minend-3.lua
+%%DATADIR%%/minend-4.lua
+%%DATADIR%%/minetn-1.lua
+%%DATADIR%%/minetn-2.lua
+%%DATADIR%%/minetn-3.lua
+%%DATADIR%%/minetn-4.lua
+%%DATADIR%%/minetn-5.lua
+%%DATADIR%%/minetn-6.lua
+%%DATADIR%%/minetn-7.lua
+%%DATADIR%%/minetn-8.lua
+%%DATADIR%%/nhlib.lua
+%%DATADIR%%/opthelp
+%%DATADIR%%/options
+%%DATADIR%%/oracle-1.lua
+%%DATADIR%%/oracle-2.lua
+%%DATADIR%%/oracle-3.lua
+%%DATADIR%%/oracles
+%%DATADIR%%/orcus.lua
+@mode 664
+%%DATADIR%%/perm
+@mode
+%%DATADIR%%/pet_mark.xbm
+%%DATADIR%%/pilemark.xbm
+%%DATADIR%%/quest.lua
+@sample(games,games,664) %%DATADIR%%/record.sample
+@mode 02755
+%%DATADIR%%/recover
+@mode
+%%DATADIR%%/rumors
+%%DATADIR%%/sanctum.lua
+%%DATADIR%%/shirts
+%%DATADIR%%/soko1-1.lua
+%%DATADIR%%/soko1-2.lua
+%%DATADIR%%/soko2-1.lua
+%%DATADIR%%/soko2-2.lua
+%%DATADIR%%/soko3-1.lua
+%%DATADIR%%/soko3-2.lua
+%%DATADIR%%/soko4-1.lua
+%%DATADIR%%/soko4-2.lua
+%%DATADIR%%/symbols
+@sample(games,games,) %%DATADIR%%/sysconf.sample
+%%DATADIR%%/themerms.lua
+%%DATADIR%%/tower1.lua
+%%DATADIR%%/tower2.lua
+%%DATADIR%%/tower3.lua
+%%DATADIR%%/tribute
+%%DATADIR%%/valley.lua
+%%DATADIR%%/water.lua
+%%DATADIR%%/wizard1.lua
+%%DATADIR%%/wizard2.lua
+%%DATADIR%%/wizard3.lua
+%%DATADIR%%/wizhelp
+%%DATADIR%%/x11tiles
+@sample(games,games,664) %%DATADIR%%/xlogfile.sample
+@owner
+@group
+man/man6/dlb.6.gz
+man/man6/makedefs.6.gz
+man/man6/recover.6.gz
+man/man6/%%HACKNAME%%.6.gz
+%%PORTDOCS%%%%DOCSDIR%%/Guidebook.txt
+@dir(games,games,0775) %%DATADIR%%/save
+@dir(games,games,0775) %%DATADIR%%/whereis
+@dir(games,games,0775) %%DATADIR%%