$FreeBSD: ports/games/nethack33/files/patch-ae,v 1.5 2004/04/20 14:24:28 glewis Exp $

--- sys/unix/Makefile.top.orig	Mon Jul  3 18:42:05 2000
+++ sys/unix/Makefile.top	Mon Apr 19 14:42:45 2004
@@ -14,18 +14,17 @@
 # MAKE = make
 
 # make NetHack
-PREFIX	 = /usr
-GAME     = nethack
+GAME     = %%HACKNAME%%
 # 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
 EXEPERM  = 0755
-DIRPERM  = 0755
+DIRPERM  = 0775
 
 # GAMEDIR also appears in config.h as "HACKDIR".
 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else GAMEDIR
@@ -35,12 +34,12 @@
 # therefore there should not be anything in GAMEDIR that you want to keep
 # (if there is, you'll have to do the installation by hand or modify the
 # instructions)
-GAMEDIR  = $(PREFIX)/games/lib/$(GAME)dir
+GAMEDIR  = %%HACKDIR%%
 VARDIR  = $(GAMEDIR)
-SHELLDIR = $(PREFIX)/games
+SHELLDIR = $(PREFIX)/bin
 
 # per discussion in Install.X11 and Install.Qt
-VARDATND = 
+# VARDATND = 
 # VARDATND = x11tiles pet_mark.xbm
 # VARDATND = x11tiles pet_mark.xbm rip.xpm
 # for Atari/Gem
@@ -48,7 +47,7 @@
 # for BeOS
 # VARDATND = beostiles
 # for Gnome
-# VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm
+VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm
 
 VARDATD = data oracles options quest.dat rumors
 VARDAT = $(VARDATD) $(VARDATND)
@@ -87,7 +86,7 @@
 $(GAME):
 	( cd src ; $(MAKE) )
 
-all:	$(GAME) Guidebook $(VARDAT) dungeon spec_levs check-dlb
+all:	$(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
 	@echo "Done."
 
 Guidebook:
@@ -156,6 +155,8 @@
 	( cd util ; $(MAKE) dlb )
 	( cd dat ; ../util/dlb cf nhdat $(DATDLB) )
 
+recover:
+	( cd util ; $(MAKE) recover )
 
 dofiles:
 	target=`sed -n					\
@@ -165,16 +166,18 @@
 		-e '}' 					\
 	  	-e '$$s/.*/nodlb/p' < dat/options` ;	\
 	$(MAKE) dofiles-$${target-nodlb}
-	cp src/$(GAME) $(GAMEDIR)
+	cp src/nethack $(GAMEDIR)/$(GAME)
+	cp util/recover $(GAMEDIR)
 	-rm -f $(SHELLDIR)/$(GAME)
 	sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
 		-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
 		< sys/unix/nethack.sh \
 		> $(SHELLDIR)/$(GAME)
 # set up their permissions
-	-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) ; \
-			$(CHGRP) $(GAMEGRP) $(GAME) )
+	-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
+			$(CHGRP) $(GAMEGRP) $(GAME) recover )
 	chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
+	chmod $(GAMEPERM) $(GAMEDIR)/recover
 	-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
 	$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
 	chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
@@ -194,7 +197,7 @@
 			$(CHGRP) $(GAMEGRP) $(DAT) ; \
 			chmod $(FILEPERM) $(DAT) )
 
-update: $(GAME) $(VARDAT) dungeon spec_levs
+update: $(GAME) recover $(VARDAT) dungeon spec_levs
 #	(don't yank the old version out from under people who're playing it)
 	-mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
 #	quest.dat is also kept open and has the same problems over NFS
@@ -210,11 +213,12 @@
 # and a reminder
 	@echo You may also want to install the man pages via the doc Makefile.
 
-install: $(GAME) $(VARDAT) dungeon spec_levs
+install: $(GAME) recover $(VARDAT) dungeon spec_levs
 # set up the directories
 # not all mkdirs have -p; those that don't will create a -p directory
 	-mkdir -p $(SHELLDIR)
-	-rm -rf $(GAMEDIR) $(VARDIR)
+	-rmdir $(GAMEDIR)
+	-rmdir $(VARDIR)
 	-mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save
 	-rmdir ./-p
 	-$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
