# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../nethack/nethack.conf
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
# 
# More information can be found in the files COPYING and README.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---

createpatch () {
	cd sys/unix/ ; sh setup.sh ; cd ../..
	xx=$builddir/config.patch
# Creating common patch
	cat >$xx<<-EEE
--- nethack-3.4.0/include/unixconf.h	Thu Mar 21 00:42:56 2002
+++ nethack-3.4.0_my/include/unixconf.h	Tue Oct 29 10:59:21 2002
@@ -36,7 +36,7 @@
 			* including Solaris 2+ */
 #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 */
	EEE

# Timed Delay
	if [ "$SDECFG_PKG_NETHACK_DEL" == "1" ] ; then
		cat >>$xx<<-EEE
@@ -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

 /*
		EEE
	fi
# Adding source files for UIs
	if [ "$SDECFG_PKG_NETHACK_TTY" == "0" ] ; then
		winsrc=""
		winobj=""
		winlib=""
	else
		winsrc='$(WINTTYSRC)'
		winobj='$(WINTTYOBJ)'
		winlib='$(WINTTYLIB)'
	fi
	if [ "$SDECFG_PKG_NETHACK_X11" == "1" ] ; then
		winsrc="$winsrc "'$(WINX11SRC)'
		winobj="$winobj "'$(WINX11OBJ)'
		winlib="$winlib "'$(WINX11LIB)'
	fi
	if [ "$SDECFG_PKG_NETHACK_QT" == "1" ] ; then
		winsrc="$winsrc "'$(WINQTSRC)'
		winobj="$winobj "'$(WINQTOBJ)'
		winlib="$winlib "'$(WINQTLIB)'
	fi
	if [ "$SDECFG_PKG_NETHACK_GNO" == "1" ] ; then
		winsrc="$winsrc "'$(WINGNOMESRC)'
		winobj="$winobj "'$(WINGNOMEOBJ)'
		winlib="$winlib "'$(WINGNOMELIB)'
	fi
	cat >>$xx<<-EEE
--- nethack-3.4.0/src/Makefile	Fri Nov  8 11:20:35 2002
+++ nethack-3.4.0_my/src/Makefile	Tue Oct 29 10:58:25 2002
@@ -207,2 +207,2 @@
-WINSRC = \$(WINTTYSRC)
-WINOBJ = \$(WINTTYOBJ)
+WINSRC = $winsrc
+WINOBJ = $winobj tile.o
	EEE

# more common things
	cat >>$xx<<-EEE
@@ -219,8 +219,8 @@
 # WINTTYLIB = -ltermcap
 # WINTTYLIB = -lcurses
 # WINTTYLIB = -lcurses16
-# WINTTYLIB = -lncurses
-WINTTYLIB = -ltermlib
+WINTTYLIB = -lncurses
+#WINTTYLIB = -ltermlib
 #
 # libraries for X11
 # If USE_XPM is defined in config.h, you will also need -lXpm here.
	EEE
# Use libXpm?
	if [ "$SDECFG_PKG_NETHACK_XPM" == "1" ] ; then
		cat >>$xx<<-EEE
@@ -225,5 +225,5 @@
 # libraries for X11
 # If USE_XPM is defined in config.h, you will also need -lXpm here.
-WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
+WINX11LIB = -L/usr/X11R6/lib -lXaw -lXmu -lXext -lXt -lX11 -lXpm
 # WINX11LIB = -lXaw -lXmu -lXt -lX11
 # WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
@@ -248,1 +248,1 @@
-WINLIB = \$(WINTTYLIB)
+WINLIB = $winlib
		EEE
	fi
# Tiles for Qt
	if [ "$SDECFG_PKG_NETHACK_QT" == "1" ] ; then
		cat >>$xx<<-EEE
--- ./Makefile	2003-06-08 13:13:32.000000000 +0200
+++ ./Makefile	2003-06-08 21:24:48.000000000 +0200
@@ -40,7 +40,7 @@ VARDIR  = \$(GAMEDIR)
 SHELLDIR = \$(PREFIX)/games
 
 # per discussion in Install.X11 and Install.Qt
-VARDATND = 
+VARDATND = x11tiles rip.xpm nhsplash.xpm pet_mark.xbm
 # VARDATND = x11tiles pet_mark.xbm
 # VARDATND = x11tiles pet_mark.xbm rip.xpm
 # for Atari/Gem
		EEE
	fi
	cat >>$xx<<-EEE
--- nethack-3.4.0/include/config.h	Fri Nov  8 11:20:35 2002
+++ nethack-3.4.0/include/config.h	Tue Oct 29 10:58:25 2002
	EEE
#more User Interfaces
	if [ "$SDECFG_PKG_NETHACK_TTY" == "0" -o	\
	     "$SDECFG_PKG_NETHACK_X11" == "1" -o	\
	     "$SDECFG_PKG_NETHACK_QT" == "1" -o	\
	     "$SDECFG_PKG_NETHACK_GNO" == "1" ] ; then
	     	cat >>$xx<<-EEE
@@ -43,7 +43,7 @@
  * Some combinations make no sense.  See the installation document.
  */
		EEE
		if [ "$SDECFG_PKG_NETHACK_TTY" == "0" ] ; then
			cat >>$xx<<-EEE
-#define TTY_GRAPHICS	/* good old tty based graphics */
+/* #define TTY_GRAPHICS */	/* good old tty based graphics */
			EEE
		else
			cat >>$xx<<-EEE
 #define TTY_GRAPHICS	/* good old tty based graphics */
			EEE
		fi
		if [ "$SDECFG_PKG_NETHACK_X11" == "1" ] ; then
			cat >>$xx<<-EEE
-/* #define X11_GRAPHICS */	/* X11 interface */
+#define X11_GRAPHICS	/* X11 interface */
			EEE
		else
			cat >>$xx<<-EEE
 /* #define X11_GRAPHICS */	/* X11 interface */
			EEE
		fi
		if [ "$SDECFG_PKG_NETHACK_QT" == "1" ] ; then
			cat >>$xx<<-EEE
-/* #define QT_GRAPHICS */	/* Qt interface */
+#define QT_GRAPHICS	/* Qt interface */
			EEE
		else
			cat >>$xx<<-EEE
 /* #define QT_GRAPHICS */	/* Qt interface */
			EEE
		fi
		if [ "$SDECFG_PKG_NETHACK_GNO" == "1" ] ; then
			cat >>$xx<<-EEE
-/* #define GNOME_GRAPHICS */	/* Gnome interface */
+#define GNOME_GRAPHICS	/* Gnome interface */
			EEE
		else
			cat >>$xx<<-EEE
 /* #define GNOME_GRAPHICS */	/* Gnome interface */
			EEE
		fi
		cat >>$xx<<-EEE
 /* #define MSWIN_GRAPHICS */	/* Windows NT, CE, Graphics */
			EEE
	fi
# Wizard name, logfile, news
	if [ "$SDECFG_PKG_NETHACK_WIZ" != "wizard" ] ; then
		cat >>$xx<<-EEE
@@ -139,8 +139,8 @@
 #ifndef WIZARD		/* allow for compile-time or Makefile changes */
 # ifndef KR1ED
-#  define WIZARD  "wizard" /* the person allowed to use the -D option */
+#  define WIZARD  "$SDECFG_PKG_NETHACK_WIZ" /* the person allowed to use the -D option */
 # else
 #  define WIZARD
-#  define WIZARD_NAME "wizard"
+#  define WIZARD_NAME "$SDECFG_PKG_NETHACK_WIZ"
 # endif
 #endif
		EEE
	fi
	if [ "$SDECFG_PKG_NETHACK_LOG" != "logfile" ] ; then
		cat >>$xx<<-EEE
@@ -151,1 +151,1 @@
-#define LOGFILE "logfile"	/* larger file for debugging purposes */
+#define LOGFILE "$SDECFG_PKG_NETHACK_LOG"	/* larger file for debugging purposes */
		EEE
	fi
	if [ "$SDECFG_PKG_NETHACK_NEW" != "news" ] ; then
		cat >>$xx<<-EEE
-#define NEWS "news"		/* the file containing the latest hack news */
+#define NEWS "$SDECFG_PKG_NETHACK_NEW"		/* the file containing the latest hack news */
		EEE
	fi
# Compression
	if [ "$SDECFG_PKG_NETHACK_USE_COM" == "1" ] ; then
		if [ "$SDECFG_PKG_NETHACK_COM" != "/usr/bin/compress" ] ; then
			cat >>$xx<<-EEE
@@ -170,1 +170,1 @@
-#define COMPRESS "/usr/bin/compress"	/* Lempel-Ziv compression */
+#define COMPRESS "$SDECFG_PKG_NETHACK_COM"	/* Lempel-Ziv compression */
			EEE
		fi
		if [ "$SDECFG_PKG_NETHACK_EXT" != ".Z" ] ; then
			cat >>$xx<<-EEE
@@ -171,1 +171,1 @@
-#define COMPRESS_EXTENSION ".Z"		/* compress's extension */
+#define COMPRESS_EXTENSION "$SDECFG_PKG_NETHACK_COM_EXT"		/* compress's extension */
			EEE
		fi
	else
		cat >>$xx<<-EEE
@@ -164,8 +164,8 @@
 #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 */
 #endif
		EEE
	fi
#Hackdir
	if [ "$SDECFG_PKG_NETHACK_HACKDIR" != "/usr/games/lib/nethackdir" ] ; then
		cat >>$xx<<-EEE
@@ -203,3 +203,3 @@
 #  else
-#    define HACKDIR "/usr/games/lib/nethackdir"
+#    define HACKDIR "$SDECFG_PKG_NETHACK_HACKDIR"
 #  endif
		EEE
	fi

#Max number of players
	if [ $SDECFG_PKG_NETHACK_MAX -gt 0 ] ; then
		cat >>$xx<<-EEE
@@ -215,7 +215,7 @@
-/* #define SECURE */	/* do setuid(getuid()) after chdir() */
+#define SECURE	/* do setuid(getuid()) after chdir() */
 
 /*
  * If it is desirable to limit the number of people that can play Hack
- * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
- * #define MAX_NR_OF_PLAYERS 6
- */
+ * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS. */
+ #define MAX_NR_OF_PLAYERS $SDECFG_PKG_NETHACK_MAX
+ /* */
		EEE
	fi
 # dungeon features
	if [ "$SDECFG_PKG_NETHACK_SINKS" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -317,1 +317,1 @@
-#define SINKS		/* Kitchen sinks - Janet Walz */
+/*#define SINKS */		/* Kitchen sinks - Janet Walz */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_MAZES" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -319,1 +319,1 @@
-#define WALLIFIED_MAZE	/* Fancy mazes - Jean-Christophe Collet */
+/* #define WALLIFIED_MAZE */	/* Fancy mazes - Jean-Christophe Collet */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_REINCARNATION" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -320,1 +320,1 @@
-#define REINCARNATION	/* Special Rogue-like levels */
+/* #define REINCARNATION */	/* Special Rogue-like levels */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_KOPS" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -322,1 +322,1 @@
-#define KOPS		/* Keystone Kops by Scott R. Turner */
+/* #define KOPS */		/* Keystone Kops by Scott R. Turner */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_SEDUCE" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -323,1 +323,1 @@
-#define SEDUCE		/* Succubi/incubi seduction, by KAA, suggested by IM */
+ /* #define SEDUCE */		/* Succubi/incubi seduction, by KAA, suggested by IM */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_STEED" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -324,1 +324,1 @@
-#define STEED		/* Riding steeds */
+/* #define STEED */		/* Riding steeds */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_TOURIST" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -325,1 +325,1 @@
-#define TOURIST		/* Tourist players with cameras and Hawaiian shirts */
+/* #define TOURIST */		/* Tourist players with cameras and Hawaiian shirts */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_ELBERETH" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -327,1 +327,1 @@
-#define ELBERETH	/* Engraving the E-word repels monsters */
+/* #define ELBERETH */	/* Engraving the E-word repels monsters */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_EXP" == "0" ] ; then
		cat >>$xx<<-EEE
@@ -338,1 +338,1 @@
-#define EXP_ON_BOTL	/* Show experience on bottom line */
+/* #define EXP_ON_BOTL */	/* Show experience on bottom line */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_SCORE" == "1" ] ; then
		cat >>$xx<<-EEE
@@ -339,1 +339,1 @@
-/* #define SCORE_ON_BOTL */	/* added by Gary Erickson (erickson@ucivax) */
+#define SCORE_ON_BOTL	/* added by Gary Erickson (erickson@ucivax) */
		EEE
	fi

	if [ "$SDECFG_PKG_NETHACK_GOLD" == "1" ] ; then
		cat >>$xx<<-EEE
@@ -349,1 +349,1 @@
-/*#define GOLDOBJ */	/* Gold is kept on obj chains - Helge Hafting */
+#define GOLDOBJ	/* Gold is kept on obj chains - Helge Hafting */
		EEE
	fi
}

runconf='0'

hook_add prepatch 5 "createpatch"
patchfiles="$patchfiles $builddir/config.patch"