2 # NetHack 3.6 macosx10.8 $NHDT-Date: 1546220385 2018/12/31 01:39:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009.
4 # NetHack may be freely redistributed. See license for details.
7 # Mac OS X (Darwin) hints file
8 # This is for Mac OS X 10.8, Mountain Lion.
10 # X11 is no longer included with OSX.
11 # To regain X11, download and install XQuartz. (Attempting to run X11.app
12 # will describe how.) Xcode (not related to X11) has also changed since
13 # earlier versions and some tools are no longer in their previous locations.
15 # If this doesn't work for some other version
16 # of Mac OS X, make a new file for that OS, don't change this one. And
17 # let us know about it.
18 # Useful info: http://www.opensource.apple.com/darwinsource/index.html
20 # This hints file can build several different types of installations.
21 # Edit the next section to match the type of build you need.
23 # 1. Which window system(s) should be included in this binary?
28 # 1a. What is the default window system?
33 # 1b. If you set WANT_WIN_QT, you need to
34 # A) set QTDIR either here or in the environment to point to the Qt2 or Qt3
35 # library installation root. (Qt4 will not work; Qt3 does not presently
36 # compile under Leopard (MacOSX 10.5) out-of-the-box.)
37 # B) set XPMLIB to point to the Xpm library
40 LIBXPM= -L/opt/X11/lib -lXpm
43 # 2. Is this a build for a binary that will be shared among different users
44 # or will it be private to you?
46 # - it will be owned by the user and group listed
47 # - if the user does not exist, you MUST create it before installing
49 # - if the group does not exist, it will be created.
50 # NB: if the group already exists and is being used for something
51 # besides games, you probably want to specify a new group instead
52 # NB: the group will be created locally; if your computer is centrally
53 # administered this may not be what you (or your admin) want.
54 # Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
55 # - 'make install' must be run as "sudo make install"
59 # build to run in the source tree - primarily for development. Build with "make all"
60 #WANT_SOURCE_INSTALL=1
64 # At the moment this is just for debugging, but in the future it could be
65 # useful for other things. Requires SYSCF and an ANSI compiler.
69 # You shouldn't need to change anything below here.
72 #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
73 CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic -Wno-long-long
74 # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
75 # leave it out by default.
76 #CFLAGS+=-Wunreachable-code
78 # XXX -g vs -O should go here, -I../include goes in the makefile
79 CFLAGS+=-g -I../include
80 # older binaries use NOCLIPPING, but that disables SIGWINCH
82 CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
83 CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
85 CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
86 CFLAGS+= -DGDBPATH=\"/Developer/usr/bin/gdb\"
100 CFLAGS += -DNOTTYGRAPHICS
101 endif # !WANT_WIN_TTY
104 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
105 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
106 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir);
107 # separate from CFLAGS so that we don't pass it to every file
108 X11CFLAGS = -I/opt/X11/include
109 CFLAGS += -DX11_GRAPHICS
110 # avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
111 X11CFLAGS += -Wno-variadic-macros
117 WINSRC += $(WINX11SRC)
118 WINOBJ += $(WINX11OBJ)
119 WINLIB += $(WINX11LIB)
120 LFLAGS=-L/opt/X11/lib
124 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
125 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
127 WINSRC += $(WINQTSRC)
128 WINLIB += $(WINQTLIB) $(LIBXPM)
129 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
130 WINLIB += -framework AGL
132 # prevent duplicate tile.o in WINOBJ
133 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
135 WINOBJ += $(WINTTYOBJ)
138 WINOBJ += $(WINQTOBJ)
139 endif # !WANT_WIN_X11
141 # XXX if /Developer/qt exists and QTDIR not set, use that
143 $(error QTDIR not defined in the environment or Makefile)
145 # XXX make sure QTDIR points to something reasonable
150 ifdef WANT_SHARE_INSTALL
151 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
152 # we install into ~/nethackdir
153 ifeq ($(GAMEUID),root)
154 PREFIX:=/Library/NetHack
155 SHELLDIR=/usr/local/bin
156 HACKDIR=$(PREFIX)/nethackdir
161 # We run sgid so the game has access to both HACKDIR and user preferences.
164 PREFIX:=/Users/$(GAMEUID)
165 SHELLDIR=$(PREFIX)/bin
166 HACKDIR=$(PREFIX)/nethackdir
175 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
176 # XXX it's nice we don't write over sysconf, but we've already erased it
177 # make sure we have group GAMEUID and group GAMEGRP
178 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
179 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
180 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
181 else ifdef WANT_SOURCE_INSTALL
182 PREFIX=$(abspath $(NHSROOT))
183 # suppress nethack.sh
185 HACKDIR=$(PREFIX)/playground
193 # We can use "make all" to build the whole thing - but it misses some things:
194 MOREALL=$(MAKE) install
195 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
196 else # !WANT_SOURCE_INSTALL
197 PREFIX:=$(wildcard ~)
198 SHELLDIR=$(PREFIX)/bin
199 HACKDIR=$(PREFIX)/nethackdir
208 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
209 PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
211 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
212 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
213 endif # !WANT_SOURCE_INSTALL
216 # ~/Library/Preferences/NetHack Defaults
217 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
218 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
220 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
221 # package under the docs directory).
229 # 1) The Apple developer utilities must be installed in the default location.
230 # 2) Do a normal build before trying to package the game.
231 # 3) This matches the 3.4.3 Term package, but there are some things that should
235 DEVUTIL=/Developer/Applications/Utilities
236 PKGR=$(DEVUTIL)/PackageMaker.app/Contents/MacOS/PackageMaker
237 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
238 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
240 PKGROOT_UG = PKGROOT/usr/games
241 PKGROOT_UGLN = PKGROOT/usr/games/lib/nethackdir
243 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
244 -echo build_tty_pkg only works for a tty-only build
247 rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
248 $(MAKE) build_package_root
251 #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
252 sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
253 sys/unix/hints/macosx.sh infoplist > Info.plist
255 mkdir PKGROOT/Applications
256 #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
257 # win/macosx/NetHackRecover.applescript
258 #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
259 osacompile -o PKGROOT/Applications/NetHackRecover.app \
260 win/macosx/NetHackRecover.applescript
261 cp win/macosx/recover.pl $(PKGROOT_UGLN)
263 osacompile -o PKGROOT/Applications/NetHackTerm.app \
264 win/macosx/NetHackTerm.applescript
266 # XXX integrate into Makefile.doc
267 (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
268 | tbl tmac.n - | groff |ps2pdf - > Guidebook.pdf)
269 cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf
271 osacompile -o PKGROOT/Applications/NetHackGuidebook.app \
272 win/macosx/NetHackGuidebook.applescript
274 $(PKGR) --root PKGROOT --info Info.plist -e RESOURCES -v -o NetHack-$(SVS)-mac-Term.pkg
275 hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
278 cd src/.. # make sure we are at TOP
280 mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_UG)/bin $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
281 install -p src/nethack $(PKGROOT_UG)/bin
282 # XXX should this be called nethackrecover?
283 install -p util/recover $(PKGROOT_UG)/bin
284 install -p doc/nethack.6 $(PKGROOT_UG)/man/man6
285 install -p doc/recover.6 $(PKGROOT_UG)/man/man6
286 install -p doc/Guidebook $(PKGROOT_UG)/doc
287 install -p dat/nhdat $(PKGROOT_UGLN)
288 cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
289 # XXX these files should be somewhere else for good Mac form
290 touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile
291 # XXX may need postinstall script to get perms right for sgid, etc.
292 mkdir $(PKGROOT_UGLN)/save
293 # XXX what about a news file?
294 endif # end of build_tty_pkg
295 endif # WANT_WIN_TTY for packaging
298 # XXX untested and incomplete (see below)
300 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
301 -echo build_qt_pkg only works for a qt-only build
304 $(MAKE) build_package_root
306 mkdir -p NetHackQt/NetHackQt.app/nethackdir/save
307 mkdir NetHackQt/Documentation
308 cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation
310 osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
311 win/macosx/NetHackRecover.applescript
312 cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
314 mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks
315 cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks
317 mkdir NetHackQt/NetHackQt.app/Contents/MacOS
318 mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS
320 mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir
323 #NetHackQt/NetHackQt.app
326 # Resources/nethack.icns
327 #NetHackQt/Documentation
328 #NetHackQtRecover.txt
329 #NetHack Defaults.txt
330 #changes.patch XXX is this still needed? why isn't it part of the tree?
332 hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg
333 endif # end of build_qt_pkg
334 endif # WANT_WIN_QT for packaging