Added
Link Here
|
1 |
--- sys/unix/Makefile.top.orig 2021-03-22 22:28:14 UTC |
2 |
+++ sys/unix/Makefile.top |
3 |
@@ -20,18 +20,18 @@ NHSROOT=. |
4 |
|
5 |
# make NetHack |
6 |
#PREFIX = /usr |
7 |
-GAME = xnethack |
8 |
+GAME = xnethack%%HACKEXT%% |
9 |
# GAME = nethack.prg |
10 |
#GAMEUID = games |
11 |
-#GAMEGRP = bin |
12 |
+GAMEGRP = games |
13 |
|
14 |
# Permissions - some places use setgid instead of setuid, for instance |
15 |
# See also the option "SECURE" in include/config.h |
16 |
-#GAMEPERM = 04755 |
17 |
-FILEPERM = 0644 |
18 |
+GAMEPERM = 02755 |
19 |
+FILEPERM = 0664 |
20 |
# VARFILEPERM = 0644 |
21 |
EXEPERM = 0755 |
22 |
-DIRPERM = 0755 |
23 |
+DIRPERM = 0775 |
24 |
# VARDIRPERM = 0755 |
25 |
|
26 |
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR |
27 |
@@ -41,14 +41,15 @@ DIRPERM = 0755 |
28 |
# therefore there should not be anything in HACKDIR that you want to keep |
29 |
# (if there is, you'll have to do the installation by hand or modify the |
30 |
# instructions) |
31 |
-#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir |
32 |
-#VARDIR = $(HACKDIR) |
33 |
+HACKDIR = %%HACKDIR%% |
34 |
+VARDIR = $(HACKDIR) |
35 |
+INSTDIR = $(HACKDIR) |
36 |
# Where nethack.sh in installed. If this is not defined, the wrapper is not used. |
37 |
-#SHELLDIR = $(PREFIX)/games |
38 |
+SHELLDIR = ${PREFIX}/bin |
39 |
|
40 |
# per discussion in Install.X11 and Install.Qt |
41 |
#VARDATND = |
42 |
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm |
43 |
-# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm |
44 |
+VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm |
45 |
# for Atari/Gem |
46 |
# VARDATND = nh16.img title.img GEM_RSC.RSC rip.img |
47 |
@@ -75,7 +76,7 @@ VARDAT = $(VARDATD) $(VARDATND) |
48 |
#CHGRP = chgrp |
49 |
|
50 |
# Lua version |
51 |
-LUA_VERSION = 5.4.2 |
52 |
+LUA_VERSION = ${LUA_VER} |
53 |
|
54 |
# |
55 |
# end of configuration |
56 |
@@ -108,7 +109,7 @@ all: $(ALLDEP) |
57 |
$(GAME): lua_support |
58 |
( cd src ; $(MAKE) $(GAME) ) |
59 |
|
60 |
-lua_support: $(TOPLUALIB) include/nhlua.h |
61 |
+lua_support: include/nhlua.h |
62 |
@true |
63 |
lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h |
64 |
( cd lib/lua-$(LUA_VERSION)/src \ |
65 |
@@ -116,13 +117,11 @@ lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VER |
66 |
lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a |
67 |
@( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi ) |
68 |
cp lib/lua-$(LUA_VERSION)/src/liblua.a $@ |
69 |
-include/nhlua.h: $(TOPLUALIB) |
70 |
+include/nhlua.h: |
71 |
echo '/* nhlua.h - generated by top Makefile */' > $@ |
72 |
- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@ |
73 |
- @sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \ |
74 |
- < lib/lua-$(LUA_VERSION)/src/lua.h >> $@ |
75 |
- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@ |
76 |
- @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ |
77 |
+ @echo '#include <lua.h>' >> $@ |
78 |
+ @echo '#include <lualib.h>' >> $@ |
79 |
+ @echo '#include <lauxlib.h>' >> $@ |
80 |
@echo '/*nhlua.h*/' >> $@ |
81 |
|
82 |
# Note: many of the dependencies below are here to allow parallel make |
83 |
@@ -234,39 +233,22 @@ dofiles: |
84 |
-e '}' \ |
85 |
-e '$$s/.*/nodlb/p' < dat/options` ; \ |
86 |
$(MAKE) dofiles-$${target-nodlb} |
87 |
- cp src/$(GAME) $(INSTDIR) |
88 |
- cp util/recover $(INSTDIR) |
89 |
- -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi |
90 |
+ cp src/$(GAME) ${DESTDIR}$(INSTDIR)/$(GAME) |
91 |
+ cp util/recover ${DESTDIR}$(INSTDIR) |
92 |
+ -if test -n '${DESTDIR}$(SHELLDIR)'; then rm -f ${DESTDIR}$(SHELLDIR)/$(GAME); fi |
93 |
if test -n '$(SHELLDIR)'; then \ |
94 |
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \ |
95 |
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \ |
96 |
< sys/unix/nethack.sh \ |
97 |
- > $(SHELLDIR)/$(GAME) ; fi |
98 |
-# set up their permissions |
99 |
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \ |
100 |
- $(CHGRP) $(GAMEGRP) $(GAME) recover ) |
101 |
- chmod $(GAMEPERM) $(INSTDIR)/$(GAME) |
102 |
- chmod $(EXEPERM) $(INSTDIR)/recover |
103 |
- -if test -n '$(SHELLDIR)'; then \ |
104 |
- $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi |
105 |
- if test -n '$(SHELLDIR)'; then \ |
106 |
- $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \ |
107 |
- chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi |
108 |
+ > ${DESTDIR}$(SHELLDIR)/$(GAME) ; fi |
109 |
|
110 |
dofiles-dlb: check-dlb |
111 |
- ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) ) |
112 |
-# set up their permissions |
113 |
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \ |
114 |
- $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \ |
115 |
- chmod $(FILEPERM) nhdat $(DATNODLB) ) |
116 |
+ ( cd dat ; cp nhdat $(DATNODLB) ${DESTDIR}$(INSTDIR) ) |
117 |
|
118 |
dofiles-nodlb: |
119 |
# copy over the game files |
120 |
- ( cd dat ; cp $(DAT) $(INSTDIR) ) |
121 |
-# set up their permissions |
122 |
- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \ |
123 |
- $(CHGRP) $(GAMEGRP) $(DAT) ; \ |
124 |
- chmod $(FILEPERM) $(DAT) ) |
125 |
+ ( cd dat ; cp $(DAT) ${DESTDIR}$(INSTDIR) ) |
126 |
+ |
127 |
# |
128 |
# This is not part of the dependency build hierarchy. |
129 |
# It requires an explicit "make fetch-Lua". |
130 |
@@ -283,13 +265,9 @@ fetch-Lua: |
131 |
update: $(GAME) recover $(VARDAT) spec_levs |
132 |
# (don't yank the old version out from under people who're playing it) |
133 |
-mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old |
134 |
- -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old |
135 |
+ -mv ${DESTDIR}$(INSTDIR)/nhdat ${DESTDIR}$(INSTDIR)/nhdat.old |
136 |
# set up new versions of the game files |
137 |
( $(MAKE) dofiles ) |
138 |
-# touch time-sensitive files |
139 |
- -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard* |
140 |
- -touch -c $(VARDIR)/save/* $(VARDIR)/whereis/* |
141 |
- touch $(VARDIR)/perm $(VARDIR)/record |
142 |
# and a reminder |
143 |
@echo You may also want to install the man pages via the doc Makefile. |
144 |
|
145 |
@@ -300,25 +278,16 @@ install: rootcheck $(GAME) recover $(VARDAT) spec_levs |
146 |
true; $(PREINSTALL) |
147 |
# set up the directories |
148 |
# not all mkdirs have -p; those that don't will create a -p directory |
149 |
- -if test -n '$(SHELLDIR)'; then \ |
150 |
- mkdir -p $(SHELLDIR); fi |
151 |
- rm -rf $(INSTDIR) $(VARDIR) |
152 |
- -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis |
153 |
+ -if test -n '${DESTDIR}$(SHELLDIR)'; then \ |
154 |
+ mkdir -p ${DESTDIR}$(SHELLDIR); fi |
155 |
+ rm -rf ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR) |
156 |
+ -mkdir -p ${DESTDIR}$(INSTDIR) ${DESTDIR}$(VARDIR) ${DESTDIR}$(VARDIR)/save ${DESTDIR}$(VARDIR)/whereis |
157 |
if test -d ./-p; then rmdir ./-p; fi |
158 |
- -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis |
159 |
- $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis |
160 |
# order counts here: |
161 |
- chmod $(DIRPERM) $(INSTDIR) |
162 |
- chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save $(VARDIR)/whereis |
163 |
# set up the game files |
164 |
( $(MAKE) dofiles ) |
165 |
# set up some additional files |
166 |
- touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile \ |
167 |
- $(VARDIR)/xlogfile $(VARDIR)/livelog |
168 |
- -( cd $(VARDIR) ; \ |
169 |
- $(CHOWN) $(GAMEUID) perm record logfile xlogfile livelog ; \ |
170 |
- $(CHGRP) $(GAMEGRP) perm record logfile xlogfile livelog ; \ |
171 |
- chmod $(VARFILEPERM) perm record logfile xlogfile livelog ) |
172 |
+ touch ${DESTDIR}$(VARDIR)/perm ${DESTDIR}$(VARDIR)/record ${DESTDIR}$(VARDIR)/logfile ${DESTDIR}$(VARDIR)/xlogfile |
173 |
true; $(POSTINSTALL) |
174 |
# and a reminder |
175 |
@echo You may also want to reinstall the man pages via the doc Makefile. |