Skip to content

Commit

Permalink
Merge branch 'nethack-01' of github.com:esselfe/moonbase-other into e…
Browse files Browse the repository at this point in the history
…sselfe-nethack-01
  • Loading branch information
stumbles committed Dec 24, 2024
2 parents adffdad + 4ca8e91 commit b71b968
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 50 deletions.
2 changes: 1 addition & 1 deletion games/nethack/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ sh sys/unix/setup.sh sys/unix/hints/linux &&

default_make &&

chmod 0775 /var/games/nethack{,/save} &&
chmod 0775 /usr/games/lib/nethackdir{,/save} &&

install -Dm0644 {doc,/usr/man/man6}/nethack.6
12 changes: 6 additions & 6 deletions games/nethack/DETAILS
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
MODULE=nethack
VERSION=3.6.1
SOURCE=$MODULE-361-src.tgz
SOURCE_DIRECTORY=$BUILD_DIRECTORY/$MODULE-$VERSION/
SOURCE_URL=$SFORGE_URL/$MODULE/
SOURCE_VFY=sha256:4b8cbf1cc3ad9f6b9bae892d44a9c63106d44782a210906162a7c3be65040ab6
VERSION=3.6.7
SOURCE=$MODULE-${VERSION//.}-src.tgz
SOURCE_DIRECTORY=$BUILD_DIRECTORY/NetHack-$VERSION
SOURCE_URL=https://www.nethack.org/download/$VERSION
SOURCE_VFY=sha256:98cf67df6debf9668a61745aa84c09bcab362e5d33f5b944ec5155d44d2aacb2
WEB_SITE=http://www.nethack.org
ENTERED=20070526
UPDATED=20181225
UPDATED=20241208
SHORT="A single player dungeon exploration game"

cat << EOF
Expand Down
48 changes: 5 additions & 43 deletions games/nethack/PRE_BUILD
Original file line number Diff line number Diff line change
@@ -1,45 +1,7 @@
default_pre_build &&

if in_depends $MODULE libX11; then
sedit '/#define X11_GRAPHICS/ c #define X11_GRAPHICS' include/config.h &&

# add X11 makefile targets - no joke, this has to be done by hand
sedit '/^WINSRC = $(WINTTYSRC)/ c WINSRC = $(WINTTYSRC) $(WINX11SRC)
/^WINOBJ = $(WINTTYOBJ)/ c WINOBJ = $(WINTTYOBJ) $(WINX11OBJ)
/^WINLIB = $(WINTTYLIB)/ c WINLIB = $(WINTTYLIB) $(WINX11LIB)' sys/unix/Makefile.src &&

# modern xrdb complains about ' characters
sedit "s:':\`:g" win/X11/NetHack.ad
fi &&

if in_depends $MODULE libXpm; then
sedit '/\/\* # define USE_XPM/ c #define USE_XPM' include/config.h &&
# add -lXpm
sedit '/^WINX11LIB =/ c WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11' sys/unix/Makefile.src

sedit '/NetHack\.tile_file/ c NetHack.tile_file: x11tiles
/NetHack\.pet_mark_bitmap/ c NetHack.pet_mark_bitmap: pet_mark.xbm
/NetHack\.pet_mark_color/ c NetHack.pet_mark_color: Red
/NetHack\.tombstone/ c NetHack.tombstone: rip.xpm' win/X11/NetHack.ad
fi &&

sedit '/#define COMPRESS "\/usr\/bin\/compress"/ c #define COMPRESS "/bin/gzip"
/#define COMPRESS_EXTENSION.*/ c #define COMPRESS_EXTENSION ".gz"
/#define DLB/ c #define DLB' include/config.h &&

sedit '/#define LINUX/ c #define LINUX
/#define TIMED_DELAY/ c #define TIMED_DELAY
/#define VAR_PLAYGROUND/ c #define VAR_PLAYGROUND "/var/games/nethack"' include/unixconf.h &&

sedit '/GAMEGRP *= bin/ c GAMEGRP = games
/GAMEPERM = 04755/ c GAMEPERM = 02755
/FILEPERM = 0644/ c FILEPERM = 0664
/DIRPERM = 0755/ c DIRPERM = 0775
/GAMEDIR *=/ c GAMEDIR = /usr/lib/games/nethack
/VARDIR *=/ c VARDIR = /var/games/nethack
/^VARDATND =/ c VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm' sys/unix/Makefile.top &&

sedit '/^PREFIX=.*/ c PREFIX=/usr
/^VARFILEPERM.*/ c VARFILEPERM=0660' sys/unix/hints/linux &&

sedit 's/NEARDATA winid WIN_STATUS/extern \0/' src/windows.c
# The ncurses installation in Lunar doesn't have libtinfo.so
sedit 's/ -ltinfo//' sys/unix/hints/linux &&
# Prevents installing in /root/nh/install/games/
sedit '/wildcard/d' sys/unix/hints/linux &&
sedit 's:^\#\(PREFIX=/usr\):\1:' sys/unix/hints/linux
132 changes: 132 additions & 0 deletions games/nethack/patch.d/nethack-3.6.3-recover.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
From d8878eddd04cb986d57cc721d719670dc7f4d156 Mon Sep 17 00:00:00 2001
From: Stefan Strogin <[email protected]>
Date: Tue, 17 Dec 2019 20:20:52 +0200
Subject: [PATCH] Rename manpage from recover to recover-nethack

Based on the patch from https://bugs.gentoo.org/203556

Upstream-Status: Inappropriate [Gentoo-specific]
Signed-off-by: Stefan Strogin <[email protected]>
---
doc/nethack.6 | 2 +-
doc/recover.6 | 28 ++++++++++++++--------------
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/doc/nethack.6 b/doc/nethack.6
index dda4c89f4..b26a2b493 100644
--- a/doc/nethack.6
+++ b/doc/nethack.6
@@ -393,7 +393,7 @@ SHOPTYPE and SPLEVTYPE can be used in debugging (wizard) mode.
DEBUGFILES can be used if the program was built with 'DEBUG' enabled.
.SH "SEE ALSO"
.PP
-dgn_comp(6), lev_comp(6), recover(6)
+dgn_comp(6), lev_comp(6), recover-nethack(6)
.SH BUGS
.PP
Probably infinite.
diff --git a/doc/recover.6 b/doc/recover.6
index 1209d31d3..eee5bbc61 100644
--- a/doc/recover.6
+++ b/doc/recover.6
@@ -1,4 +1,4 @@
-.TH RECOVER 6 "14 December 2015" NETHACK
+.TH RECOVER-NETHACK 6 "14 December 2015" NETHACK
.de ND
.ds Nd \\$3
..
@@ -13,9 +13,9 @@
.NR $NHDT-Revision: 1.9 $
.ds Na Kenneth Lorber
.SH NAME
-recover \- recover a NetHack game interrupted by disaster
+recover-nethack \- recover a NetHack game interrupted by disaster
.SH SYNOPSIS
-.B recover
+.B recover-nethack
[
.B \-d
.I directory
@@ -33,7 +33,7 @@ so such games can be recovered at the point of the last level change.
The
.I base
options tell
-.I recover
+.I recover-nethack
which files to process.
Each base option specifies recovery of a separate game.
.PP
@@ -83,24 +83,24 @@ by a user number to avoid conflicts,
or "xlock" if the number of concurrent players is being limited.
It may be necessary to look in the playground to find the correct
base name of the interrupted game.
-.I recover
+.I recover-nethack
will transform these level files into a save file of the same name as
.I nethack
would have used.
.PP
Since
-.I recover
+.I recover-nethack
must be able to read and delete files from the playground
and create files in the save directory,
it has interesting interactions with game security.
Giving ordinary players access to
-.I recover
+.I recover-nethack
through setuid or setgid is tantamount to leaving the playground
world-writable,
with respect to both cheating and messing up other players.
For a single-user system, this of course does not change anything,
so some of the microcomputer ports install
-.I recover
+.I recover-nethack
by default.
.PP
For a multi-user system,
@@ -108,22 +108,22 @@ the game administrator may want to arrange for all .0 files in the
playground to be fed to recover when the host machine boots,
and handle game crashes individually.
If the user population is sufficiently trustworthy,
-.I recover
+.I recover-nethack
can be installed with the same permissions the
.I nethack
executable has.
In either case,
-.I recover
+.I recover-nethack
is easily compiled from the distribution utility directory.
.SH NOTES
.PP
Like
.I nethack
itself,
-.I recover
+.I recover-nethack
will overwrite existing savefiles of the same name.
Savefiles created by
-.I recover
+.I recover-nethack
are uncompressed;
they may be compressed afterwards if desired,
but even a compression-using
@@ -133,12 +133,12 @@ will find them in the uncompressed form.
nethack(6)
.SH BUGS
.PP
-.I recover
+.I recover-nethack
makes no attempt to find out if a base name specifies a game in progress.
If multiple machines share a playground, this would be impossible to
determine.
.PP
-.I recover
+.I recover-nethack
should be taught to use the nethack playground locking mechanism to
avoid conflicts.
.SH COPYRIGHT
--
2.24.1

10 changes: 10 additions & 0 deletions games/nethack/patch.d/nethack-3.6.6-clang16.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
https://bugs.gentoo.org/874462
--- a/win/tty/wintty.c
+++ b/win/tty/wintty.c
@@ -26,2 +26,6 @@

+#ifdef DEF_PAGER
+#include <fcntl.h>
+#endif
+
#ifndef NO_TERMS

0 comments on commit b71b968

Please sign in to comment.