xnethack
LOW
maintainer friedev
0 votes
scanned 2026-09-26 21:15:27.200055
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: Aaron Friesen <aaron@frie.dev>
2
#
3
# Based on the official `nethack 5.0.0-1` PKGBUILD by:
4
# Ivy Foster <iff@archlinux.org>
5
# schuay <jakob.gruber@gmail.com>
6
# kevin <kevin@archlinux.org>
7
# Christian Schmidt <mucknert@gmx.net>
8
# Markus Meissner <markus@meissna.de>
9
# Nick Erdmann <erdmann@date.upb.de>
10
#
11
# shellcheck shell=bash disable=SC2034,SC2154,SC2164
12
pkgname=xnethack
13
pkgver=10.0
14
pkgrel=1
15
pkgdesc='A fork of the dungeon exploration game NetHack'
16
arch=('x86_64')
17
url='https://github.com/copperwater/xNetHack'
18
license=(NGPL)
19
depends=(filesystem ncurses gzip lua54)
20
_tag=xnh$pkgver
21
source=(
22
"$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$_tag.tar.gz"
23
use-system-lua54.patch
24
tmpfiles.conf
25
)
26
sha256sums=(
27
'bceedf4fc964adb2ba98f2d0c3af70c818db526b9d17c7085a806ed0ff70229b'
28
'ddeb0ef6480f652ce618c33e06bc452f3dfe1f550d40777a76ab70473c7aab10'
29
'6dc7cca8b3b1c3fc94967ca5557a91a30404a360bd2c2fba6f6c6f7fecc91401'
30
)
31
_srcdir=xNetHack-$_tag
32
33
_lua_version_expected() {
34
local lua_release
35
lua_release=$(awk -F '"' '$1 ~ /^#define LUA_VERSION_RELEASE/ { print $2; exit }' /usr/include/lua5.4/lua.h)
36
printf '%d' "$((50400 + lua_release))"
37
}
38
39
prepare() {
40
cd "$_srcdir"
41
42
patch -p1 -i "$srcdir/use-system-lua54.patch"
43
44
# We're building XNH from a tarball, so remove Git metadata probes.
45
sed -i \
46
-e '/^GIT_HASH :=/d' \
47
-e '/^GIT_BRANCH :=/d' \
48
-e '/^GIT_PREFIX :=/d' \
49
sys/unix/hints/linux.500
50
touch dat/gitinfo.txt
51
52
sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
53
-e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' \
54
-i include/unixconf.h
55
56
# we are setting up for setgid games, so modify all necessary permissions
57
# to allow full access for groups
58
59
# With thanks to bugtracker user loqs for the CFLAGS and LDFLAGS adjustments
60
# shellcheck disable=SC2016
61
sed -e '/^HACKDIR/ s|/games/lib/\$(GAME)dir|/var/games/xnethack/|' \
62
-e '/^SHELLDIR/ s|/games|/usr/bin|' \
63
-e '/^VARDIRPERM/ s|0755|0775|' \
64
-e '/^VARFILEPERM/ s|0600|0664|' \
65
-e '/^GAMEPERM/ s|0755|02755|' \
66
-e '/-DTIMED_DELAY/d' \
67
-e 's|\(DSYSCF_FILE=\)\\"[^"]*\\"|\1\\"/var/games/xnethack/sysconf\\"|' \
68
-e 's|CFLAGS=-g -O -I../include -DNOTPARMDECL|CFLAGS+= $(CPPFLAGS) -I../include -DNOTPARMDECL|' \
69
-e 's/LFLAGS=-rdynamic/LFLAGS=$(LDFLAGS) -rdynamic/' \
70
-e 's|\(DHACKDIR=\)\\"[^"]*\\"|\1\\"/var/games/xnethack/\\"|' \
71
-i sys/unix/hints/linux.500
72
73
# Set Lua release (e.g. 50409) to match system
74
sed "/^CFLAGS=.*DNOTPARMDECL/ s|\$| -DNHL_VERSION_EXPECTED=$(_lua_version_expected)|" \
75
-i sys/unix/hints/include/compiler.500
76
77
# Fix the way they disable __warn_unused_result__
78
sed '/^#define __warn_unused_result__/ s,/\*empty\*/,__unused__,' \
79
-i include/tradstdc.h
80
81
sed -e 's|^#GAMEUID.*|GAMEUID = root|' \
82
-e 's|^#GAMEGRP.*|GAMEGRP = games|' \
83
-e '/^FILEPERM\s*=/ s|0644|0664|' \
84
-e '/^DIRPERM\s*=/ s|0755|0775|' \
85
-i sys/unix/Makefile.top
86
87
sed -e "/^MANDIR\s*=/s|/usr/man/man6|$pkgdir/usr/share/man/man6|" \
88
-i sys/unix/Makefile.doc
89
90
# The config is installed under /etc, so compile in its final path.
91
# (This is currently broken in the `nethack` package.)
92
sed -i 's|/var/games/xnethack/sysconf|/etc/xnethack/sysconf|' \
93
sys/unix/hints/linux.500
94
95
# run setup scripts
96
sh sys/unix/setup.sh sys/unix/hints/linux.500
97
}
98
99
build() {
100
cd "$_srcdir"
101
102
make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 GIT=0 GITINFO=0
103
}
104
105
package() {
106
depends+=(
107
glibc
108
sh
109
util-linux-libs
110
)
111
112
# systemd integration
113
install -vDm 644 tmpfiles.conf "${pkgdir}/usr/lib/tmpfiles.d/xnethack.conf"
114
115
cd "$_srcdir"
116
117
# ensure required directories are created
118
install -dm755 "$pkgdir"/usr/share/{man/man6,doc/xnethack}
119
install -dm775 "$pkgdir"/var/games/xnethack
120
install -dm775 "$pkgdir"/etc/xnethack
121
122
local makeflags=(
123
PREFIX="$pkgdir"
124
MANDIR="$pkgdir/usr/share/man/man6"
125
VARDIR="$pkgdir/var/games/xnethack"
126
HACKDIR="$pkgdir/usr/lib/xnethack"
127
WANT_WIN_TTY=1
128
WANT_WIN_CURSES=1
129
GIT=0
130
GITINFO=0
131
-j1 # Multi-threaded builds fail.
132
)
133
134
make "${makeflags[@]}" install manpages
135
136
# Remove man pages shipped by NetHack to deconflict.
137
for page in dlb makedefs recover; do
138
rm "$pkgdir/usr/share/man/man6/$page.6"
139
done
140
141
mv "$pkgdir/usr/lib/xnethack/"{nhdat,symbols} "$pkgdir/var/games/xnethack"
142
mv "$pkgdir/usr/lib/xnethack/sysconf" "$pkgdir/etc/xnethack"
143
144
# HACK/HACKDIR manipulation
145
# shellcheck disable=SC2016
146
sed -e "s|HACKDIR=$pkgdir/usr/lib/xnethack|HACKDIR=/var/games/xnethack/|" \
147
-e 's|HACK=$HACKDIR|HACK=/usr/lib/xnethack|' \
148
-i "$pkgdir"/usr/bin/xnethack
149
150
# documentation
151
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" doc/Guidebook.txt
152
153
# license
154
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" dat/license
155
156
cd "$pkgdir/var/games/xnethack/"
157
chmod o+w logfile perm record
158
}
159
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-09-26 21:15:27 | Low | 1 |