diff -Naurd ../nethack-3.4.1/sys/unix/Install.unx ./sys/unix/Install.unx --- ../nethack-3.4.1/sys/unix/Install.unx Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Install.unx Mon Sep 1 14:33:32 2003 @@ -243,3 +243,26 @@ on your console speaker in certain appropriate game situations. The only modification to the main-line code needed to enable use of the driver is defining UNIX386MUSIC or VPIX_MUSIC in unixconf.h. + +15. If you are trying to cross-compile for another system, there is some + support in the src and util Makefiles, but there are still other + complications. It may well be best to make another copy of util, + util2, to compile target copies of makedefs, lev_comp, and recover + (duplicating the cross-compilation settings from the src Makefile) + without disturbing the main build. + + You can use the host makedefs for everything but "makedefs -v", which + creates include/date.h, which provides various sanity-checking values + for making sure files read by NetHack at run-time are compatible. + These values depend on the endianness of your processor, its type + sizes, and its compiler's idea of struct packing. Your host and target + computers may disagree on these things, so you'll need to build a target + version of makedefs, run "makedefs -v" on your target, and bring the + resulting date.h back for the builds on the host. (Making sure the host + makedefs doesn't decide it needs to overwrite it for you. :-) + + You also need a target version of lev_comp, and to provide it with all + the dat/*.des files, and copy all the resulting *.lev files back for + packaging on the host. + + For recover, you just want the target binary to install on the target. diff -Naurd ../nethack-3.4.1/sys/unix/Makefile.dat ./sys/unix/Makefile.dat --- ../nethack-3.4.1/sys/unix/Makefile.dat Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Makefile.dat Mon Sep 1 14:33:32 2003 @@ -41,6 +41,9 @@ ../win/share/other.txt ../util/tile2bmp $@ +NetHack.ad: ../win/X11/NetHack.ad + cp ../win/X11/NetHack.ad NetHack.ad + pet_mark.xbm: ../win/X11/pet_mark.xbm cp ../win/X11/pet_mark.xbm pet_mark.xbm @@ -138,4 +141,4 @@ spotless: -rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf -rm -f nhdat x11tiles beostiles pet_mark.xbm rip.xpm mapbg.xpm - -rm -f rip.img GEM_RSC.RSC title.img nh16.img + -rm -f rip.img GEM_RSC.RSC title.img nh16.img NetHack.ad diff -Naurd ../nethack-3.4.1/sys/unix/Makefile.doc ./sys/unix/Makefile.doc --- ../nethack-3.4.1/sys/unix/Makefile.doc Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Makefile.doc Mon Sep 1 14:33:32 2003 @@ -19,7 +19,10 @@ PSCMD = groff # Use the "cat" GUIDECMD if nroff and/or tbl and/or col are not installed +# Not appropriate for creating Guidebook.txt. # GUIDECMD = cat Guidebook.txt +# The following works better with groff-1.18, eg on Linux +# GUIDECMD = tbl tmac.n Guidebook.mn | nroff -c -Tascii | $(COLCMD) GUIDECMD = tbl tmac.n Guidebook.mn | nroff | $(COLCMD) # the basic guidebook @@ -68,7 +71,7 @@ @echo "Plain text documentation is up to date." Guidebook.txt : Guidebook.mn tmac.n - tbl tmac.n Guidebook.mn | nroff | $(COLCMD) > Guidebook.txt + $(GUIDECMD) > Guidebook.txt nethack.txt : nethack.6 nroff -man nethack.6 | $(COLCMD) > nethack.txt lev_comp.txt : lev_comp.6 diff -Naurd ../nethack-3.4.1/sys/unix/Makefile.src ./sys/unix/Makefile.src --- ../nethack-3.4.1/sys/unix/Makefile.src Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Makefile.src Mon Sep 1 14:33:32 2003 @@ -35,6 +35,9 @@ # for Atari # SHELL=E:/GEMINI2/MUPFEL.TTP +# Normally, the C compiler driver is used for linking: +LINK=$(CC) + # Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating # system. # @@ -71,6 +74,10 @@ # For HP/UX 10.20 with GCC: # CC = gcc -D_POSIX_SOURCE # +# For cross-compiling, eg. with gcc on Linux (see also CXX further down): +# CC = arm-linux-gcc +# +# # if you're debugging and want gcc to check as much as possible, use: # CC = gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN @@ -127,11 +134,11 @@ # on a Mac/BeBox: #CC = mwcc #CFLAGS = -r -I../include -#LD = mwld +#LINK = mwld #LFLAGS = -map nethack.xMAP # on Intel: #CFLAGS = -O -I../include -#LD = gcc +#LINK = gcc #LFLAGS = -Xlinker -soname=_APP_ # Only used for the Gnome interface. @@ -145,14 +152,17 @@ # CFLAGS = -g -I../include CFLAGS = -O -I../include -LFLAGS = +LFLAGS = # The Qt and Be window systems are written in C++, while the rest of -# NetHack is standard C. If using Qt, uncomment the LD line here to get +# NetHack is standard C. If using Qt, uncomment the LINK line here to get # the C++ libraries linked in. CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include CXX=g++ -#LD=g++ +#LINK=g++ +# For cross-compiling, eg. with gcc on Linux (see also CC further up): +#CXX=arm-linux-g++ +#LINK=arm-linux-gcc # Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired # combination of windowing systems. Also set windowing systems in config.h. @@ -382,12 +392,12 @@ Sysunix: $(HOBJ) Makefile @echo "Loading ..." - @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) + $(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) @touch Sysunix Sys3B2: $(HOBJ) Makefile @echo "Loading ..." - @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) -lmalloc + @$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) -lmalloc @touch Sys3B2 Sysatt: $(HOBJ) Makefile @@ -397,17 +407,17 @@ Systos: $(HOBJ) Makefile @echo "Loading ..." - @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) + @$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) @touch Systos SysV-AT: DUMB.Setup $(HOBJ) Makefile @echo "Loading ..." - @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) + @$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) @touch SysV-AT SysBe: $(HOBJ) Makefile @echo "Loading ..." - @$(LD) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) + @$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) @xres -o $(GAME) ../win/BeOS/nethack.rsrc @mimeset -f $(GAME) @touch SysBe diff -Naurd ../nethack-3.4.1/sys/unix/Makefile.top ./sys/unix/Makefile.top --- ../nethack-3.4.1/sys/unix/Makefile.top Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Makefile.top Mon Sep 1 14:33:32 2003 @@ -41,8 +41,8 @@ # per discussion in Install.X11 and Install.Qt VARDATND = -# VARDATND = x11tiles pet_mark.xbm -# VARDATND = x11tiles pet_mark.xbm rip.xpm +# VARDATND = x11tiles NetHack.ad pet_mark.xbm +# VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm # for Atari/Gem # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img # for BeOS @@ -135,6 +135,9 @@ ( cd util ; $(MAKE) tile2beos ) ( cd dat ; $(MAKE) beostiles ) +NetHack.ad: $(GAME) + ( cd dat ; $(MAKE) NetHack.ad ) + pet_mark.xbm: ( cd dat ; $(MAKE) pet_mark.xbm ) diff -Naurd ../nethack-3.4.1/sys/unix/Makefile.utl ./sys/unix/Makefile.utl --- ../nethack-3.4.1/sys/unix/Makefile.utl Sun Feb 23 14:43:39 2003 +++ ./sys/unix/Makefile.utl Mon Sep 1 14:33:32 2003 @@ -364,17 +364,17 @@ # make sure object files from src are available when needed # $(OBJDIR)/alloc.o: ../src/alloc.c $(CONFIG_H) - $(CC) $(CFLAGS) -c ../src/alloc.c + $(CC) $(CFLAGS) -c ../src/alloc.c -o $@ $(OBJDIR)/drawing.o: ../src/drawing.c $(CONFIG_H) - $(CC) $(CFLAGS) -c ../src/drawing.c + $(CC) $(CFLAGS) -c ../src/drawing.c -o $@ $(OBJDIR)/decl.o: ../src/decl.c $(CONFIG_H) - $(CC) $(CFLAGS) -c ../src/decl.c + $(CC) $(CFLAGS) -c ../src/decl.c -o $@ $(OBJDIR)/monst.o: ../src/monst.c $(CONFIG_H) - $(CC) $(CFLAGS) -c ../src/monst.c + $(CC) $(CFLAGS) -c ../src/monst.c -o $@ $(OBJDIR)/objects.o: ../src/objects.c $(CONFIG_H) - $(CC) $(CFLAGS) -c ../src/objects.c + $(CC) $(CFLAGS) -c ../src/objects.c -o $@ $(OBJDIR)/dlb.o: ../src/dlb.c $(HACK_H) ../include/dlb.h - $(CC) $(CFLAGS) -c ../src/dlb.c + $(CC) $(CFLAGS) -c ../src/dlb.c -o $@ # make sure hack.h dependencies get transitive information $(HACK_H): $(CONFIG_H) diff -Naurd ../nethack-3.4.1/sys/unix/nethack.sh ./sys/unix/nethack.sh --- ../nethack-3.4.1/sys/unix/nethack.sh Sun Feb 23 14:43:39 2003 +++ ./sys/unix/nethack.sh Mon Sep 1 14:33:32 2003 @@ -6,6 +6,15 @@ HACK=$HACKDIR/nethack MAXNROFPLAYERS=4 +# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH +case "x$XUSERFILESEARCHPATH" in +x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad" + ;; +*) XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad" + ;; +esac +export XUSERFILESEARCHPATH + # see if we can find the full path name of PAGER, so help files work properly # assume that if someone sets up a special variable (HACKPAGER) for NetHack, # it will already be in a form acceptable to NetHack diff -Naurd ../nethack-3.4.1/sys/unix/README.linux ./sys/unix/README.linux --- ../nethack-3.4.1/sys/unix/README.linux Sun Feb 23 14:43:39 2003 +++ ./sys/unix/README.linux Mon Sep 1 14:33:32 2003 @@ -1,4 +1,4 @@ -NetHack 3.4.1 Linux Elf +NetHack 3.4.2 Linux Elf This README provides the instructions for using the official Linux binary, system platform requirements, as well as steps used to create that binary. @@ -14,12 +14,17 @@ "games" on your system. If you do not, you can simplify installation by creating them first. -gunzip and untar the package, preserving permissions, from / to put the -NetHack files in /usr/games/nethack and /usr/games/lib/nethackdir. +Log in as or su to "root". Then, cd /, gunzip and untar the package, +preserving permissions to put the NetHack files in /usr/games/nethack and +/usr/games/lib/nethackdir. For example, if the package in in your +home directory you might perform these steps. + % su + # cd / + # gunzip -c ~yourlogin/nh342lin.tgz | tar xpvf - (If you have old record and logfile entries from a previous NetHack version, you might want to save copies before they get overwritten by the new empty -files; old saved games and bones files from 3.4.0 will work with 3.4.1). +files; old saved games and bones files from 3.4.x will work with 3.4.2). In addition to data files for running the game, you will find other useful things in /usr/games/lib/nethackdir (such as a copy of this README :-). @@ -33,10 +38,11 @@ If you are running X11 copy the nh10.pcf and ibm.pcf font files from /usr/games/lib/nethackdir to a X11 fonts directory (such as /usr/X11/lib/X11/fonts/misc) and run "mkfontdir", then restart X -windows to load them. Also consider putting NetHack.ad in -/usr/X11/lib/X11/app-defaults or its contents in your .Xdefaults or -.Xresources. - +windows to load them. If you prefer to use the graphical tiles, +add the following to your .Xdefaults or .Xresources file: + NetHack.tile_file: x11tiles +You may need to run "xrdb -merge $HOME/.Xdefaults" (or .Xresources) after +doing this. The official Linux binary is set up to run setgid games, which allows multiple users on your system to play the game and prevents cheating by @@ -52,37 +58,47 @@ -Steps used to build this binary release +Steps used to build this binary release, in addition to the basic +instructions found in sys/unix/Install.unx. The step numbers below +correspond to the step numbers in sys/unix/Install.unx. -System: gcc-3.2, XFree86-libs-4.2.0, ncurses-5.2, glibc-2.2.93 +System: gcc-3.2, XFree86-libs-4.2.0, ncurses-5.2, glibc-2.2.93 (GLIBC_2.3) -0. Makefile.top: GAMEGRP = games - GAMEPERM = 02755 - FILEPERM = 0664 - EXEPERM = 0755 - DIRPERM = 0775 - VARDATND = x11tiles pet_mark.xbm rip.xpm +3. Edit include/config.h and include/unixconf.h + config.h: define X11_GRAPHICS window support. + define USE_XPM support. + define COMPRESS as /bin/gzip as that is where it + seems to reside on newer Linux's. + define COMPRESS_EXTENSION as ".gz" + define DLB -1. Makefile.src: define LINUX and linux options throughout + unixconf.h: define LINUX + define TIMED_DELAY + +6. Makefile.src: define modern, non-BSD Linux and linux options throughout + CC = gcc + LFLAGS = -L/usr/X11R6/lib WINSRC = $(WINTTYSRC) $(WINX11SRC) WINOBJ = $(WINTTYOBJ) $(WINX11OBJ) WINTTYLIB = /usr/lib/libncurses.a - Include Xpm libs in WINX11LIB + WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 WINLIB = $(WINTTYLIB) $(WINX11LIB) -2. Makefile.utl: define LINUX and linux options throughout + Makefile.utl: define modern, non-BSD Linux and linux options throughout Use bison/flex instead of yacc/lex + CC = gcc + LFLAGS = -L/usr/X11R6/lib + YACC = bison -y + LEX = flex -3. config.h: define X11 window support, XPM support. - define COMPRESS as /bin/gzip as that is where it - seems to reside on newer Linux's. - define COMPRESS_EXTENSION as ".gz" - define DLB - -4. unixconf.h: define LINUX - define TIMED_DELAY +7. Makefile.top: GAMEGRP = games + GAMEPERM = 02755 + FILEPERM = 0664 + EXEPERM = 0755 + DIRPERM = 0775 + VARDATND = x11tiles pet_mark.xbm rip.xpm -5. make all; su; make install + make all; su; make install -6. Convert nh10.bdf and ibm.bdf to proper font files and place in - font path. +9. Additional step: As discussed in win/X11/Install.X11, convert nh10.bdf + and ibm.bdf to proper font files and place in font path. diff -Naurd ../nethack-3.4.1/sys/unix/unixres.c ./sys/unix/unixres.c --- ../nethack-3.4.1/sys/unix/unixres.c Sun Feb 23 14:43:39 2003 +++ ./sys/unix/unixres.c Mon Sep 1 14:33:32 2003 @@ -19,9 +19,6 @@ #ifdef GETRES_SUPPORT # if defined(LINUX) -#ifdef __GNUC__ -#define _GNU_SOURCE -#endif /* requires dynamic linking with libc */ #include @@ -64,6 +61,10 @@ # else /* SYS_getresuid */ +#ifdef SVR4 +#include +#endif /* SVR4 */ + static int real_getresuid(ruid, euid, suid) uid_t *ruid, *euid, *suid; diff -Naurd ../nethack-3.4.1/sys/unix/unixunix.c ./sys/unix/unixunix.c --- ../nethack-3.4.1/sys/unix/unixunix.c Sun Feb 23 14:43:39 2003 +++ ./sys/unix/unixunix.c Mon Sep 1 14:33:32 2003 @@ -35,7 +35,7 @@ #ifndef INSURANCE if(buf.st_size != sizeof(int)) return(0); /* not an xlock file */ #endif -#ifdef BSD +#if defined(BSD) && !defined(POSIX_TYPES) (void) time((long *)(&date)); #else (void) time(&date); @@ -219,6 +219,21 @@ #endif } +#if defined(TIMED_DELAY) && !defined(msleep) && defined(SYSV) +#include + +void +msleep(msec) +unsigned msec; /* milliseconds */ +{ + struct pollfd unused; + int msecs = msec; /* poll API is signed */ + + if (msecs < 0) msecs = 0; /* avoid infinite sleep */ + (void) poll(&unused, (unsigned long)0, msecs); +} +#endif /* TIMED_DELAY for SYSV */ + #ifdef SHELL int dosh() diff -Naurd ../nethack-3.4.1/include/unixconf.h ./include/unixconf.h --- ../nethack-3.4.1/include/unixconf.h Sun Feb 23 14:43:23 2003 +++ ./include/unixconf.h Mon Sep 1 14:33:32 2003 @@ -19,7 +19,7 @@ */ /* define exactly one of the following four choices */ -/* #define BSD 1 */ /* define for 4.n BSD */ +/* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */ /* also for relatives like SunOS 4.x, DG/UX, and */ /* older versions of Linux */ /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */ @@ -171,11 +171,15 @@ # ifdef AMS #define AMS_MAILBOX "/Mailbox" # else +# if defined(__FreeBSD__) || defined(__OpenBSD__) +#define DEF_MAILREADER "/usr/bin/mail" +# else #define DEF_MAILREADER "/usr/ucb/Mail" +# endif # endif #else # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) -# if defined(M_XENIX) || defined(__FreeBSD__) +# if defined(M_XENIX) #define DEF_MAILREADER "/usr/bin/mail" # else # ifdef __sgi @@ -297,7 +301,7 @@ #endif /* Use the high quality random number routines. */ -#if defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) +#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) #define Rand() random() #else #define Rand() lrand48()