ports/games/xnethack/files/patch-sys-unix-Makefile.top

144 lines
5.5 KiB
Plaintext

--- sys/unix/Makefile.top.orig 2025-03-15 15:02:36 UTC
+++ sys/unix/Makefile.top
@@ -25,15 +25,15 @@ GAME = xnethack
GAME = xnethack
# GAME = nethack.prg
#GAMEUID = games
-#GAMEGRP = bin
+GAMEGRP = games
# Permissions - some places use setgid instead of setuid, for instance.
# See also the option "SECURE" in include/config.h.
-#GAMEPERM = 04755
+GAMEPERM = 02755
FILEPERM = 0644
# VARFILEPERM = 0644
EXEPERM = 0755
-DIRPERM = 0755
+DIRPERM = 0775
# VARDIRPERM = 0755
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
@@ -44,10 +44,12 @@ DIRPERM = 0755
# keep (if there is, you'll have to do the installation by hand or
# modify the install commands below).
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
-#VARDIR = $(HACKDIR)
+HACKDIR = %%HACKDIR%%
+INSTDIR = ${HACKDIR}
+VARDIR = $(HACKDIR)
# Where nethack.sh is installed (as 'nethack').
# If this is not defined, the shell wrapper script is not used.
-#SHELLDIR = $(PREFIX)/games
+SHELLDIR = $(PREFIX)/bin
# Extra data files depending upon the interface(s) built into nethack.
# per discussion in Install.X11 and Install.Qt
@@ -62,7 +64,7 @@ DIRPERM = 0755
# X11 with GRAPHIC_TOMBSTONE (requires 'xpm'):
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
# both X11 and Qt:
-# VARDATND = x11tiles nhtiles.bmp NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
+VARDATND = x11tiles nhtiles.bmp NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
# Qt without X11; assumes GRAPHIC_TOMBSTONE:
# VARDATND = nhtiles.bmp pet_mark.xbm pilemark.xbm rip.xpm
@@ -152,14 +154,11 @@ $(TOPLUALIB): $(LUATOP)/liblua.a
@( if test -d lib/lua ; then true ; else mkdir -p lib/lua ; fi )
cp $(LUATOP)/liblua.a $@
-include/nhlua.h: $(TOPLUALIB)
+include/nhlua.h:
echo '/* nhlua.h - generated by top Makefile */' > $@
- @echo '#include "../$(LUAHEADERS)/lua.h"' >> $@
- @sed -e '/(lua_error)/!d' \
- -e '/(lua_error)/s/LUA_API/ATTRNORETURN LUA_API/1' \
- -e '/(lua_error)/s/;/ NORETURN;/1' < $(LUAHEADERS)/lua.h >> $@
- @echo '#include "../$(LUAHEADERS)/lualib.h"' >> $@
- @echo '#include "../$(LUAHEADERS)/lauxlib.h"' >> $@
+ @echo '#include <lua.h>' >> $@
+ @echo '#include <lualib.h>' >> $@
+ @echo '#include <lauxlib.h>' >> $@
@echo '/*nhlua.h*/' >> $@
# LUATESTTARGET is this by default
lib/lua-$(LUA_VERSION)/src/lua.h:
@@ -304,39 +303,22 @@ dofiles:
-e '}' \
-e '$$s/.*/nodlb/p' < dat/options` ; \
$(MAKE) dofiles-$${target-nodlb}
- cp src/$(GAME) $(INSTDIR)
- cp util/recover $(INSTDIR)
- -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
- if test -n '$(SHELLDIR)'; then \
+ cp src/$(GAME) ${DESTDIR}$(INSTDIR)/$(GAME)
+ cp util/recover ${DESTDIR}$(INSTDIR)
+ -if test -n '${DESTDIR}$(SHELLDIR)'; then rm -f ${DESTDIR}$(SHELLDIR)/$(GAME); fi
+ if test -n '${DESTDIR}$(SHELLDIR)'; then \
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
< sys/unix/nethack.sh \
- > $(SHELLDIR)/$(GAME) ; fi
-# set up their permissions
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
- $(CHGRP) $(GAMEGRP) $(GAME) recover )
- chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
- chmod $(EXEPERM) $(INSTDIR)/recover
- -if test -n '$(SHELLDIR)'; then \
- $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
- if test -n '$(SHELLDIR)'; then \
- $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
- chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
+ > ${DESTDIR}$(SHELLDIR)/$(GAME) ; fi
dofiles-dlb: check-dlb
- ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
-# set up their permissions
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
- $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
- chmod $(FILEPERM) nhdat $(DATNODLB) )
+ ( cd dat ; cp nhdat $(DATNODLB) ${DESTDIR}$(INSTDIR) )
dofiles-nodlb:
# copy over the game files
- ( cd dat ; cp $(DAT) $(INSTDIR) )
-# set up their permissions
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
- $(CHGRP) $(GAMEGRP) $(DAT) ; \
- chmod $(FILEPERM) $(DAT) )
+ ( cd dat ; cp $(DAT) ${DESTDIR}$(INSTDIR) )
+
#
# This is not part of the dependency build hierarchy.
# It requires an explicit "make fetch-Lua".
@@ -447,24 +429,17 @@ install: rootcheck $(PRECHECK) $(GAME) recover $(VARDA
true; $(PREINSTALL)
# set up the directories
# not all mkdirs have -p; those that don't will create a -p directory
- -if test -n '$(SHELLDIR)'; then \
- mkdir -p $(SHELLDIR); fi
- rm -rf $(INSTDIR) $(VARDIR)
- -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
+ -if test -n '${DESTDIR}$(SHELLDIR)'; then \
+ mkdir -p ${DESTDIR}$(SHELLDIR); fi
+ rm -rf ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR)
+ -mkdir -p ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR)/save ${DESTDIR}$(VARDIR)/whereis
if test -d ./-p; then rmdir ./-p; fi
- -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
- $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
# order counts here:
- chmod $(DIRPERM) $(INSTDIR)
- chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis
# set up the game files
( $(MAKE) dofiles )
# set up some additional files
- touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile \
- $(VARDIR)/livelog
- -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile livelog ; \
- $(CHGRP) $(GAMEGRP) perm record logfile xlogfile livelog ; \
- chmod $(VARFILEPERM) perm record logfile xlogfile livelog )
+ touch ${DESTDIR}$(VARDIR)/perm ${DESTDIR}$(VARDIR)/record ${DESTDIR}$(VARDIR)/logfile ${DESTDIR}$(VARDIR)/xlogfile \
+ ${DESTDIR}$(VARDIR)/livelog
# sysconf
true; $(SYSCONFINSTALL)
# other steps from hints file