nethack: curses enhancement and a few fixes

Closes: https://trac.macports.org/ticket/69831
Closes: https://trac.macports.org/ticket/69833
Closes: https://trac.macports.org/ticket/73312
This commit is contained in:
Justin Flude
2026-05-19 10:12:56 -05:00
committed by GitHub
parent 7a1ed82d04
commit 72517e1cff
4 changed files with 101 additions and 4 deletions
+18 -4
View File
@@ -4,6 +4,7 @@ PortSystem 1.0
name nethack
version 3.6.7
revision 1
categories games
license Copyleft
maintainers {@jflude hotmail.com:justin_flude} \
@@ -28,11 +29,13 @@ checksums sha256 98cf67df6debf9668a61745aa84c09bcab362e5d33f5b944ec5155
size 5577415
depends_lib port:ncurses
depends_build-append port:bison
worksrcdir NetHack-${version}
patch.pre_args-replace -p0 -p1
patchfiles patch-gamestate-dir.diff \
patch-manpage-dir.diff
patch-manpage-dir.diff \
patch-curses-graphics.diff
patchfiles-append patch-nethack-warn-unused-result.diff
@@ -40,7 +43,8 @@ post-patch {
if {${subport} eq "nethack"} {
reinplace "s|__PREFIX__|${prefix}|" \
"${worksrcpath}/sys/unix/Makefile.doc" \
"${worksrcpath}/sys/unix/hints/macosx10.10"
"${worksrcpath}/sys/unix/hints/macosx10.10" \
"${worksrcpath}/sys/unix/hints/macosx10.14"
} else {
reinplace "s|__PREFIX__|${prefix}|" \
"${worksrcpath}/sys/unix/Makefile.doc" \
@@ -50,12 +54,20 @@ post-patch {
configure.dir ${worksrcpath}/sys/unix
configure.cmd ./setup.sh
configure.pre_args hints/macosx10.10
platform darwin {
if {${os.major} >= 18} {
configure.pre_args hints/macosx10.14
} else {
configure.pre_args hints/macosx10.10
}
}
use_parallel_build no
build.args-append CC=${configure.cc} \
CXX=${configure.cxx} \
CPP=${configure.cpp}
CPP=${configure.cpp} \
CFLAGS="-I../include -DCURSES_GRAPHICS -DNOTPARMDECL"
pre-destroot {
xinstall -d "${destroot}${prefix}/share/man/man6"
@@ -107,10 +119,12 @@ variant x11 {
subport nethack343 {
version 3.4.3
revision 0
description Classic dungeon adventure game (previous version).
platforms darwin freebsd
master_sites sourceforge:nethack
livecheck.type none
distname nethack-343-src
checksums sha256 bb39c3d2a9ee2df4a0c8fdde708fbc63740853a7608d2f4c560b488124866fe4 \
rmd160 42f600d24715a0b7e631b357c135761410b3ca95 \
@@ -0,0 +1,14 @@
--- a/sys/unix/Makefile.src 2023-02-15 14:52:57
+++ b/sys/unix/Makefile.src 2024-04-25 21:21:42
@@ -273,7 +273,10 @@
# Curses - Karl Garrison, Tangles
#WINSRC = $(WINCURSESSRC)
#WINOBJ = $(WINCURSESOBJ)
-#
+
+WINSRC = $(WINTTYSRC) $(WINCURSESSRC)
+WINOBJ = $(WINTTYOBJ) $(WINCURSESOBJ)
+
# on some systems the termcap library is in -ltermcap or -lcurses
# on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
# Sysatt uses shared library in lieu of this option
@@ -33,3 +33,38 @@
CHOWN=chown
CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences.
--- NetHack-NetHack-3.6.6_Released.ORIG/sys/unix/hints/macosx10.14 2020-03-08 12:29:31.000000000 -0500
+++ NetHack-NetHack-3.6.6_Released/sys/unix/hints/macosx10.14 2020-04-25 22:55:10.000000000 -0500
@@ -52,8 +52,8 @@
# administered this may not be what you (or your admin) want.
# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
# - 'make install' must be run as "sudo make install"
-#WANT_SHARE_INSTALL=1
-GAMEUID = $(USER)
+WANT_SHARE_INSTALL=1
+GAMEUID = root
GAMEGRP = games
# build to run in the source tree - primarily for development. Build with "make all"
#WANT_SOURCE_INSTALL=1
@@ -75,7 +75,7 @@
#CFLAGS+=-Wunreachable-code
# XXX -g vs -O should go here, -I../include goes in the makefile
-CFLAGS+=-g -I../include
+CFLAGS+=-O2 -I../include
# older binaries use NOCLIPPING, but that disables SIGWINCH
#CFLAGS+=-DNOCLIPPING
CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
@@ -157,9 +157,9 @@
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
# we install into ~/nethackdir
ifeq ($(GAMEUID),root)
-PREFIX:=/Library/NetHack
-SHELLDIR=/usr/local/bin
-HACKDIR=$(PREFIX)/nethackdir
+PREFIX:=$(DESTDIR)__PREFIX__
+SHELLDIR=$(PREFIX)/bin
+HACKDIR=$(PREFIX)/var/games/nethack
CHOWN=chown
CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences.
@@ -32,3 +32,37 @@
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
--- NetHack-NetHack-3.6.6_Released.ORIG/sys/unix/hints/macosx10.14 2020-03-08 12:29:31.000000000 -0500
+++ NetHack-NetHack-3.6.6_Released/sys/unix/hints/macosx10.14 2020-04-25 23:10:10.000000000 -0500
@@ -19,10 +19,12 @@
# 1. Which window system(s) should be included in this binary?
WANT_WIN_TTY=1
-#WANT_WIN_X11=1
+WANT_WIN_X11=1
#WANT_WIN_QT=1
#WANT_WIN_CURSES=1
+PREFIX:=$(DESTDIR)__PREFIX__
+
# 1a. What is the default window system?
WANT_DEFAULT=tty
#WANT_DEFAULT=x11
@@ -111,7 +113,7 @@
# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev );
# separate from CFLAGS so that we don't pass it to every file
-X11CFLAGS = -I/opt/X11/include
+X11CFLAGS = -I$(PREFIX)/include
CFLAGS += -DX11_GRAPHICS
# avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
X11CFLAGS += -Wno-variadic-macros
@@ -123,5 +125,5 @@
WINSRC += $(WINX11SRC)
WINOBJ += $(WINX11OBJ)
WINLIB += $(WINX11LIB)
-LFLAGS=-L/opt/X11/lib
+LFLAGS=-L$(PREFIX)/lib
endif # WANT_WIN_X11
ifdef WANT_WIN_QT