nethack: fix SYSCF_FILE, misc. improvements

- fix xlint
- move *-devel depends to makedepends
- stop overriding CFLAGS in template, patch sys/unix/hints/linux instead
- in particular, stop overriding the SECURE macro defined in hints to
  prevent unauthorized writes as :nethack. rely on build-time HACKDIR
  definition to make /var/games/nethack/ the default playground.
- remove post_extract() since this is already done in hints
- move /usr/lib/nethack/sysconf (SYSCF_FILE) to /etc/nethack/sysconf,
  add it conf_files. fix SYSCF_FILE permissions.
This commit is contained in:
Artem Zhurikhin 2020-12-08 20:45:29 +03:00 committed by Érico Nogueira Rolim
parent 068c64c844
commit 7896369725
3 changed files with 27 additions and 13 deletions

View File

@ -2,6 +2,7 @@ case "${ACTION}" in
post) post)
chown nethack:nethack usr/lib/nethack/nethack chown nethack:nethack usr/lib/nethack/nethack
chmod 02755 usr/lib/nethack/nethack chmod 02755 usr/lib/nethack/nethack
chmod 0644 etc/nethack/sysconf
touch var/games/nethack/logfile var/games/nethack/perm var/games/nethack/record var/games/nethack/xlogfile touch var/games/nethack/logfile var/games/nethack/perm var/games/nethack/record var/games/nethack/xlogfile
chown nethack:nethack var/games/nethack var/games/nethack/* chown nethack:nethack var/games/nethack var/games/nethack/*
chmod 0775 var/games/nethack chmod 0775 var/games/nethack

View File

@ -0,0 +1,16 @@
We move /usr/lib/nethack/sysconf to /etc/nethack/sysconf since
this file is intended to be editable by root.
diff --git sys/unix/hints/linux sys/unix/hints/linux
index 8629150..9a4d722 100644
--- sys/unix/hints/linux
+++ sys/unix/hints/linux
@@ -23,7 +23,7 @@ POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INS
CFLAGS=-g -O -I../include -DNOTPARMDECL
CFLAGS+=-DDLB
CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
-CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
+CFLAGS+=-DSYSCF -DSYSCF_FILE=\"/etc/nethack/sysconf\" -DSECURE
CFLAGS+=-DTIMED_DELAY
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
CFLAGS+=-DDUMPLOG

View File

@ -1,9 +1,12 @@
# Template file for 'nethack' # Template file for 'nethack'
pkgname=nethack pkgname=nethack
version=3.6.6 version=3.6.6
revision=1 revision=2
wrksrc="NetHack-NetHack-${version}_Released"
conf_files="/etc/nethack/sysconf"
make_dirs="/var/games/nethack/save 0775 nethack nethack" make_dirs="/var/games/nethack/save 0775 nethack nethack"
hostmakedepends="ncurses-devel flex" hostmakedepends="flex"
makedepends="ncurses-devel ncurses-libtinfo-devel"
depends="gzip" depends="gzip"
short_desc="Exploring The Mazes of Menace" short_desc="Exploring The Mazes of Menace"
maintainer="Leah Neukirchen <leah@vuxu.org>" maintainer="Leah Neukirchen <leah@vuxu.org>"
@ -13,12 +16,6 @@ distfiles="https://www.nethack.org/download/${version}/nethack-${version//./}-sr
checksum=cfde0c3ab6dd7c22ae82e1e5a59ab80152304eb23fb06e3129439271e5643ed2 checksum=cfde0c3ab6dd7c22ae82e1e5a59ab80152304eb23fb06e3129439271e5643ed2
nocross=yes nocross=yes
system_accounts="$pkgname" system_accounts="$pkgname"
wrksrc="NetHack-NetHack-${version}_Released"
post_extract() {
sed -i -e '/COMPRESS/s/compress/gzip/g' \
-e '/COMPRESS_EXTENSION/s/\.Z/.gz/g' include/config.h
}
do_configure() { do_configure() {
sh sys/unix/setup.sh sys/unix/hints/linux sh sys/unix/setup.sh sys/unix/hints/linux
@ -26,16 +23,15 @@ do_configure() {
do_build() { do_build() {
make all dungeon \ make all dungeon \
CC="$CC" LINK="$CC" LFLAGS="$LDFLAGS" \ CC="$CC" LINK="$CC" LFLAGS="$LDFLAGS" LEX=flex \
LEX=flex WINTTYLIB=-lncurses \ HACKDIR="/var/games/nethack"
CFLAGS="$CFLAGS -DLINUX -DTIMED_DELAY -DDLB \
-DSYSCF -DSYSCF_FILE='\"/usr/lib/nethack\"' \
-DHACKDIR='\"/var/games/nethack\"' -I../include"
} }
do_install() { do_install() {
vmkdir usr/share/man/man6 vmkdir usr/share/man/man6
vmkdir var/games vmkdir var/games
vmkdir etc/nethack
make install manpages \ make install manpages \
PREFIX=$DESTDIR \ PREFIX=$DESTDIR \
SHELLDIR=$DESTDIR/usr/bin \ SHELLDIR=$DESTDIR/usr/bin \
@ -51,6 +47,7 @@ do_install() {
mv $DESTDIR/usr/lib/nethack/nhdat $DESTDIR/var/games/nethack mv $DESTDIR/usr/lib/nethack/nhdat $DESTDIR/var/games/nethack
mv $DESTDIR/usr/lib/nethack/symbols $DESTDIR/var/games/nethack mv $DESTDIR/usr/lib/nethack/symbols $DESTDIR/var/games/nethack
mv $DESTDIR/usr/lib/nethack/sysconf $DESTDIR/etc/nethack
rm $DESTDIR/var/games/nethack/{logfile,perm,record,xlogfile} rm $DESTDIR/var/games/nethack/{logfile,perm,record,xlogfile}
sed -i -e 's,^HACKDIR=.*,HACKDIR=/var/games/nethack,' \ sed -i -e 's,^HACKDIR=.*,HACKDIR=/var/games/nethack,' \