Package-Name: nethack
Requires: ncurses|ncurses4
Rebuild-For: XFree86 Xorg
Compile-Requires: flex bison
Homepage: http://www.nethack.org/
Source: sourceforge:///nethack/nethack-(\d)(\d)(\d)(-src)?.tgz $1.$2.$3
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
	test -d nethack-"$(VERSION)" || mv nethack* nethack-"$(VERSION)"
Compile:
	mv -f README "$(PREFIX)/"
	sh sys/unix/setup.sh
	umask 022 ; mkdir -p "$(PREFIX)"/man/man6
	if packager c XFree86 || packager c Xorg ; then \
		X11_GRAPHICS=-DX11_GRAPHICS ; \
		WINSRC=WINSRC='$$(WINTTYSRC) $$(WINX11SRC)' ; \
		WINOBJ=WINOBJ='$$(WINTTYOBJ) $$(WINX11OBJ)' ; \
		WINLIB=WINLIB='$$(WINTTYLIB) $$(WINX11LIB)' ; \
	else \
		X11_GRAPHICS= ; \
		WINSRC= ; \
		WINOBJ= ; \
		WINLIB= ; \
	fi ; \
	set -x ; \
	$(MAKE) all install manpages \
		CFLAGS='-O2 -I../include -I/usr/include/ncurses -DHACKDIR=\""$(PREFIX)"/lib\" -DVAR_PLAYGROUND=\""$(PREFIX)"/var\" -DWIZARD=\"achurch\" '$$X11_GRAPHICS PREFIX="$(PREFIX)" \
		LFLAGS='-L/usr/X11/lib' \
		WINTTYLIB=-lncurses \
		"$$WINSRC" \
		"$$WINOBJ" \
		"$$WINLIB" \
		YACC="bison -y" \
		LEX=flex \
		GAMEUID=root \
		GAMEGRP=root \
		GAMEPERM=0755 \
		FILEPERM=0644 \
		EXEPERM=0755 \
		DIRPERM=0755 \
		GAMEDIR="$(PREFIX)/lib" \
		VARDIR="$(PREFIX)/var" \
		SHELLDIR="$(PREFIX)" \
		MANDIR="$(PREFIX)/man/man6"
	$(MAKE) -C util recover
	umask 022 ; mkdir -p "$(PREFIX)"/bin
	mv -f "$(PREFIX)"/nethack "$(PREFIX)"/bin/
	mv -f util/recover "$(PREFIX)"/bin/nhrecover
	mv -f "$(PREFIX)"/man/man6/recover.6 "$(PREFIX)"/man/man6/nhrecover.6
Install:
	$(MAKE) instbin BIN="nethack nhrecover"
	$(MAKE) instman SECTION=6 MAN="nethack nhrecover"
	umask 022 ; mkdir -p /var/lib/nethack
	touch /var/lib/nethack/{logfile,perm,record}
	mkdir -p /var/lib/nethack/save
	chmod 666 /var/lib/nethack/{logfile,perm,record}
	chmod 1777 /var/lib/nethack/save
	rm -rf "$(PREFIX)"/var
	ln -s /var/lib/nethack "$(PREFIX)"/var
Patch: <<EOT
######## begin patch to fix errors with flex-2.5.34
--- ../nethack-3.4.3-orig/util/lev_comp.l	2003-12-08 08:39:13 +0900
+++ util/lev_comp.l	2007-12-15 01:38:38 +0900
@@ -75,9 +75,9 @@
 static int map_cnt = 0;
 
 %}
-%e 1500
+/*%e 1500
 %p 5000
-%n 700
+%n 700*/
 %s MAPC
 %%
 <MAPC>ENDMAP	{
######## end patch to fix errors with flex-2.5.34
######## remainder is local changes
diff -urN ../nethack-3.4.1-orig/include/config.h ./include/config.h
--- ../nethack-3.4.1-orig/include/config.h	2003-02-23 23:43:19 +0900
+++ include/config.h	2003-04-12 22:22:30 +0900
@@ -141,16 +141,16 @@
 
 #ifndef WIZARD		/* allow for compile-time or Makefile changes */
 # ifndef KR1ED
-#  define WIZARD  "wizard" /* the person allowed to use the -D option */
+#  define WIZARD  "achurch" /* the person allowed to use the -D option */
 # else
 #  define WIZARD
-#  define WIZARD_NAME "wizard"
+#  define WIZARD_NAME "achurch"
 # endif
 #endif
 
-#define LOGFILE "logfile"	/* larger file for debugging purposes */
-#define NEWS "news"		/* the file containing the latest hack news */
-#define PANICLOG "paniclog"	/* log of panic and impossible events */
+//#define LOGFILE "logfile"	/* larger file for debugging purposes */
+//#define NEWS "news"		/* the file containing the latest hack news */
+//#define PANICLOG "paniclog"	/* log of panic and impossible events */
 
 /*
  *	If COMPRESS is defined, it should contain the full path name of your
@@ -167,11 +167,11 @@
 
 #ifdef UNIX
 /* path and file name extension for compression program */
-#define COMPRESS "/usr/bin/compress"	/* Lempel-Ziv compression */
-#define COMPRESS_EXTENSION ".Z"		/* compress's extension */
+//#define COMPRESS "/usr/bin/compress"	/* Lempel-Ziv compression */
+//#define COMPRESS_EXTENSION ".Z"	/* compress's extension */
 /* An example of one alternative you might want to use: */
-/* #define COMPRESS "/usr/local/bin/gzip" */	/* FSF gzip compression */
-/* #define COMPRESS_EXTENSION ".gz" */		/* normal gzip extension */
+#define COMPRESS "/usr/bin/gzip"		/* FSF gzip compression */
+#define COMPRESS_EXTENSION ".gz"	/* normal gzip extension */
 #endif
 
 #ifndef COMPRESS
@@ -302,7 +302,7 @@
  * functions that have been macroized.
  */
 
-/* #define VISION_TABLES */ /* use vision tables generated at compile time */
+#define VISION_TABLES /* use vision tables generated at compile time */
 #ifndef VISION_TABLES
 # ifndef NO_MACRO_CPATH
 #  define MACRO_CPATH	/* use clear_path macros instead of functions */
diff -urN ../nethack-3.4.1-orig/include/config.h.rej ./include/config.h.rej
--- ../nethack-3.4.1-orig/include/config.h.rej	1970-01-01 09:00:00 +0900
+++ include/config.h.rej	2003-04-12 22:23:40 +0900
@@ -0,0 +1,77 @@
+***************
+*** 141,156 ****
+  
+  #ifndef WIZARD		/* allow for compile-time or Makefile changes */
+  # ifndef KR1ED
+- #  define WIZARD  "wizard" /* the person allowed to use the -D option */
+  # else
+  #  define WIZARD
+- #  define WIZARD_NAME "wizard"
+  # endif
+  #endif
+  
+- #define LOGFILE "logfile"	/* larger file for debugging purposes */
+- #define NEWS "news"		/* the file containing the latest hack news */
+- #define PANICLOG "paniclog"	/* log of panic and impossible events */
+  
+  /*
+   *	If COMPRESS is defined, it should contain the full path name of your
+--- 141,156 ----
+  
+  #ifndef WIZARD		/* allow for compile-time or Makefile changes */
+  # ifndef KR1ED
++ #  define WIZARD  "achurch" /* the person allowed to use the -D option */
+  # else
+  #  define WIZARD
++ #  define WIZARD_NAME "achurch"
+  # endif
+  #endif
+  
++ //#define LOGFILE "logfile"	/* larger file for debugging purposes */
++ //#define NEWS "news"		/* the file containing the latest hack news */
++ //#define PANICLOG "paniclog"	/* log of panic and impossible events */
+  
+  /*
+   *	If COMPRESS is defined, it should contain the full path name of your
+***************
+*** 167,177 ****
+  
+  #ifdef UNIX
+  /* path and file name extension for compression program */
+- #define COMPRESS "/usr/bin/compress"	/* Lempel-Ziv compression */
+- #define COMPRESS_EXTENSION ".Z"		/* compress's extension */
+  /* An example of one alternative you might want to use: */
+- /* #define COMPRESS "/usr/local/bin/gzip" */	/* FSF gzip compression */
+- /* #define COMPRESS_EXTENSION ".gz" */		/* normal gzip extension */
+  #endif
+  
+  #ifndef COMPRESS
+--- 167,177 ----
+  
+  #ifdef UNIX
+  /* path and file name extension for compression program */
++ //#define COMPRESS "/usr/bin/compress"	/* Lempel-Ziv compression */
++ //#define COMPRESS_EXTENSION ".Z"	/* compress's extension */
+  /* An example of one alternative you might want to use: */
++ #define COMPRESS "gzip"			/* FSF gzip compression */
++ #define COMPRESS_EXTENSION ".gz"	/* normal gzip extension */
+  #endif
+  
+  #ifndef COMPRESS
+***************
+*** 302,308 ****
+   * functions that have been macroized.
+   */
+  
+- /* #define VISION_TABLES */ /* use vision tables generated at compile time */
+  #ifndef VISION_TABLES
+  # ifndef NO_MACRO_CPATH
+  #  define MACRO_CPATH	/* use clear_path macros instead of functions */
+--- 302,308 ----
+   * functions that have been macroized.
+   */
+  
++ #define VISION_TABLES /* use vision tables generated at compile time */
+  #ifndef VISION_TABLES
+  # ifndef NO_MACRO_CPATH
+  #  define MACRO_CPATH	/* use clear_path macros instead of functions */
diff -urN ../nethack-3.4.1-orig/include/unixconf.h ./include/unixconf.h
--- ../nethack-3.4.1-orig/include/unixconf.h	2003-02-23 23:43:23 +0900
+++ include/unixconf.h	2003-04-12 22:23:40 +0900
@@ -32,12 +32,12 @@
 
 
 /* define any of the following that are appropriate */
-#define SVR4		/* use in addition to SYSV for System V Release 4 */
+/* #define SVR4 */	/* use in addition to SYSV for System V Release 4 */
 			/* including Solaris 2+ */
-#define NETWORK		/* if running on a networked system */
+/* #define NETWORK	/* if running on a networked system */
 			/* e.g. Suns sharing a playground through NFS */
 /* #define SUNOS4 */	/* SunOS 4.x */
-/* #define LINUX */	/* Another Unix clone */
+#define LINUX		/* Another Unix clone */
 /* #define CYGWIN32 */	/* Unix on Win32 -- use with case sensitive defines */
 /* #define GENIX */	/* Yet Another Unix Clone */
 /* #define HISX */	/* Bull Unix for XPS Machines */
@@ -132,7 +132,7 @@
  * "extra output" method is used, but not all systems provide access to
  * a fine-grained timer.
  */
-/* #define TIMED_DELAY */	/* usleep() */
+#define TIMED_DELAY		/* usleep() */
 #endif
 
 /*
@@ -166,6 +166,7 @@
 
 /* #define NO_MAILREADER */	/* have mail daemon just tell player of mail */
 
+#if 0
 #ifdef	MAIL
 # if defined(BSD) || defined(ULTRIX)
 #  ifdef AMS
@@ -188,6 +189,8 @@
 #define DEF_MAILREADER	"/bin/mail"
 # endif
 #endif
+#endif
+#define DEF_MAILREADER "/usr/local/bin/mmail"
 
 #define MAILCKFREQ	50
 #endif	/* MAIL */
diff -urN ../nethack-3.4.1-orig/src/files.c ./src/files.c
--- ../nethack-3.4.1-orig/src/files.c	2003-02-23 23:43:26 +0900
+++ src/files.c	2003-04-12 22:23:40 +0900
@@ -1134,6 +1134,7 @@
 			redirect(cfn, RDBMODE, stdin, uncomp);
 			redirect(filename, WRBMODE, stdout, uncomp);
 		} else {
+			chmod(filename, FCMASK);
 			redirect(filename, RDBMODE, stdin, uncomp);
 			redirect(cfn, WRBMODE, stdout, uncomp);
 		}
EOT

/pkg/nethack/
/usr/bin/nethack
/usr/bin/nhrecover
/usr/man/man6/nethack.6.gz
/usr/man/man6/nhrecover.6.gz
/var/lib/nethack/
