summaryrefslogtreecommitdiff
path: root/games/xnethack/files/patch-sys-unix-Makefile.top
diff options
context:
space:
mode:
Diffstat (limited to 'games/xnethack/files/patch-sys-unix-Makefile.top')
-rw-r--r--games/xnethack/files/patch-sys-unix-Makefile.top175
1 files changed, 175 insertions, 0 deletions
diff --git a/games/xnethack/files/patch-sys-unix-Makefile.top b/games/xnethack/files/patch-sys-unix-Makefile.top
new file mode 100644
index 000000000000..44a4ffef3d57
--- /dev/null
+++ b/games/xnethack/files/patch-sys-unix-Makefile.top
@@ -0,0 +1,175 @@
+--- sys/unix/Makefile.top.orig 2021-03-22 22:28:14 UTC
++++ sys/unix/Makefile.top
+@@ -20,18 +20,18 @@ NHSROOT=.
+
+ # make NetHack
+ #PREFIX = /usr
+-GAME = xnethack
++GAME = xnethack%%HACKEXT%%
+ # 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
+-FILEPERM = 0644
++GAMEPERM = 02755
++FILEPERM = 0664
+ # VARFILEPERM = 0644
+ EXEPERM = 0755
+-DIRPERM = 0755
++DIRPERM = 0775
+ # VARDIRPERM = 0755
+
+ # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
+@@ -41,14 +41,15 @@ DIRPERM = 0755
+ # therefore there should not be anything in HACKDIR that you want to keep
+ # (if there is, you'll have to do the installation by hand or modify the
+ # instructions)
+-#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
+-#VARDIR = $(HACKDIR)
++HACKDIR = %%HACKDIR%%
++VARDIR = $(HACKDIR)
++INSTDIR = $(HACKDIR)
+ # Where nethack.sh in installed. If this is not defined, the wrapper is not used.
+-#SHELLDIR = $(PREFIX)/games
++SHELLDIR = ${PREFIX}/bin
+
+ # per discussion in Install.X11 and Install.Qt
+ #VARDATND =
+ # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
+-# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
++VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
+ # for Atari/Gem
+ # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
+@@ -75,7 +76,7 @@ VARDAT = $(VARDATD) $(VARDATND)
+ #CHGRP = chgrp
+
+ # Lua version
+-LUA_VERSION = 5.4.2
++LUA_VERSION = ${LUA_VER}
+
+ #
+ # end of configuration
+@@ -108,7 +109,7 @@ all: $(ALLDEP)
+ $(GAME): lua_support
+ ( cd src ; $(MAKE) $(GAME) )
+
+-lua_support: $(TOPLUALIB) include/nhlua.h
++lua_support: include/nhlua.h
+ @true
+ lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h
+ ( cd lib/lua-$(LUA_VERSION)/src \
+@@ -116,13 +117,11 @@ lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VER
+ lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
+ @( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi )
+ cp lib/lua-$(LUA_VERSION)/src/liblua.a $@
+-include/nhlua.h: $(TOPLUALIB)
++include/nhlua.h:
+ echo '/* nhlua.h - generated by top Makefile */' > $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@
+- @sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \
+- < lib/lua-$(LUA_VERSION)/src/lua.h >> $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@
+- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@
++ @echo '#include <lua.h>' >> $@
++ @echo '#include <lualib.h>' >> $@
++ @echo '#include <lauxlib.h>' >> $@
+ @echo '/*nhlua.h*/' >> $@
+
+ # Note: many of the dependencies below are here to allow parallel make
+@@ -234,39 +233,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
++ 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 '$(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".
+@@ -283,13 +265,9 @@ fetch-Lua:
+ update: $(GAME) recover $(VARDAT) spec_levs
+ # (don't yank the old version out from under people who're playing it)
+ -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
+- -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
++ -mv ${DESTDIR}$(INSTDIR)/nhdat ${DESTDIR}$(INSTDIR)/nhdat.old
+ # set up new versions of the game files
+ ( $(MAKE) dofiles )
+-# touch time-sensitive files
+- -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
+- -touch -c $(VARDIR)/save/* $(VARDIR)/whereis/*
+- touch $(VARDIR)/perm $(VARDIR)/record
+ # and a reminder
+ @echo You may also want to install the man pages via the doc Makefile.
+
+@@ -300,25 +278,16 @@ install: rootcheck $(GAME) recover $(VARDAT) spec_levs
+ 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) ${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
+ true; $(POSTINSTALL)
+ # and a reminder
+ @echo You may also want to reinstall the man pages via the doc Makefile.