From f7fbbb8cb0e8fcd2912111ef24f216ca9bf5ff3b Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 18 Nov 2018 09:28:45 -0800 Subject: [PATCH 1/4] Hint file for macOS X with curses. --- sys/unix/hints/macosx10.10-curses | 355 ++++++++++++++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100644 sys/unix/hints/macosx10.10-curses diff --git a/sys/unix/hints/macosx10.10-curses b/sys/unix/hints/macosx10.10-curses new file mode 100644 index 000000000..faa935eed --- /dev/null +++ b/sys/unix/hints/macosx10.10-curses @@ -0,0 +1,355 @@ +# +# NetHack 3.6 macosx10.11 $NHDT-Date: 1515549543 2018/01/10 01:59:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ +# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. +# NetHack may be freely redistributed. See license for details. +# +#-PRE +# Mac OS X (Darwin) hints file +# This is for Mac OS X 10.10 or later, and has been tested on 10.11 +# (El Capitan). If this doesn't work for some other +# version of Mac OS X, make a new file for that OS, don't change this one. +# And let us know about it. +# Useful info: http://www.opensource.apple.com/darwinsource/index.html + +# You'll need to obtain and install XQuartz if you want X11 support. +# (Attempting to run X11.app will describe where to get it.) + +# This hints file can build several different types of installations. +# Edit the next section to match the type of build you need. + +# 1. Which window system(s) should be included in this binary? +WANT_WIN_TTY=1 +#WANT_WIN_X11=1 +#WANT_WIN_QT=1 +WANT_WIN_CURSES=1 + +# 1a. What is the default window system? +#WANT_DEFAULT=tty +#WANT_DEFAULT=x11 +#WANT_DEFAULT=qt +WANT_DEFAULT=curses + +# 1b. If you set WANT_WIN_QT, you need to +# A) set QTDIR either here or in the environment to point to the Qt2 or Qt3 +# library installation root. (Qt4 will not work; Qt3 does not presently +# compile under Leopard (MacOSX 10.5) out-of-the-box.) +# B) set XPMLIB to point to the Xpm library +ifdef WANT_WIN_QT +QTDIR=/Developer/Qt +LIBXPM= -L/opt/X11/lib -lXpm +endif # WANT_WIN_QT + +# 2. Is this a build for a binary that will be shared among different users +# or will it be private to you? +# If it is shared: +# - it will be owned by the user and group listed +# - if the user does not exist, you MUST create it before installing +# NetHack +# - if the group does not exist, it will be created. +# NB: if the group already exists and is being used for something +# besides games, you probably want to specify a new group instead +# NB: the group will be created locally; if your computer is centrally +# administered this may not be what you (or your admin) want. +# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead. +# - 'make install' must be run as "sudo make install" +#WANT_SHARE_INSTALL=1 +GAMEUID = $(USER) +GAMEGRP = games +# build to run in the source tree - primarily for development. Build with "make all" +#WANT_SOURCE_INSTALL=1 + +CC=gcc + +# At the moment this is just for debugging, but in the future it could be +# useful for other things. Requires SYSCF and an ANSI compiler. +#WANT_WIN_CHAIN=1 + +# +# You shouldn't need to change anything below here. +# + +#CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN +CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic +# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so +# leave it out by default. +#CFLAGS+=-Wunreachable-code + +# XXX -g vs -O should go here, -I../include goes in the makefile +CFLAGS+=-g -I../include +# older binaries use NOCLIPPING, but that disables SIGWINCH +#CFLAGS+=-DNOCLIPPING +CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" +CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB + +CFLAGS+= -DGREPPATH=\"/usr/bin/grep\" + +ifdef WANT_WIN_CHAIN +CFLAGS+= -DWINCHAIN +HINTSRC=$(CHAINSRC) +HINTOBJ=$(CHAINOBJ) +endif + +ifdef WANT_WIN_TTY +WINSRC = $(WINTTYSRC) +WINOBJ = $(WINTTYOBJ) +WINLIB = $(WINTTYLIB) +WINTTYLIB=-lncurses +else # !WANT_WIN_TTY +CFLAGS += -DNOTTYGRAPHICS +endif # !WANT_WIN_TTY + +ifdef WANT_WIN_CURSES +CFLAGS += -DCURSES_GRAPHICS +WINSRC += $(WINCURSESSRC) +WINOBJ += $(WINCURSESOBJ) +WINLIB += -lncurses +endif + +ifdef WANT_WIN_X11 +WINSRC += $(WINX11SRC) +WINOBJ += $(WINX11OBJ) +WINLIB += $(WINX11LIB) +LFLAGS=-L/opt/X11/lib +VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm +POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); +CFLAGS += -DX11_GRAPHICS -I/opt/X11/include +# avoid repeated complaints about _X_NONNULL(args...) in +CFLAGS += -Wno-variadic-macros +endif # WANT_WIN_X11 + +ifdef WANT_WIN_QT +CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS +CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 +LINK=g++ +WINSRC += $(WINQTSRC) +WINLIB += $(WINQTLIB) $(LIBXPM) +WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL +WINLIB += -framework AGL +ifdef WANT_WIN_X11 + # prevent duplicate tile.o in WINOBJ +WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ)) +ifdef WANT_WIN_TTY +WINOBJ += $(WINTTYOBJ) +endif # WANT_WIN_TTY +else # !WANT_WIN_X11 +WINOBJ += $(WINQTOBJ) +endif # !WANT_WIN_X11 + +# XXX if /Developer/qt exists and QTDIR not set, use that +ifndef QTDIR +$(error QTDIR not defined in the environment or Makefile) +endif # QTDIR +# XXX make sure QTDIR points to something reasonable +else # !WANT_WIN_QT +LINK=$(CC) +endif # !WANT_WIN_QT + +ifdef WANT_SHARE_INSTALL +# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise +# we install into ~/nethackdir +ifeq ($(GAMEUID),root) +PREFIX:=/Library/NetHack +SHELLDIR=/usr/local/bin +HACKDIR=$(PREFIX)/nethackdir +CHOWN=chown +CHGRP=chgrp +# We run sgid so the game has access to both HACKDIR and user preferences. +GAMEPERM = 02755 +else # ! root +PREFIX:=/Users/$(GAMEUID) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/Library/NetHack/nethackdir +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0500 +endif # ! root +VARFILEPERM = 0664 +VARDIRPERM = 0775 +ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1) +# XXX it's nice we don't write over sysconf, but we've already erased it +# make sure we have group GAMEUID and group GAMEGRP +PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +else ifdef WANT_SOURCE_INSTALL +PREFIX=$(abspath $(NHSROOT)) +# suppress nethack.sh +#SHELLDIR= +HACKDIR=$(PREFIX)/playground +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0700 +VARFILEPERM = 0600 +VARDIRPERM = 0700 +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; +# We can use "make all" to build the whole thing - but it misses some things: +MOREALL=$(MAKE) install +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +else # !WANT_SOURCE_INSTALL +PREFIX:=$(wildcard ~) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/nethackdir +CHOWN=/usr/bin/true +CHGRP=/usr/bin/true +GAMEPERM = 0700 +VARFILEPERM = 0600 +VARDIRPERM = 0700 +ifdef WANT_WIN_X11 +# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists +PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc +endif # WANT_WIN_X11 +POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +endif # !WANT_SOURCE_INSTALL + +INSTDIR=$(HACKDIR) +VARDIR=$(HACKDIR) + + +# ~/Library/Preferences/NetHack Defaults +# OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp +# OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt +# +# Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary +# package under the docs directory). + +#-POST +ifdef MAKEFILE_TOP +### +### Packaging +### +# Notes: +# 1) The Apple developer utilities must be installed in the default location. +# 2) Do a normal build before trying to package the game. +# 3) This matches the 3.4.3 Term package, but there are some things that should +# be changed. + +ifdef WANT_WIN_TTY +DEVUTIL=/Developer/Applications/Utilities +SVS=$(shell $(NHSROOT)/util/makedefs --svs) +SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .) + +PKGROOT_UG = PKGROOT/$(PREFIX) +PKGROOT_UGLN = PKGROOT/$(HACKDIR) +PKGROOT_BIN = PKGROOT/$(SHELLDIR) +build_tty_pkg: +ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT)) + -echo build_tty_pkg only works for a tty-only build + exit 1 +else + rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg + $(MAKE) build_package_root + rm -rf RESOURCES + mkdir RESOURCES + #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf + sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist + sys/unix/hints/macosx.sh infoplist > Info.plist + + mkdir PKGROOT/Applications + #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ + # win/macosx/NetHackRecover.applescript + #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir + osacompile -o PKGROOT/Applications/NetHackRecover.app \ + win/macosx/NetHackRecover.applescript + cp win/macosx/recover.pl $(PKGROOT_UGLN) + + osacompile -o PKGROOT/Applications/NetHackTerm.app \ + win/macosx/NetHackTerm.applescript + + # XXX integrate into Makefile.doc + (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \ + | tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf) + cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf + + osacompile -o PKGROOT/Applications/NetHackGuidebook.app \ + win/macosx/NetHackGuidebook.applescript + + mkdir -p PKG + pkgbuild --root PKGROOT --identifier org.nethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg + productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml + productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG NetHack-$(SVS)-mac-Term.pkg + hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg + +build_package_root: + cd src/.. # make sure we are at TOP + rm -rf PKGROOT + mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN) + install -p src/nethack $(PKGROOT_BIN) + # XXX should this be called nethackrecover? + install -p util/recover $(PKGROOT_BIN) + install -p doc/nethack.6 $(PKGROOT_UG)/man/man6 + install -p doc/recover.6 $(PKGROOT_UG)/man/man6 + install -p doc/Guidebook $(PKGROOT_UG)/doc + install -p dat/nhdat $(PKGROOT_UGLN) + sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf + cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN) +# XXX these files should be somewhere else for good Mac form + touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile + mkdir $(PKGROOT_UGLN)/save +# XXX what about a news file? + + mkdir -p PKGSCRIPTS + echo '#!/bin/sh' > PKGSCRIPTS/postinstall + echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall + echo $(CHOWN) -R $(GAMEUID) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo $(CHGRP) -R $(GAMEGRP) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + echo chmod $(VARDIRPERM) $(HACKDIR) >> PKGSCRIPTS/postinstall + echo chmod $(VARDIRPERM) $(HACKDIR)/save >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/license >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/nhdat >> PKGSCRIPTS/postinstall + echo chmod $(FILEPERM) $(HACKDIR)/symbols >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/perm >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/record >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/logfile >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall + echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf >> PKGSCRIPTS/postinstall + echo chmod $(GAMEPERM) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall + echo chmod $(EXEPERM) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall + chmod 0775 PKGSCRIPTS/postinstall + +endif # end of build_tty_pkg +endif # WANT_WIN_TTY for packaging + +ifdef WANT_WIN_QT +# XXX untested and incomplete (see below) +build_qt_pkg: +ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY)) + -echo build_qt_pkg only works for a qt-only build + exit 1 +else + $(MAKE) build_package_root + rm -rf NetHackQt + mkdir -p NetHackQt/NetHackQt.app/nethackdir/save + mkdir NetHackQt/Documentation + cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation + + osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ + win/macosx/NetHackRecover.applescript + cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir + + mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks + cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks + + mkdir NetHackQt/NetHackQt.app/Contents/MacOS + mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS + + mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir + +# XXX still missing: +#NetHackQt/NetHackQt.app +# /Contents +# Info.plist +# Resources/nethack.icns +#NetHackQt/Documentation +#NetHackQtRecover.txt +#NetHack Defaults.txt +#changes.patch XXX is this still needed? why isn't it part of the tree? +# doesn't go here + hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg +endif # end of build_qt_pkg +endif # WANT_WIN_QT for packaging +endif # MAKEFILE_TOP From 360ee21861099d7cc973f301e5b69d7838168139 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 18 Nov 2018 11:45:36 -0800 Subject: [PATCH 2/4] Revert "Hint file for macOS X with curses." This reverts commit f7fbbb8cb0e8fcd2912111ef24f216ca9bf5ff3b. --- sys/unix/hints/macosx10.10-curses | 355 ------------------------------ 1 file changed, 355 deletions(-) delete mode 100644 sys/unix/hints/macosx10.10-curses diff --git a/sys/unix/hints/macosx10.10-curses b/sys/unix/hints/macosx10.10-curses deleted file mode 100644 index faa935eed..000000000 --- a/sys/unix/hints/macosx10.10-curses +++ /dev/null @@ -1,355 +0,0 @@ -# -# NetHack 3.6 macosx10.11 $NHDT-Date: 1515549543 2018/01/10 01:59:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ -# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. -# NetHack may be freely redistributed. See license for details. -# -#-PRE -# Mac OS X (Darwin) hints file -# This is for Mac OS X 10.10 or later, and has been tested on 10.11 -# (El Capitan). If this doesn't work for some other -# version of Mac OS X, make a new file for that OS, don't change this one. -# And let us know about it. -# Useful info: http://www.opensource.apple.com/darwinsource/index.html - -# You'll need to obtain and install XQuartz if you want X11 support. -# (Attempting to run X11.app will describe where to get it.) - -# This hints file can build several different types of installations. -# Edit the next section to match the type of build you need. - -# 1. Which window system(s) should be included in this binary? -WANT_WIN_TTY=1 -#WANT_WIN_X11=1 -#WANT_WIN_QT=1 -WANT_WIN_CURSES=1 - -# 1a. What is the default window system? -#WANT_DEFAULT=tty -#WANT_DEFAULT=x11 -#WANT_DEFAULT=qt -WANT_DEFAULT=curses - -# 1b. If you set WANT_WIN_QT, you need to -# A) set QTDIR either here or in the environment to point to the Qt2 or Qt3 -# library installation root. (Qt4 will not work; Qt3 does not presently -# compile under Leopard (MacOSX 10.5) out-of-the-box.) -# B) set XPMLIB to point to the Xpm library -ifdef WANT_WIN_QT -QTDIR=/Developer/Qt -LIBXPM= -L/opt/X11/lib -lXpm -endif # WANT_WIN_QT - -# 2. Is this a build for a binary that will be shared among different users -# or will it be private to you? -# If it is shared: -# - it will be owned by the user and group listed -# - if the user does not exist, you MUST create it before installing -# NetHack -# - if the group does not exist, it will be created. -# NB: if the group already exists and is being used for something -# besides games, you probably want to specify a new group instead -# NB: the group will be created locally; if your computer is centrally -# administered this may not be what you (or your admin) want. -# Consider a non-shared install (WANT_SHARE_INSTALL=0) instead. -# - 'make install' must be run as "sudo make install" -#WANT_SHARE_INSTALL=1 -GAMEUID = $(USER) -GAMEGRP = games -# build to run in the source tree - primarily for development. Build with "make all" -#WANT_SOURCE_INSTALL=1 - -CC=gcc - -# At the moment this is just for debugging, but in the future it could be -# useful for other things. Requires SYSCF and an ANSI compiler. -#WANT_WIN_CHAIN=1 - -# -# You shouldn't need to change anything below here. -# - -#CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN -CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic -# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so -# leave it out by default. -#CFLAGS+=-Wunreachable-code - -# XXX -g vs -O should go here, -I../include goes in the makefile -CFLAGS+=-g -I../include -# older binaries use NOCLIPPING, but that disables SIGWINCH -#CFLAGS+=-DNOCLIPPING -CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" -CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB - -CFLAGS+= -DGREPPATH=\"/usr/bin/grep\" - -ifdef WANT_WIN_CHAIN -CFLAGS+= -DWINCHAIN -HINTSRC=$(CHAINSRC) -HINTOBJ=$(CHAINOBJ) -endif - -ifdef WANT_WIN_TTY -WINSRC = $(WINTTYSRC) -WINOBJ = $(WINTTYOBJ) -WINLIB = $(WINTTYLIB) -WINTTYLIB=-lncurses -else # !WANT_WIN_TTY -CFLAGS += -DNOTTYGRAPHICS -endif # !WANT_WIN_TTY - -ifdef WANT_WIN_CURSES -CFLAGS += -DCURSES_GRAPHICS -WINSRC += $(WINCURSESSRC) -WINOBJ += $(WINCURSESOBJ) -WINLIB += -lncurses -endif - -ifdef WANT_WIN_X11 -WINSRC += $(WINX11SRC) -WINOBJ += $(WINX11OBJ) -WINLIB += $(WINX11LIB) -LFLAGS=-L/opt/X11/lib -VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm -POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir); -CFLAGS += -DX11_GRAPHICS -I/opt/X11/include -# avoid repeated complaints about _X_NONNULL(args...) in -CFLAGS += -Wno-variadic-macros -endif # WANT_WIN_X11 - -ifdef WANT_WIN_QT -CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS -CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -LINK=g++ -WINSRC += $(WINQTSRC) -WINLIB += $(WINQTLIB) $(LIBXPM) -WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL -WINLIB += -framework AGL -ifdef WANT_WIN_X11 - # prevent duplicate tile.o in WINOBJ -WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ)) -ifdef WANT_WIN_TTY -WINOBJ += $(WINTTYOBJ) -endif # WANT_WIN_TTY -else # !WANT_WIN_X11 -WINOBJ += $(WINQTOBJ) -endif # !WANT_WIN_X11 - -# XXX if /Developer/qt exists and QTDIR not set, use that -ifndef QTDIR -$(error QTDIR not defined in the environment or Makefile) -endif # QTDIR -# XXX make sure QTDIR points to something reasonable -else # !WANT_WIN_QT -LINK=$(CC) -endif # !WANT_WIN_QT - -ifdef WANT_SHARE_INSTALL -# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise -# we install into ~/nethackdir -ifeq ($(GAMEUID),root) -PREFIX:=/Library/NetHack -SHELLDIR=/usr/local/bin -HACKDIR=$(PREFIX)/nethackdir -CHOWN=chown -CHGRP=chgrp -# We run sgid so the game has access to both HACKDIR and user preferences. -GAMEPERM = 02755 -else # ! root -PREFIX:=/Users/$(GAMEUID) -SHELLDIR=$(PREFIX)/bin -HACKDIR=$(PREFIX)/Library/NetHack/nethackdir -CHOWN=/usr/bin/true -CHGRP=/usr/bin/true -GAMEPERM = 0500 -endif # ! root -VARFILEPERM = 0664 -VARDIRPERM = 0775 -ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1) -# XXX it's nice we don't write over sysconf, but we've already erased it -# make sure we have group GAMEUID and group GAMEGRP -PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) -POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; -CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE -else ifdef WANT_SOURCE_INSTALL -PREFIX=$(abspath $(NHSROOT)) -# suppress nethack.sh -#SHELLDIR= -HACKDIR=$(PREFIX)/playground -CHOWN=/usr/bin/true -CHGRP=/usr/bin/true -GAMEPERM = 0700 -VARFILEPERM = 0600 -VARDIRPERM = 0700 -POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; -# We can use "make all" to build the whole thing - but it misses some things: -MOREALL=$(MAKE) install -CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE -else # !WANT_SOURCE_INSTALL -PREFIX:=$(wildcard ~) -SHELLDIR=$(PREFIX)/bin -HACKDIR=$(PREFIX)/nethackdir -CHOWN=/usr/bin/true -CHGRP=/usr/bin/true -GAMEPERM = 0700 -VARFILEPERM = 0600 -VARDIRPERM = 0700 -ifdef WANT_WIN_X11 -# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists -PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc -endif # WANT_WIN_X11 -POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf; -CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE -endif # !WANT_SOURCE_INSTALL - -INSTDIR=$(HACKDIR) -VARDIR=$(HACKDIR) - - -# ~/Library/Preferences/NetHack Defaults -# OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp -# OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt -# -# Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary -# package under the docs directory). - -#-POST -ifdef MAKEFILE_TOP -### -### Packaging -### -# Notes: -# 1) The Apple developer utilities must be installed in the default location. -# 2) Do a normal build before trying to package the game. -# 3) This matches the 3.4.3 Term package, but there are some things that should -# be changed. - -ifdef WANT_WIN_TTY -DEVUTIL=/Developer/Applications/Utilities -SVS=$(shell $(NHSROOT)/util/makedefs --svs) -SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .) - -PKGROOT_UG = PKGROOT/$(PREFIX) -PKGROOT_UGLN = PKGROOT/$(HACKDIR) -PKGROOT_BIN = PKGROOT/$(SHELLDIR) -build_tty_pkg: -ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT)) - -echo build_tty_pkg only works for a tty-only build - exit 1 -else - rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg - $(MAKE) build_package_root - rm -rf RESOURCES - mkdir RESOURCES - #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf - sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist - sys/unix/hints/macosx.sh infoplist > Info.plist - - mkdir PKGROOT/Applications - #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ - # win/macosx/NetHackRecover.applescript - #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir - osacompile -o PKGROOT/Applications/NetHackRecover.app \ - win/macosx/NetHackRecover.applescript - cp win/macosx/recover.pl $(PKGROOT_UGLN) - - osacompile -o PKGROOT/Applications/NetHackTerm.app \ - win/macosx/NetHackTerm.applescript - - # XXX integrate into Makefile.doc - (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \ - | tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf) - cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf - - osacompile -o PKGROOT/Applications/NetHackGuidebook.app \ - win/macosx/NetHackGuidebook.applescript - - mkdir -p PKG - pkgbuild --root PKGROOT --identifier org.nethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg - productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml - productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG NetHack-$(SVS)-mac-Term.pkg - hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg - -build_package_root: - cd src/.. # make sure we are at TOP - rm -rf PKGROOT - mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN) - install -p src/nethack $(PKGROOT_BIN) - # XXX should this be called nethackrecover? - install -p util/recover $(PKGROOT_BIN) - install -p doc/nethack.6 $(PKGROOT_UG)/man/man6 - install -p doc/recover.6 $(PKGROOT_UG)/man/man6 - install -p doc/Guidebook $(PKGROOT_UG)/doc - install -p dat/nhdat $(PKGROOT_UGLN) - sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf - cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN) -# XXX these files should be somewhere else for good Mac form - touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile - mkdir $(PKGROOT_UGLN)/save -# XXX what about a news file? - - mkdir -p PKGSCRIPTS - echo '#!/bin/sh' > PKGSCRIPTS/postinstall - echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall - echo $(CHOWN) -R $(GAMEUID) $(HACKDIR) >> PKGSCRIPTS/postinstall - echo $(CHGRP) -R $(GAMEGRP) $(HACKDIR) >> PKGSCRIPTS/postinstall - echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall - echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall - echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall - echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall - echo chmod $(VARDIRPERM) $(HACKDIR) >> PKGSCRIPTS/postinstall - echo chmod $(VARDIRPERM) $(HACKDIR)/save >> PKGSCRIPTS/postinstall - echo chmod $(FILEPERM) $(HACKDIR)/license >> PKGSCRIPTS/postinstall - echo chmod $(FILEPERM) $(HACKDIR)/nhdat >> PKGSCRIPTS/postinstall - echo chmod $(FILEPERM) $(HACKDIR)/symbols >> PKGSCRIPTS/postinstall - echo chmod $(VARFILEPERM) $(HACKDIR)/perm >> PKGSCRIPTS/postinstall - echo chmod $(VARFILEPERM) $(HACKDIR)/record >> PKGSCRIPTS/postinstall - echo chmod $(VARFILEPERM) $(HACKDIR)/logfile >> PKGSCRIPTS/postinstall - echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall - echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf >> PKGSCRIPTS/postinstall - echo chmod $(GAMEPERM) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall - echo chmod $(EXEPERM) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall - chmod 0775 PKGSCRIPTS/postinstall - -endif # end of build_tty_pkg -endif # WANT_WIN_TTY for packaging - -ifdef WANT_WIN_QT -# XXX untested and incomplete (see below) -build_qt_pkg: -ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY)) - -echo build_qt_pkg only works for a qt-only build - exit 1 -else - $(MAKE) build_package_root - rm -rf NetHackQt - mkdir -p NetHackQt/NetHackQt.app/nethackdir/save - mkdir NetHackQt/Documentation - cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation - - osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \ - win/macosx/NetHackRecover.applescript - cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir - - mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks - cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks - - mkdir NetHackQt/NetHackQt.app/Contents/MacOS - mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS - - mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir - -# XXX still missing: -#NetHackQt/NetHackQt.app -# /Contents -# Info.plist -# Resources/nethack.icns -#NetHackQt/Documentation -#NetHackQtRecover.txt -#NetHack Defaults.txt -#changes.patch XXX is this still needed? why isn't it part of the tree? -# doesn't go here - hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg -endif # end of build_qt_pkg -endif # WANT_WIN_QT for packaging -endif # MAKEFILE_TOP From 7ee4fa3c3ff67fbb99cef0fc905c8561db7e08e1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 19 Nov 2018 10:40:51 -0500 Subject: [PATCH 3/4] some curses window-port doc bits --- doc/fixes36.2 | 13 ++++++ sys/winnt/Install.nt | 107 ++++++++++++++++++------------------------- 2 files changed, 58 insertions(+), 62 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index f4cfd00a1..a808ba08d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -314,6 +314,19 @@ for ^X and enlightenment, display the information in a menu rather than a end of game disclosure of attributes remains single-forward-pass +NetHack Community Patches (or Variation) Included +------------------------------------------------- +curses: the community patch for an optional curses window-port was + incorporated into the NetHack source code tree. The curses + window-port evolved from work originally done by Karl Garrison, + and has been in use in several NetHack variants and on + nethack.alt.org and on www.hardfought.org/nethack/ for a while. + It is available and tested for 3.6.2 for Windows with PDCurses + layered underneath, and for Mac OSX and Unix (using ncurses as + the layer underneath). It may also work for DOS with PDCurses + layered underneath, but that has not been tested. + + Code Cleanup and Reorganization ------------------------------- generated source file monstr.c is no longer used diff --git a/sys/winnt/Install.nt b/sys/winnt/Install.nt index 91446103e..f3fe944fc 100644 --- a/sys/winnt/Install.nt +++ b/sys/winnt/Install.nt @@ -33,6 +33,24 @@ version. You can use one of the following build environments: Earlier versions of MinGW will not allow you to build the Windows Graphical version. +/---------------------------------------------\ +| Directories for a Win32 NetHack build | +\---------------------------------------------/ + + + (NetHack-top) ----------------------(optional-pdcurses-top) + | | + ---------------------------------------------- -------------- + | | | | | | | | | + util dat doc include src sys win pdcurses wincon + | | + ------ -------- + | | | | + share winnt tty win32 + | + vs2017 + + /--------------------------------------------------------\ | Building And Running Using Visual Studio 2017 | \--------------------------------------------------------/ @@ -64,7 +82,7 @@ using a "build.bat" batch file found in the same directory as the solution. Open a developer command prompt for the version of Visual Studio you are using. Change to the directory win\win32\vs2017 and run "build.bat". - + * Optional curses window-port support * Starting with 3.6.2, the community patch for a window-port that uses curses was incorporated into the NetHack source code tree. That window-port, @@ -84,9 +102,12 @@ Place the PDCurses folder alongside the NetHack source repository prior to proceeding with steps 1 through 5 above. -/-----------------------------------\ -| Building Using Make | -\-----------------------------------/ +/-------------------------------------------\ +| Building From the Command Line Using Make | +\-------------------------------------------/ + +-------------------------------------------------------------------------- +-- Beginning of prerequisite step -- The first step in building either version of NetHack via Makefile is to execute sys\winnt\nhsetup.bat to move some files to their required locations. @@ -101,9 +122,8 @@ From a Windows explorer window: If you wish to build from the command line, proceed to "BUILDING FROM THE COMMAND LINE." -/--------------------------------\ -| BUILDING FROM THE COMMAND LINE | -\--------------------------------/ +-- end of prerequisite step -- +-------------------------------------------------------------------------- Two different versions of NetHack will be built for Windows from the command line using the Makefile approach: @@ -175,11 +195,12 @@ Setting Up source tree. cd src -2. Starting with 3.6.2, the community patch for a window-port that uses - curses was incorporated into the NetHack source code tree. That +2. Starting with 3.6.2, the community patch for an optional curses + window-port was incorporated into the NetHack source code tree. That window-port, which evolved from work originally done by Karl Garrison, has been used in several NetHack variants and on nethack.alt.org and - on www.hardfought.org/nethack/. + on www.hardfought.org/nethack/. The optional curses window-port is + available for Windows, Mac OS X, and Unix (and also DOS). If you want to include the optional curses window-port support in your command line Makefile build, you will have to first obtain the @@ -194,48 +215,19 @@ Setting Up location for the top of the PDCurses source tree if it differs from the path shown. -3. Make sure all the NetHack files are in the appropriate directory - structure. You should have a main directory with subdirectories - dat, doc, include, src, sys\share, sys\winnt, util, and binary (The - "binary" directory was created by nhsetup.bat earlier if you - followed the steps appropriately). +3. Make sure all the necessary files are in the appropriate directory + structure. You should have a main NetHack top directory with + subdirectories dat, doc, include, src, sys\share, sys\winnt, + win\tty, util. - For Console NetHack you need win\tty in addition to these; for - Graphical NetHack you need win\win32 in addition to these. + If you are including the optional Curses window port into your + build,then you will need the top of the PDCurses sources in a + folder parallel to the top of the NetHack folder (or you will need + to change the value of the PDCURSES_TOP macro in the Makefile to + specify the appropriate location. - Other subdirectories may also be included in your distribution, but - they are not necessary for building the TTY version for the Win32 - console subsystem. You can delete them to save space. - - Required Directories for a Win32 Console NetHack build: - - top -------------(optional) ---------------- - | | - ------------------------------------------------- pdcurses-top - | | | | | | | | | - util dat doc include src sys win pdcurses wincon - | | - ------ ----- - | | | - share winnt tty - - - Required Directories for a Win32 Graphical NetHack: - - top - | - ------------------------------------------------- - | | | | | | | - util dat doc include src sys win - | | - ------ ----- - | | | - share winnt win32 - - Check the file "Files" in your top level directory for a more - complete listing of what file is in which directory. In order for - the Makefiles to work, all the source files must be in the proper - locations. + (You can check the file "Files" in your top level directory for a + more complete listing of what file is in which directory.) If you downloaded or ftp'd the sources from a UNIX system, the lines will probably end in UNIX-style newlines, instead of the carriage @@ -243,18 +235,6 @@ Setting Up trouble with them, so you may need to convert them. The compiler should not have any problems with them however. -4. Now go to the include subdirectory to check a couple of the header - files there. Things *should* work as they are, but since you have - probably set up your system in some sort of custom configuration it - doesn't hurt to check out the following: - - First check config.h according to the comments to match your system - and desired set of features. Mostly you need to check section 4 and - 5. - - You may include all or as few of the special game features as you - wish (they are located last in the file). - 4. Edit your Makefile if you wish, but it is not required unless you are altering the build options. @@ -319,6 +299,9 @@ Notes: - a 64-bit (x64) .exe file, which should run on any 64-bit Windows O/S. + Note that saved games are NOT compatible between the 32-bit and the + 64-bit versions at this time. + NetHack.exe is the tty version. NetHackW.exe is the graphical version. Play NetHack. From 4228cf534e89780e06fbf677234dc3e354b95d2a Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 20 Nov 2018 19:09:05 -0500 Subject: [PATCH 4/4] follow-up bits --- include/system.h | 5 +++++ util/makedefs.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/system.h b/include/system.h index f0b53fe3c..1074d6c03 100644 --- a/include/system.h +++ b/include/system.h @@ -91,8 +91,13 @@ E int FDECL(srandom, (unsigned int)); #endif #endif #else +#if defined(MACOSX) E long NDECL(lrand48); E void FDECL(srand48, (long)); +#else +E long lrand48(); +E void srand48(); +#endif /* MACOSX */ #endif /* BSD || ULTRIX || RANDOM */ #if !defined(BSD) || defined(ultrix) diff --git a/util/makedefs.c b/util/makedefs.c index 6d5ab510a..a9a39048f 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -298,7 +298,7 @@ link_sanity_check() monst_init(); objects_init(); - /* Quite unused warning */ + /* Quiet unused warning */ (void) SCCS_Id; }