This file documents the procedure used to build this package from the official NetHack source code. To rebuild it yourself: 1. Install Qt for MacOS X, ensure $QTDIR is set. 2. Apply this patch to the NetHack source code. 3. Run "cd sys/unix; sh setup -l". 4. Run "make install". diff -r -u ../nethack-3.4.3/include/config.h ./include/config.h --- ../nethack-3.4.3/include/config.h Mon Dec 8 09:39:13 2003 +++ ./include/config.h Tue Jan 6 16:59:01 2004 @@ -42,9 +42,9 @@ * Define all of those you want supported in your binary. * Some combinations make no sense. See the installation document. */ -#define TTY_GRAPHICS /* good old tty based graphics */ +/* #define TTY_GRAPHICS */ /* good old tty based graphics */ /* #define X11_GRAPHICS */ /* X11 interface */ -/* #define QT_GRAPHICS */ /* Qt interface */ +#define QT_GRAPHICS /* Qt interface */ /* #define GNOME_GRAPHICS */ /* Gnome interface */ /* #define MSWIN_GRAPHICS */ /* Windows NT, CE, Graphics */ @@ -87,6 +87,9 @@ # define USER_SOUNDS /* Use sounds */ # ifndef __APPLE__ # define USER_SOUNDS_REGEX +# endif +# ifdef __APPLE__ +# define HACKDIR "nethackdir" # endif # define USE_XPM /* Use XPM format for images (required) */ # define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ diff -r -u ../nethack-3.4.3/include/unixconf.h ./include/unixconf.h --- ../nethack-3.4.3/include/unixconf.h Mon Dec 8 09:39:13 2003 +++ ./include/unixconf.h Tue Jan 6 16:58:01 2004 @@ -32,7 +32,7 @@ /* 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 */ /* e.g. Suns sharing a playground through NFS */ diff -r -u ../nethack-3.4.3/sys/unix/Makefile.dat ./sys/unix/Makefile.dat --- ../nethack-3.4.3/sys/unix/Makefile.dat Mon Dec 8 09:39:13 2003 +++ ./sys/unix/Makefile.dat Tue Jan 6 16:58:01 2004 @@ -3,7 +3,8 @@ # for Atari # SHELL=E:/GEMINI2/MUPFEL.TTP -# UUDECODE=uudecode + +UUDECODE=uudecode VARDAT = data rumors quest.dat oracles options @@ -59,8 +60,8 @@ nethack.icns: ../win/Qt/nhicns.uu $(UUDECODE) ../win/Qt/nhicns.uu -Info.plist: ../win/Qt/Info.pli - cp ../win/Qt/Info.pli Info.plist +Info.plist: ../win/Qt/Info.plist + cp ../win/Qt/Info.plist . ../util/tile2img.ttp: (cd ../util ; make tile2img.ttp) diff -r -u ../nethack-3.4.3/sys/unix/Makefile.doc ./sys/unix/Makefile.doc --- ../nethack-3.4.3/sys/unix/Makefile.doc Mon Dec 8 09:39:13 2003 +++ ./sys/unix/Makefile.doc Tue Jan 6 16:58:01 2004 @@ -70,6 +70,9 @@ distrib: $(DISTRIB) @echo "Plain text documentation is up to date." +install-distrib: + cp $(DISTRIB) $(INSTALLDIR) + Guidebook.txt : Guidebook.mn tmac.n $(GUIDECMD) > Guidebook.txt nethack.txt : nethack.6 diff -r -u ../nethack-3.4.3/sys/unix/Makefile.src ./sys/unix/Makefile.src --- ../nethack-3.4.3/sys/unix/Makefile.src Mon Dec 8 09:39:13 2003 +++ ./sys/unix/Makefile.src Tue Jan 6 16:58:01 2004 @@ -124,7 +124,7 @@ # flags for Linux # compile normally -# CFLAGS = -O2 -fomit-frame-pointer -I../include +CFLAGS = -O2 -fomit-frame-pointer -I../include # LFLAGS = -L/usr/X11R6/lib # OR compile backwards compatible a.out format # CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include @@ -151,15 +151,15 @@ # flags for debugging: # CFLAGS = -g -I../include -CFLAGS = -O -I../include -LFLAGS = +#CFLAGS = -O -I../include +#LFLAGS = # The Qt and Be window systems are written in C++, while the rest of # 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++ -#LINK=g++ +CXX=c++ +LINK=c++ # For cross-compiling, eg. with gcc on Linux (see also CC further up): #CXX=arm-linux-g++ #LINK=arm-linux-gcc @@ -214,8 +214,8 @@ # # -WINSRC = $(WINTTYSRC) -WINOBJ = $(WINTTYOBJ) +WINSRC = $(WINQTSRC) +WINOBJ = $(WINQTOBJ) # on some systems the termcap library is in -ltermcap or -lcurses # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead @@ -241,7 +241,7 @@ # WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0 # # libraries for Qt -WINQTLIB = -L$(QTDIR)/lib -lqt +WINQTLIB = -L$(QTDIR)/lib -lqt-mt # # libraries for KDE (with Qt) WINKDELIB = -lkdecore -lkdeui -lXext @@ -255,7 +255,7 @@ # libraries for BeOS WINBELIB = -lbe -WINLIB = $(WINTTYLIB) +WINLIB = $(WINQTLIB) # any other strange libraries your system needs (for Sysunix only -- the more # specialized targets should already be right) diff -r -u ../nethack-3.4.3/sys/unix/Makefile.top ./sys/unix/Makefile.top --- ../nethack-3.4.3/sys/unix/Makefile.top Mon Dec 8 09:39:13 2003 +++ ./sys/unix/Makefile.top Tue Jan 6 16:58:01 2004 @@ -14,7 +14,7 @@ # MAKE = make # make NetHack -PREFIX = /usr +PREFIX = ./packages GAME = nethack # GAME = nethack.prg GAMEUID = games @@ -22,7 +22,7 @@ # Permissions - some places use setgid instead of setuid, for instance # See also the option "SECURE" in include/config.h -GAMEPERM = 04755 +GAMEPERM = 0755 FILEPERM = 0644 EXEPERM = 0755 DIRPERM = 0755 @@ -35,20 +35,28 @@ # 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 = $(PREFIX)/games/lib/$(GAME)dir +GAMEDIR = $(PREFIX)/NetHack/NetHack.app/$(GAME)dir +#BINDIR = $(GAMEDIR) +BINDIR = $(PREFIX)/NetHack/NetHack.app/Contents/MacOS VARDIR = $(GAMEDIR) -SHELLDIR = $(PREFIX)/games - -# per discussion in Install.X11 and Install.Qt -VARDATND = -# 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 -# VARDATND = beostiles -# for Gnome -# VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm +DOCDIR = $(PREFIX)/NetHack/Documentation +#SHELLDIR = $(PREFIX)/games +SHELLDIR = + +# For MacOSX, specify Qt library to be copied from $(QTDIR)/lib/ +QTLIB=libqt-mt.3.dylib + +VARDAT_X11 = x11tiles NetHack.ad pet_mark.xbm +VARDAT_Qt = nhtiles.bmp rip.xpm nhsplash.xpm +VARDAT_Qt_MacOSX = $(VARDAT_Qt) Info.plist nethack.icns libqt macdoc maccnf +VARDAT_AtariGem = nh16.img title.img GEM_RSC.RSC rip.img +VARDAT_BeOS = beostiles +VARDAT_Gnome = x11tiles pet_mark.xbm rip.xpm mapbg.xpm +# +# Choose from the above for your platform. +# +VARDATND = $(VARDAT_Qt_MacOSX) VARDATD = data oracles options quest.dat rumors VARDAT = $(VARDATD) $(VARDATND) @@ -176,6 +184,8 @@ ( cd util ; $(MAKE) recover ) dofiles: + cp src/$(GAME) $(BINDIR) + cp util/recover $(GAMEDIR) target=`sed -n \ -e '/librarian/{' \ -e 's/.*/dlb/p' \ @@ -183,21 +193,19 @@ -e '}' \ -e '$$s/.*/nodlb/p' < dat/options` ; \ $(MAKE) dofiles-$${target-nodlb} - cp src/$(GAME) $(GAMEDIR) - cp util/recover $(GAMEDIR) -rm -f $(SHELLDIR)/$(GAME) - sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \ + test -z "$(SHELLDIR)" || 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) recover ; \ + -( cd $(BINDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \ $(CHGRP) $(GAMEGRP) $(GAME) recover ) - chmod $(GAMEPERM) $(GAMEDIR)/$(GAME) + chmod $(GAMEPERM) $(BINDIR)/$(GAME) chmod $(EXEPERM) $(GAMEDIR)/recover - -$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME) - $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME) - chmod $(EXEPERM) $(SHELLDIR)/$(GAME) + -test -z "$(SHELLDIR)" || $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME) + -test -z "$(SHELLDIR)" || $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME) + test -z "$(SHELLDIR)" || chmod $(EXEPERM) $(SHELLDIR)/$(GAME) dofiles-dlb: check-dlb ( cd dat ; cp nhdat $(DATNODLB) $(GAMEDIR) ) @@ -208,15 +216,54 @@ dofiles-nodlb: # copy over the game files - ( cd dat ; cp $(DAT) $(GAMEDIR) ) + for i in $(DAT); do \ + $(MAKE) install.$$i 2>/dev/null || cp dat/$$i $(GAMEDIR); \ + done # set up their permissions -( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \ $(CHGRP) $(GAMEGRP) $(DAT) ; \ chmod $(FILEPERM) $(DAT) ) +nethack.icns: + $(MAKE) -C dat nethack.icns + +install.nethack.icns: + -mkdir -p $(BINDIR)/../Resources + cp dat/nethack.icns $(BINDIR)/../Resources + +Info.plist: + $(MAKE) -C dat Info.plist + +install.Info.plist: + cp dat/Info.plist $(BINDIR)/.. + +libqt: + +install.libqt: + mkdir -p $(BINDIR)/../Frameworks + cp $(QTDIR)/lib/$(QTLIB) $(BINDIR)/../Frameworks + install_name_tool -change $(QTLIB) @executable_path/../Frameworks/$(QTLIB) $(BINDIR)/$(GAME) + install_name_tool -id @executable_path/../Frameworks/$(QTLIB) $(BINDIR)/../Frameworks/$(QTLIB) + +macdoc: + +install.macdoc: + -mkdir -p $(DOCDIR) + $(MAKE) INSTALLDIR=../$(DOCDIR) -C doc install-distrib + +maccnf: + +install.maccnf: + echo "# Move this file to your 'Library/Preferences' folder" \ + >"$(DOCDIR)/NetHack Defaults.txt" + echo "OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp" \ + >>"$(DOCDIR)/NetHack Defaults.txt" + echo "OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt" \ + >>"$(DOCDIR)/NetHack Defaults.txt" + 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 + -mv $(BINDIR)/$(GAME) $(BINDIR)/$(GAME).old # quest.dat is also kept open and has the same problems over NFS # (quest.dat may be inside nhdat if dlb is in use) -mv $(GAMEDIR)/quest.dat $(GAMEDIR)/quest.dat.old @@ -233,12 +280,12 @@ 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) - -mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save + -test -z "$(SHELLDIR)" || mkdir -p $(SHELLDIR) + -rm -rf $(GAMEDIR) $(VARDIR) $(BINDIR) + -mkdir -p $(GAMEDIR) $(VARDIR) $(BINDIR) $(VARDIR)/save -rmdir ./-p -$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save - $(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save + -$(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save chmod $(DIRPERM) $(GAMEDIR) $(VARDIR) $(VARDIR)/save # set up the game files ( $(MAKE) dofiles ) diff -r -u ../nethack-3.4.3/sys/unix/unixmain.c ./sys/unix/unixmain.c --- ../nethack-3.4.3/sys/unix/unixmain.c Mon Dec 8 09:39:13 2003 +++ ./sys/unix/unixmain.c Tue Jan 6 16:58:01 2004 @@ -58,7 +58,7 @@ #if defined(__APPLE__) /* special hack to change working directory to a resource fork when running from finder --sam */ -#define MAC_PATH_VALUE ".app/Contents/MacOS/" +#define MAC_PATH_VALUE "/Contents/MacOS/" char mac_cwd[1024], *mac_exe = argv[0], *mac_tmp; int arg0_len = strlen(mac_exe), mac_tmp_len, mac_lhs_len=0; getcwd(mac_cwd, 1024); @@ -67,12 +67,12 @@ mac_exe++; else mac_exe = argv[0]; - mac_tmp_len = (strlen(mac_exe) * 2) + strlen(MAC_PATH_VALUE); + mac_tmp_len = strlen(mac_exe) + strlen(MAC_PATH_VALUE); if(mac_tmp_len <= arg0_len) { mac_tmp = malloc(mac_tmp_len + 1); - sprintf(mac_tmp, "%s%s%s", mac_exe, MAC_PATH_VALUE, mac_exe); + sprintf(mac_tmp, "%s%s", MAC_PATH_VALUE, mac_exe); if(!strcmp(argv[0] + (arg0_len - mac_tmp_len), mac_tmp)) { - mac_lhs_len = (arg0_len - mac_tmp_len) + strlen(mac_exe) + 5; + mac_lhs_len = arg0_len - mac_tmp_len; if(mac_lhs_len > mac_tmp_len - 1) mac_tmp = realloc(mac_tmp, mac_lhs_len); strncpy(mac_tmp, argv[0], mac_lhs_len); diff -r -u ../nethack-3.4.3/win/Qt/Info.plist ./win/Qt/Info.plist --- ../nethack-3.4.3/win/Qt/Info.plist Mon Dec 8 09:39:13 2003 +++ ./win/Qt/Info.plist Tue Jan 6 16:58:01 2004 @@ -2,6 +2,8 @@ + CFBundleExecutable + nethack CFBundleGetInfoHTML http://www.nethack.org CFBundleGetInfoString diff -r -u ../nethack-3.4.3/win/Qt/Install.Qt ./win/Qt/Install.Qt --- ../nethack-3.4.3/win/Qt/Install.Qt Mon Dec 8 09:39:13 2003 +++ ./win/Qt/Install.Qt Tue Jan 6 17:00:12 2004 @@ -5,9 +5,8 @@ on UNIX/X11 or Mac OS X. This code should also work with Qt/Windows, but support for that is not currently official. -You can download Qt for UNIX and Qt for Windows from http://www.trolltech.com. -Qt for Mac OS X is currently only available commercially. You need Qt 2.0 or -later to use this code. +You can download Qt for all platforms from http://www.trolltech.com. +You need Qt 2.0 or later to use this code. To use this code: