pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/games



Module Name:    pkgsrc
Committed By:   rhialto
Date:           Sat Sep  2 13:45:14 UTC 2023

Modified Files:
        pkgsrc/games/nethack: MESSAGE
        pkgsrc/games/nethack-lib: Makefile Makefile.common PLIST distinfo
        pkgsrc/games/nethack-lib/patches: patch-include_config.h
            patch-sys_unix_Makefile.src patch-sys_unix_Makefile.utl
            patch-sys_unix_nethack.sh
        pkgsrc/games/nethack-tty: MESSAGE Makefile
        pkgsrc/games/nethack-x11: MESSAGE Makefile
Added Files:
        pkgsrc/games/nethack-lib/patches: patch-win_curses_cursmain.c
            patch-win_curses_curswins.c

Log Message:
games/nethack*: enable curses user interface

The "nethack" wrapper script that papers over the existence of nethack-tty
and nethack-x11 has been made more like the original way to select UIs
(since there are now 3, and each game binary supports more than one of them).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/games/nethack/MESSAGE
cvs rdiff -u -r1.34 -r1.35 pkgsrc/games/nethack-lib/Makefile
cvs rdiff -u -r1.46 -r1.47 pkgsrc/games/nethack-lib/Makefile.common
cvs rdiff -u -r1.9 -r1.10 pkgsrc/games/nethack-lib/PLIST
cvs rdiff -u -r1.31 -r1.32 pkgsrc/games/nethack-lib/distinfo
cvs rdiff -u -r1.2 -r1.3 \
    pkgsrc/games/nethack-lib/patches/patch-include_config.h \
    pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src \
    pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/games/nethack-lib/patches/patch-win_curses_cursmain.c \
    pkgsrc/games/nethack-lib/patches/patch-win_curses_curswins.c
cvs rdiff -u -r1.2 -r1.3 pkgsrc/games/nethack-tty/MESSAGE
cvs rdiff -u -r1.21 -r1.22 pkgsrc/games/nethack-tty/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/games/nethack-x11/MESSAGE
cvs rdiff -u -r1.42 -r1.43 pkgsrc/games/nethack-x11/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/games/nethack/MESSAGE
diff -u pkgsrc/games/nethack/MESSAGE:1.2 pkgsrc/games/nethack/MESSAGE:1.3
--- pkgsrc/games/nethack/MESSAGE:1.2    Tue Sep 24 12:30:00 2002
+++ pkgsrc/games/nethack/MESSAGE        Sat Sep  2 13:45:14 2023
@@ -1,10 +1,9 @@
 ===========================================================================
-$NetBSD: MESSAGE,v 1.2 2002/09/24 12:30:00 wiz Exp $
+$NetBSD: MESSAGE,v 1.3 2023/09/02 13:45:14 rhialto Exp $
 
-You can run the tty version of nethack by executing:
-"nethack"  or "nethack tty"
-The X11 version:  "nethack x11"
-The QT version:   "nethack qt"
+Please select the UI by putting 'windowtype:x11' in your $NETHACKOPTIONS
+or 'OPTIONS=windowtype:tty' at the top of your $HOME/.nethackrc file.
+Available UIs are tty, curses and x11.
 
 Happy Hacking!
 

Index: pkgsrc/games/nethack-lib/Makefile
diff -u pkgsrc/games/nethack-lib/Makefile:1.34 pkgsrc/games/nethack-lib/Makefile:1.35
--- pkgsrc/games/nethack-lib/Makefile:1.34      Tue Jan 28 21:11:30 2020
+++ pkgsrc/games/nethack-lib/Makefile   Sat Sep  2 13:45:14 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.34 2020/01/28 21:11:30 rhialto Exp $
+# $NetBSD: Makefile,v 1.35 2023/09/02 13:45:14 rhialto Exp $
 #
 
 .include               "../../games/nethack-lib/Makefile.common"
@@ -34,7 +34,8 @@ CONF_FILES_PERMS+=    /dev/null ${VARDIR}/r
                        ${NETHACK_USER} ${NETHACK_GROUP} 664
 CONF_FILES_PERMS+=     /dev/null ${VARDIR}/xlogfile \
                        ${NETHACK_USER} ${NETHACK_GROUP} 664
-CONF_FILES+=           /dev/null ${HACKDIR}/sysconf
+CONF_FILES_PERMS+=     ${HACKDIR}/sysconf.example ${HACKDIR}/sysconf   \
+                       ${NETHACK_USER} ${NETHACK_GROUP} 644
 
 REQD_DIRS_PERMS+=      ${VARDIR}                                       \
                        ${NETHACK_USER} ${NETHACK_GROUP} 775
@@ -49,7 +50,10 @@ CHECK_FILES_SKIP+=   ${VARDIR}/logfile                               
 
 # Like bin/nethack-*, bin/recover also has to operate on save files
 # owned by ${NETHACK_USER}:${NETHACK_GROUP}. This means bin/recover
-# can only work when it's setuid'ed to that user/group.
+# can only work when it's setuid'ed to that user:group.
 SPECIAL_PERMS+=                ${PREFIX}/bin/recover ${GAMEPERM}
 
+post-install:
+       cd ${WRKSRC} && ${INSTALL_DATA} sys/unix/sysconf ${DESTDIR}${HACKDIR}/sysconf.example
+
 .include "../../mk/bsd.pkg.mk"

Index: pkgsrc/games/nethack-lib/Makefile.common
diff -u pkgsrc/games/nethack-lib/Makefile.common:1.46 pkgsrc/games/nethack-lib/Makefile.common:1.47
--- pkgsrc/games/nethack-lib/Makefile.common:1.46       Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/Makefile.common    Sat Sep  2 13:45:14 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.46 2023/08/27 15:59:19 rhialto Exp $
+# $NetBSD: Makefile.common,v 1.47 2023/09/02 13:45:14 rhialto Exp $
 #
 # used by games/nethack/Makefile
 # used by games/nethack-lib/Makefile
@@ -21,7 +21,7 @@ NETHACK_DIR=          nethackdir${NETHACK_SAVEVE
 NETHACK_SAVEVER=       3.6.0
 
 DISTNAME=              nethack-${NETHACK_DISTVER}-src
-PKGREVISION=           1
+PKGREVISION=           2
 CATEGORIES=            games
 MASTER_SITES=          https://www.nethack.org/download/${NETHACK_BASEVER}/
 EXTRACT_SUFX=          .tgz
@@ -30,6 +30,7 @@ MAINTAINER=           pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=              https://www.nethack.org/
 LICENSE=               nethack-license
 
+# sh: ../util/makedefs: permission denied
 MAKE_JOBS_SAFE=                no
 
 .if !defined(META_PACKAGE)
@@ -38,9 +39,20 @@ WRKSRC=                      ${WRKDIR}/NetHack-${NETHACK_BA
 HAS_CONFIGURE=         yes
 CONFIGURE_SCRIPT=      ./sys/unix/setup.sh
 USE_TOOLS+=            gzip yacc lex awk
+USE_LANGUAGES+=                c c++
+
+# NetBSD's curses doesn't put the cursor where the game wants it
+# but leaves it in some random position. The playability of the game
+# depends on it, though. Therefore we prefer ncurses.
+USE_NCURSES=           yes
 
 .include "../../mk/curses.buildlink3.mk"
-.include "../../mk/termcap.buildlink3.mk"
+
+# If we link ncurses, it has termcap/terminfo built in;
+# we should not link with the native version.
+.  if "${CURSES_TYPE}" != "ncurses"
+.    include "../../mk/termcap.buildlink3.mk"
+.  endif
 
 OPSYSVARS+=            NETHACK_OS
 NETHACK_OS.Linux=      SYSV
@@ -74,14 +86,23 @@ MAKE_ENV+=          INSTALL_DATA=${INSTALL_DATA:
 MAKE_ENV+=             INSTALL_SCRIPT=${INSTALL_SCRIPT:Q}
 MAKE_ENV+=             INSTALL_PROGRAM=${INSTALL_PROGRAM:Q}
 
+.  if "${CURSES_TYPE}" == "ncurses"
+WINTTYLIB=             # no separate termcap/terminfo needed
+.  else
 WINTTYLIB=             -L${BUILDLINK_PREFIX.termcap}/lib \
                        ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.termcap}/lib \
-                       -l${BUILDLINK_LIBNAME.termcap}
+                       ${BUILDLINK_LDADD.termcap}
+.  endif
 MAKE_ENV+=             WINTTYLIB=${WINTTYLIB:Q}
 
+WINCURSESLIB=          -L${BUILDLINK_PREFIX.curses}/lib \
+                       ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.curses}/lib \
+                       ${BUILDLINK_LDADD.curses}
+MAKE_ENV+=             WINCURSESLIB=${WINCURSESLIB:Q}
+
 CHECK_PORTABILITY_SKIP+=       sys/unix/hints/macosx.sh
 
-pre-configure:
+post-extract:
        ${RUN}${CHMOD} 755 ${WRKSRC}/sys/unix/setup.sh
 
 # Substitute NETHACK_DIR in PLIST.

Index: pkgsrc/games/nethack-lib/PLIST
diff -u pkgsrc/games/nethack-lib/PLIST:1.9 pkgsrc/games/nethack-lib/PLIST:1.10
--- pkgsrc/games/nethack-lib/PLIST:1.9  Thu Oct 24 11:51:23 2019
+++ pkgsrc/games/nethack-lib/PLIST      Sat Sep  2 13:45:14 2023
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.9 2019/10/24 11:51:23 pho Exp $
+@comment $NetBSD: PLIST,v 1.10 2023/09/02 13:45:14 rhialto Exp $
 bin/nethack
 bin/recover
 man/man6/dgn_comp.6
@@ -137,6 +137,7 @@ share/${NETHACK_DIR}/soko3-2.lev
 share/${NETHACK_DIR}/soko4-1.lev
 share/${NETHACK_DIR}/soko4-2.lev
 share/${NETHACK_DIR}/symbols
+share/${NETHACK_DIR}/sysconf.example
 share/${NETHACK_DIR}/tower1.lev
 share/${NETHACK_DIR}/tower2.lev
 share/${NETHACK_DIR}/tower3.lev

Index: pkgsrc/games/nethack-lib/distinfo
diff -u pkgsrc/games/nethack-lib/distinfo:1.31 pkgsrc/games/nethack-lib/distinfo:1.32
--- pkgsrc/games/nethack-lib/distinfo:1.31      Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/distinfo   Sat Sep  2 13:45:14 2023
@@ -1,16 +1,18 @@
-$NetBSD: distinfo,v 1.31 2023/08/27 15:59:19 rhialto Exp $
+$NetBSD: distinfo,v 1.32 2023/09/02 13:45:14 rhialto Exp $
 
 BLAKE2s (nethack-367-src.tgz) = 56c447099ddfdbd1c2dcb0d85b859031057c76fa6a885d9a0fcaae87d47cd371
 SHA512 (nethack-367-src.tgz) = 7890d17e087f4344d30e9a908fa1f24d7c72bc714c4a6415ed59800902cc0aa6b3ce94c5d73857b0222349b96b1fdc8bf3f93b3ac1153477ad1419af7b0d3fb5
 Size (nethack-367-src.tgz) = 5577415 bytes
 SHA1 (patch-ai) = 73c5b2ea1227531089474705f2f18bc411366365
-SHA1 (patch-include_config.h) = c48f9a5a758ddffb4825d7959e8ecaf30ea12b91
+SHA1 (patch-include_config.h) = 963b9b6e580cbdf5516207a485a0baa6b0b7909f
 SHA1 (patch-include_system.h) = b1b53f513c3f6983e0e56eace74c71875b5df3f2
 SHA1 (patch-include_unixconf.h) = 6846c72526f3bda7fe3eccbce641e5feee14d901
 SHA1 (patch-src_mail.c) = 5b2a67e0b4d0fc9c715573d1bad6bcafa67b469e
 SHA1 (patch-sys_unix_Makefile.doc) = 6219620c50dc7eac6601f87d4a295cb10f02e141
-SHA1 (patch-sys_unix_Makefile.src) = 639f33146101e91d5fabed47f9e9703b957e48d1
+SHA1 (patch-sys_unix_Makefile.src) = 36c4adc70551b5a460ebeb86eeb34fb188e5b420
 SHA1 (patch-sys_unix_Makefile.top) = 0736aafda67dec45657f9f15338ce2f89add9747
-SHA1 (patch-sys_unix_Makefile.utl) = 55da562baa7240d811eb7597e77a8beaf58d7d81
-SHA1 (patch-sys_unix_nethack.sh) = 0a0178e3bdc3e78f004bd0112938f3c9e49faf40
+SHA1 (patch-sys_unix_Makefile.utl) = b36a85ffa0bd561c2d77776cdf68e6a89273d5c9
+SHA1 (patch-sys_unix_nethack.sh) = 0f400835ea9505e5429cc51eccdb7b2e48799777
 SHA1 (patch-util_recover.c) = 60e5ec35313a97cf788ff1ed4a4772bbcf24bc48
+SHA1 (patch-win_curses_cursmain.c) = f7c51305c65c08686b00ba92a128f9c995dcf1dc
+SHA1 (patch-win_curses_curswins.c) = b65ae0f74477cf7c1dbc2ff1f802841270dae7d4

Index: pkgsrc/games/nethack-lib/patches/patch-include_config.h
diff -u pkgsrc/games/nethack-lib/patches/patch-include_config.h:1.2 pkgsrc/games/nethack-lib/patches/patch-include_config.h:1.3
--- pkgsrc/games/nethack-lib/patches/patch-include_config.h:1.2 Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/patches/patch-include_config.h     Sat Sep  2 13:45:14 2023
@@ -1,6 +1,6 @@
-$NetBSD: patch-include_config.h,v 1.2 2023/08/27 15:59:19 rhialto Exp $
+$NetBSD: patch-include_config.h,v 1.3 2023/09/02 13:45:14 rhialto Exp $
 
-Make window system configurable.
+Make included UI types configurable.
 
 --- include/config.h.orig      2023-02-15 21:52:57.000000000 +0000
 +++ include/config.h
Index: pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh
diff -u pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh:1.2 pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh:1.3
--- pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh:1.2      Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/patches/patch-sys_unix_nethack.sh  Sat Sep  2 13:45:14 2023
@@ -1,13 +1,11 @@
-$NetBSD: patch-sys_unix_nethack.sh,v 1.2 2023/08/27 15:59:19 rhialto Exp $
+$NetBSD: patch-sys_unix_nethack.sh,v 1.3 2023/09/02 13:45:14 rhialto Exp $
 
-Modify the wrapper script so users can choose the UI type on the
-command line.
+Modify the wrapper script to find the app-defaults, the font path,
+the nethack binary with the highest number of UIs.
 
-(Perhaps this should be handled by the pkg_alternatives framework.)
-
---- sys/unix/nethack.sh.orig   2019-05-08 07:00:16.000000000 +0000
+--- sys/unix/nethack.sh.orig   2023-02-15 21:52:57.000000000 +0000
 +++ sys/unix/nethack.sh
-@@ -3,9 +3,32 @@
+@@ -3,23 +3,56 @@
  # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
  # NetHack may be freely redistributed.  See license for details.
  
@@ -15,30 +13,60 @@ command line.
 +HACKDIR="@HACKDIR@"
  export HACKDIR
 -HACK=$HACKDIR/nethack
+ 
+-# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
++UILIST="curses tty" 
++if [ -n "$DISPLAY" ]
++then
++    UILIST="qt x11 $UILIST" 
++fi
 +
-+UILIST="tty curses x11 qt" 
-+findbin ()
-+{
-+      for x in $UILIST; do
-+              if [ -x "@PREFIX@/bin/nethack-$x" ]; then
-+                      echo $x
-+                      return
-+              fi
-+      done
-+}
++case "$1" in
++      qt|x11|curses|tty)
++          echo "Please select the UI by putting 'windowtype:$1' in your \$NETHACKOPTIONS"
++          echo "or 'OPTIONS=windowtype:$1' at the top of your \$HOME/.nethackrc file."
++          exit 1
++          ;;
++esac
 +
-+if [ -z "$1" -o -z "${1%%-*}" ]; then
-+      UI=`findbin`
-+else
-+      UI=$1
-+    shift
-+fi
++HACK=""
++
++for x in $UILIST
++do
++      if [ -x "@PREFIX@/bin/nethack-$x" ]
++      then
++              HACK="@PREFIX@/bin/nethack-$x"
++              break
++      fi
++done
 +
-+if [ -z "$UI" ]; then
-+      echo "No UI ($UILIST) found"
++if [ -z "$HACK" ]
++then
++      echo "No UI found (nethack-$UILIST)"
 +      exit 1
 +fi
-+HACK="@PREFIX@/bin/nethack-${UI}"
- 
- # Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
++
++# Since app-defaults/NetHack is installed in @PREFIX@/lib/X11,
++# add it to XUSERFILESEARCHPATH.
  case "x$XUSERFILESEARCHPATH" in
+-x)    XUSERFILESEARCHPATH="$HACKDIR/%N.ad"
++x)    XUSERFILESEARCHPATH="@PREFIX@/lib/X11/app-defaults/%N"
+       ;;
+-*)    XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad"
++*)    XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:@PREFIX@/lib/X11/app-defaults/%N"
+       ;;
+ esac
+ export XUSERFILESEARCHPATH
+ 
+ # Get font dir added, but only once (and only if there's an xset to be found).
+-test -n "$DISPLAY" -a -f $HACKDIR/fonts.dir && xset p >/dev/null 2>&1 && (
+-      xset fp- $HACKDIR >/dev/null 2>&1;
+-      xset fp+ $HACKDIR
++test -n "$DISPLAY" -a -f @PREFIX@/share/fonts/X11/misc/fonts.dir && xset p >/dev/null 2>&1 && (
++      if ! xset q | grep @PREFIX@/share/fonts/X11/misc >/dev/null 2>&1
++      then
++          xset fp+ @PREFIX@/share/fonts/X11/misc
++      fi
+ )
+ 
+ # see if we can find the full path name of PAGER, so help files work properly

Index: pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src
diff -u pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src:1.4 pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src:1.5
--- pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src:1.4    Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.src        Sat Sep  2 13:45:14 2023
@@ -1,6 +1,6 @@
-$NetBSD: patch-sys_unix_Makefile.src,v 1.4 2023/08/27 15:59:19 rhialto Exp $
+$NetBSD: patch-sys_unix_Makefile.src,v 1.5 2023/09/02 13:45:14 rhialto Exp $
 
-Make window system configurable.
+Make included UI types configurable.
 
 --- sys/unix/Makefile.src.orig 2023-02-15 21:52:57.000000000 +0000
 +++ sys/unix/Makefile.src
@@ -9,7 +9,7 @@ Make window system configurable.
  
  # Usually, the C compiler driver is used for linking:
 -#LINK=$(CC)
-+.if "${GTYPE}" == "-qt"
++.if "${QT_GRAPHICS}" != ""
 +LINK=$(CXX)
 +.else
 +LINK=$(CC)
@@ -17,33 +17,26 @@ Make window system configurable.
  
  # Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
  # system.
-@@ -170,9 +174,24 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/
+@@ -169,10 +173,17 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/
+ 
  # flags for debugging:
  # CFLAGS = -g -I../include
++#CFLAGS += -ggdb
++#LFLAGS += -ggdb
  
 -#CFLAGS = -O -I../include
 +CFLAGS += -I../include
  #LFLAGS = 
  
-+.if "${GTYPE}" == "-x11" || "${GTYPE}" == "-qt"
++.if "${X11_GRAPHICS}" != "" || "${QT_GRAPHICS}" != ""
 +CFLAGS += -I${X11BASE}/include
 +LFLAGS += ${LDFLAGS}
 +.endif
 +
-+.if "${GTYPE}" == "-tty"
-+CFLAGS += -DGTYPE_TTY
-+.elif "${GTYPE}" == "-curses"
-+CFLAGS += -DGTYPE_CURSES
-+.elif "${GTYPE}" == "-x11"
-+CFLAGS += -DGTYPE_X11
-+.elif "${GTYPE}" == "-qt"
-+CFLAGS += -DGTYPE_QT
-+.endif
-+
  # 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
  # the C++ libraries linked in.
-@@ -267,13 +286,25 @@ WINBEOBJ =
+@@ -267,13 +278,26 @@ WINBEOBJ =
  #WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
  #
  #
@@ -57,14 +50,15 @@ Make window system configurable.
  #WINOBJ = $(WINCURSESOBJ)
 -#
 +
-+.if "${GTYPE}" == "-tty"
-+.elif "${GTYPE}" == "-curses"
++.if "${CURSES_GRAPHICS}" != ""
 +WINSRC += $(WINCURSESSRC)
 +WINOBJ += $(WINCURSESOBJ)
-+.elif "${GTYPE}" == "-x11"
++.endif
++.if "${X11_GRAPHICS}" != ""
 +WINSRC += $(WINX11SRC)
 +WINOBJ += $(WINX11OBJ)
-+.elif "$(GTYPE)" == "-qt"
++.endif
++.if "${QT_GRAPHICS}" != ""
 +WINSRC += $(WINQT4SRC)
 +WINOBJ += $(WINQT4OBJ)
 +.endif
@@ -72,7 +66,7 @@ Make window system configurable.
  # 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
-@@ -292,14 +323,14 @@ WINBEOBJ =
+@@ -292,14 +316,14 @@ WINBEOBJ =
  #
  # libraries for X11
  # If USE_XPM is defined in config.h, you will also need -lXpm here.
@@ -89,14 +83,12 @@ Make window system configurable.
  #
  # libraries for Qt 4
  WINQT4LIB = `pkg-config QtGui --libs`
-@@ -320,18 +351,27 @@ WINGEMLIB = -le_gem -lgem
- WINBELIB = -lbe
+@@ -321,17 +345,28 @@ WINBELIB = -lbe
  #
  # libraries for curses port
--# link with ncurses
+ # link with ncurses
 -WINCURSESLIB = -lncurses
-+# link with (n)curses
-+WINCURSESLIB = -lcurses # or -L${PREFIX}/lib -Wl,-R,${PREFIX}/lib -lncurses
++#WINCURSESLIB = -lncurses     # Set from the pkg Makefile instead
  # link with pdcurses for SDL, installed in a separate directory
  #WINCURSESLIB = -L/usr/local/lib/pdcurses -lpdcurses -lSDL
  # same as above, for XCurses
@@ -107,14 +99,15 @@ Make window system configurable.
  #
  # For Curses
  #WINLIB = $(WINCURSESLIB)
--#
+ #
 +
-+.if "${GTYPE}" == "-tty"
-+.elif "${GTYPE}" == "-curses"
++.if "${CURSES_GRAPHICS}" != ""
 +WINLIB += $(WINCURSESLIB)
-+.elif "${GTYPE}" == "-x11"
++.endif
++.if "${X11_GRAPHICS}" != ""
 +WINLIB += $(WINX11LIB)
-+.elif "${GTYPE}" == "-qt"
++.endif
++.if "$(QT_GRAPHICS)" != ""
 +WINLIB += $(WINQTLIB)
 +.endif
 +
Index: pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl
diff -u pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl:1.4 pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl:1.5
--- pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl:1.4    Sun Aug 27 15:59:19 2023
+++ pkgsrc/games/nethack-lib/patches/patch-sys_unix_Makefile.utl        Sat Sep  2 13:45:14 2023
@@ -1,6 +1,6 @@
-$NetBSD: patch-sys_unix_Makefile.utl,v 1.4 2023/08/27 15:59:19 rhialto Exp $
+$NetBSD: patch-sys_unix_Makefile.utl,v 1.5 2023/09/02 13:45:14 rhialto Exp $
 
-Make window system configurable.
+Make included UI types configurable.
 
 --- sys/unix/Makefile.utl.orig 2023-02-15 21:52:57.000000000 +0000
 +++ sys/unix/Makefile.utl
@@ -9,24 +9,7 @@ Make window system configurable.
  # CFLAGS = -g -I../include
  
 -#CFLAGS = -O -I../include
-+CFLAGS = -I../include
++CFLAGS += -I../include
  #LFLAGS =
  
  # we specify C preprocessor flags via CFLAGS; files built with default rules
-@@ -104,6 +104,16 @@ CPPFLAGS =
- 
- LIBS =
- 
-+.if "${GTYPE}" == "-tty"
-+CFLAGS += -DGTYPE_TTY
-+.elif "${GTYPE}" == "-curses"
-+CFLAGS += -DGTYPE_CURSES
-+.elif "${GTYPE}" == "-x11"
-+CFLAGS += -DGTYPE_X11
-+.elif "${GTYPE}" == "-qt"
-+CFLAGS += -DGTYPE_QT
-+.endif
-+
- # If you are cross-compiling, you must use this:
- #OBJDIR = .
- # otherwise, you can save a little bit of disk space with this:

Index: pkgsrc/games/nethack-tty/MESSAGE
diff -u pkgsrc/games/nethack-tty/MESSAGE:1.2 pkgsrc/games/nethack-tty/MESSAGE:1.3
--- pkgsrc/games/nethack-tty/MESSAGE:1.2        Tue Sep 24 12:30:01 2002
+++ pkgsrc/games/nethack-tty/MESSAGE    Sat Sep  2 13:45:14 2023
@@ -1,7 +1,8 @@
 ===========================================================================
-$NetBSD: MESSAGE,v 1.2 2002/09/24 12:30:01 wiz Exp $
+$NetBSD: MESSAGE,v 1.3 2023/09/02 13:45:14 rhialto Exp $
 
-You can run the tty NetHack by simply typing: "nethack"
-or with "nethack tty"
+You can run the tty NetHack by typing "nethack".
+Select the windowing type with "OPTIONS=windowtype:tty" in your
+$HOME/.nethackrc. Another possible values is "curses".
 
 ===========================================================================

Index: pkgsrc/games/nethack-tty/Makefile
diff -u pkgsrc/games/nethack-tty/Makefile:1.21 pkgsrc/games/nethack-tty/Makefile:1.22
--- pkgsrc/games/nethack-tty/Makefile:1.21      Thu Oct 24 11:51:52 2019
+++ pkgsrc/games/nethack-tty/Makefile   Sat Sep  2 13:45:14 2023
@@ -1,17 +1,23 @@
-# $NetBSD: Makefile,v 1.21 2019/10/24 11:51:52 pho Exp $
+# $NetBSD: Makefile,v 1.22 2023/09/02 13:45:14 rhialto Exp $
 #
 
 .include "../../games/nethack-lib/Makefile.common"
 
 PKGNAME=               nethack-tty-${NETHACK_VERSION}
 
-COMMENT=               The tty/console based version of NetHack
+COMMENT=               The tty and curses based version of NetHack
 
 DEPENDS+=              nethack-lib-${NETHACK_VERSION}{,nb*}:../../games/nethack-lib
 
 BUILD_TARGET=          nethack
+CONFIGURE_ARGS=                sys/unix/hints/pkgsrc
 MAKE_ENV+=             GAME=nethack
-MAKE_ENV+=             GTYPE=-tty
+
+pre-configure:
+       ( ${ECHO} '#-PRE'; \
+         ${ECHO} 'CFLAGS+=-DCURSES_GRAPHICS'; \
+         ${ECHO} 'CURSES_GRAPHICS=1'; \
+       ) > ${WRKSRC}/sys/unix/hints/pkgsrc
 
 INSTALLATION_DIRS+=    bin
 do-install:

Index: pkgsrc/games/nethack-x11/MESSAGE
diff -u pkgsrc/games/nethack-x11/MESSAGE:1.7 pkgsrc/games/nethack-x11/MESSAGE:1.8
--- pkgsrc/games/nethack-x11/MESSAGE:1.7        Sat Dec  7 13:27:08 2019
+++ pkgsrc/games/nethack-x11/MESSAGE    Sat Sep  2 13:45:14 2023
@@ -1,10 +1,12 @@
 ===========================================================================
-$NetBSD: MESSAGE,v 1.7 2019/12/07 13:27:08 rhialto Exp $
+$NetBSD: MESSAGE,v 1.8 2023/09/02 13:45:14 rhialto Exp $
 
-You can run the X11 NetHack by typing "nethack x11".
+You can run the X11 NetHack by typing "nethack".
+Select the windowing type with "OPTIONS=windowtype:x11" in your
+$HOME/.nethackrc. Other possible values are "curses" and "tty".
 
-Two fonts were installed for NetHack.  You must add
-${PREFIX}/share/fonts/X11/misc to fontpath and set one of
+Two fonts were installed for NetHack.  The nethack wrapper script
+adds ${PREFIX}/share/fonts/X11/misc to fontpath. You can set one of
 
 NetHack*map*font: nh10
 NetHack*map*font: -misc-fixed-medium-r-normal-ibmpc-14-120-75-75-c-80-iso8859-1
@@ -21,7 +23,6 @@ find its app-defaults file:
 
 XFILESEARCHPATH=%D:/usr/pkg/lib/X11/%T/%N%C:/usr/pkg/lib/X11/%T/%N
 
-To fall back to tty mode, use "NETHACKOPTIONS=windowtype:tty nethack"
-or set that option in your .nethackrc file.
+but the nethack wrapper script sets XUSERFILESEARCHPATH for you.
 
 ===========================================================================

Index: pkgsrc/games/nethack-x11/Makefile
diff -u pkgsrc/games/nethack-x11/Makefile:1.42 pkgsrc/games/nethack-x11/Makefile:1.43
--- pkgsrc/games/nethack-x11/Makefile:1.42      Wed Jan 29 20:23:16 2020
+++ pkgsrc/games/nethack-x11/Makefile   Sat Sep  2 13:45:14 2023
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.42 2020/01/29 20:23:16 rhialto Exp $
+# $NetBSD: Makefile,v 1.43 2023/09/02 13:45:14 rhialto Exp $
 
 .include "../../games/nethack-lib/Makefile.common"
 
 PKGNAME=               nethack-x11-${NETHACK_VERSION}
-COMMENT=               The X11 version of NetHack
+COMMENT=               The X11 and tty/curses version of NetHack
 
 CATEGORIES+=           x11
 
@@ -11,7 +11,7 @@ DEPENDS+=             nethack-lib-${NETHACK_VERSION
 
 BUILD_TARGET=          nethack ${VARDATND}
 MAKE_ENV+=             GAME=nethack
-MAKE_ENV+=             GTYPE=-x11
+CONFIGURE_ARGS=                sys/unix/hints/pkgsrc
 
 VARDATND=              x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
 MAKE_ENV+=             VARDATND=${VARDATND:Q}
@@ -25,6 +25,15 @@ PATCHDIR=            ${.CURDIR}/../../games/nethac
 
 SPECIAL_PERMS+=                ${PREFIX}/bin/nethack-x11                       \
                            ${GAMEPERM}
+
+pre-configure:
+       ( ${ECHO} '#-PRE'; \
+         ${ECHO} 'CFLAGS+=-DCURSES_GRAPHICS'; \
+         ${ECHO} 'CURSES_GRAPHICS=1'; \
+         ${ECHO} 'CFLAGS+=-DX11_GRAPHICS'; \
+         ${ECHO} 'X11_GRAPHICS=1'; \
+       ) > ${WRKSRC}/sys/unix/hints/pkgsrc
+
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/src/nethack \
            ${DESTDIR}${PREFIX}/bin/nethack-x11
@@ -48,6 +57,9 @@ post-install:
            ${DESTDIR}${HACKDIR}/nethack.x11.rc
 
 .include "../../x11/libXaw/buildlink3.mk"
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libXmu/buildlink3.mk"
 .include "../../x11/libXpm/buildlink3.mk"
 .include "../../x11/libXt/buildlink3.mk"
+
 .include "../../mk/bsd.pkg.mk"

Added files:

Index: pkgsrc/games/nethack-lib/patches/patch-win_curses_cursmain.c
diff -u /dev/null pkgsrc/games/nethack-lib/patches/patch-win_curses_cursmain.c:1.1
--- /dev/null   Sat Sep  2 13:45:15 2023
+++ pkgsrc/games/nethack-lib/patches/patch-win_curses_cursmain.c        Sat Sep  2 13:45:14 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-win_curses_cursmain.c,v 1.1 2023/09/02 13:45:14 rhialto Exp $
+
+Include the window resizing code also for NetBSD curses.
+
+--- win/curses/cursmain.c.orig 2023-02-15 21:52:57.000000000 +0000
++++ win/curses/cursmain.c
+@@ -277,7 +277,7 @@ curses_get_nh_event()
+         do_reset = TRUE;
+     }
+ #endif
+-#ifdef NCURSES_VERSION          /* Is there a better way to detect ncurses? */
++#if 1 /* def NCURSES_VERSION */         /* Is there a better way to detect ncurses? */
+     if (is_term_resized(term_rows, term_cols)) {
+         if (!isendwin()) {
+             endwin();
Index: pkgsrc/games/nethack-lib/patches/patch-win_curses_curswins.c
diff -u /dev/null pkgsrc/games/nethack-lib/patches/patch-win_curses_curswins.c:1.1
--- /dev/null   Sat Sep  2 13:45:15 2023
+++ pkgsrc/games/nethack-lib/patches/patch-win_curses_curswins.c        Sat Sep  2 13:45:14 2023
@@ -0,0 +1,32 @@
+$NetBSD: patch-win_curses_curswins.c,v 1.1 2023/09/02 13:45:14 rhialto Exp $
+
+NetBSD's curses crashes when status_window is NULL, which can happen
+while #quit'ing.
+
+--- win/curses/curswins.c.orig 2023-08-28 19:22:25.737331832 +0000
++++ win/curses/curswins.c
+@@ -173,12 +173,18 @@ curses_refresh_nethack_windows()
+         touchwin(stdscr);
+         refresh();
+     } else {
+-        touchwin(status_window);
+-        wnoutrefresh(status_window);
+-        touchwin(map_window);
+-        wnoutrefresh(map_window);
+-        touchwin(message_window);
+-        wnoutrefresh(message_window);
++        if (status_window) {
++            touchwin(status_window);
++            wnoutrefresh(status_window);
++        }
++        if (map_window) {
++            touchwin(map_window);
++            wnoutrefresh(map_window);
++        }
++        if (message_window) {
++            touchwin(message_window);
++            wnoutrefresh(message_window);
++        }
+         if (inv_window) {
+             touchwin(inv_window);
+             wnoutrefresh(inv_window);



Home | Main Index | Thread Index | Old Index