#!/bin/sh
# HUNT for Solaris
# I'm a big hunt fan. Here's how to get hunt running on your Solaris box:
# 
# 1. Get the linux bsd-games source kit:
# ftp://ftp.cdrom.com/pub/linux/tsx-11/sources/usr.games/bsd-games-1.5.tar.gz
# 
# 2. Extract it. It suffices to extract the regular files in bsd-games-1.5/
# plus everything under bsd-games-1.5/hunt/. (Try the -T option of gnu tar.)
#
# 3. Run configure inside bsd-games-1.5/. I chose to:
# 	- put things in /usr/local instead of the defaults.
#	- Game with scorefile permissions [0755] 0777
#		(world-writable)
#	- Use .so or symlinks for manpages [.so] symlinks
#		(I think solaris needs this)
#	- Gzip manpages [y] n
#	- Strip installed binaries [y] n
#	- Ncurses includes [] -I/usr/local/include -I/usr/local/include/ncurses
#	- BSD-compat library [-lbsd] -lnsl -lsocket
#	- BSD-compat defines [-D_BSD_SOURCE] -D_BSD_SOURCE -DSOLARIS
#	- Other LDFLAGS [] -L/usr/local/lib
#	- Pager [/usr/bin/less] /bin/more
#
# 4. Fix these things in Makeconfig: (for some reason they don't makeconfig)
# 	MAN8DIR = /usr/local/man/man8
#	MAN5DIR = /usr/local/man/man5
# 
# 5. Apply the enclosed patches. Run this file as a sh script
# from the directory that holds bsd-games-1.5/.
#
# 6. cd bsd-games-1.5; make and make install.
#	The first make in your PATH should be gmake.
#	I built with gcc 2.7.2.1; I don't know if it works with Sun's compiler.
#	You will get a couple warnings (wrong pointer types, a couple
#	redefined names).
#
# 7. I had to fix some permissions that the installer got wrong.
#
# Tip: sometimes huntd dies and leaves /tmp/hunt.stats lying around, which
# prevents a new hunt from starting a new huntd. Just rm that file. (Or
# fix the source.)
#
# Patch by jonh@cs.dartmouth.edu.
#
patch -p 0 -c <<__EOF__;
*** bsd-games-1.5/hunt/playit.c	Tue Sep 21 04:00:32 1993
--- bsd-games-1.5-works-tmp/hunt/playit.c	Thu Aug 28 14:58:44 1997
***************
*** 4,10 ****
   *  San Francisco, California
   */
  
! # if defined(HPUX) || (defined(BSD_RELEASE) && BSD_RELEASE >= 44)
  # include	<termios.h>
  # endif
  # include	<curses.h>
--- 4,10 ----
   *  San Francisco, California
   */
  
! # if defined(HPUX) || (defined(BSD_RELEASE) && BSD_RELEASE >= 44) || defined(SOLARIS)
  # include	<termios.h>
  # endif
  # include	<curses.h>
*** bsd-games-1.5/hunt/otto.c	Sat Apr 26 16:37:27 1997
--- bsd-games-1.5-works-tmp/hunt/otto.c	Thu Aug 28 15:17:44 1997
***************
*** 139,148 ****
  	fprintf(debug, "\n%c(%d,%d)", face, y, x);
  # endif
  	(void) signal(SIGALRM, nothing);
! 	old_mask = sigblock(sigmask(SIGALRM));
  	setitimer(ITIMER_REAL, &pause_time, NULL);
  	sigpause(old_mask);
! 	sigsetmask(old_mask);
  
  	/* save away parameters so other functions may use/update info */
  	switch (face) {
--- 139,150 ----
  	fprintf(debug, "\n%c(%d,%d)", face, y, x);
  # endif
  	(void) signal(SIGALRM, nothing);
! 	/*jonh old_mask = sigblock(sigmask(SIGALRM)); */
! 	sighold(SIGALRM);	/*jonh*/
  	setitimer(ITIMER_REAL, &pause_time, NULL);
  	sigpause(old_mask);
! 	/*jonh sigsetmask(old_mask); */
! 	sigrelse(SIGALRM);	/*jonh*/
  
  	/* save away parameters so other functions may use/update info */
  	switch (face) {
*** bsd-games-1.5/hunt/driver.c	Sat Apr 26 14:53:32 1997
--- bsd-games-1.5-works-tmp/hunt/driver.c	Thu Aug 28 19:06:46 1997
***************
*** 238,244 ****
  	auto int	len;
  # endif
  
! # ifdef linux
  	extern char *Stat_name;
  	extern char *Sock_name;
  # endif
--- 238,244 ----
  	auto int	len;
  # endif
  
! # if defined(linux) || defined(SOLARIS)
  	extern char *Stat_name;
  	extern char *Sock_name;
  # endif
__EOF__
