2 # aNetHack 0.0.1 macosx10.11 $ANH-Date: 1445622451 2015/10/23 17:47:31 $ $ANH-Branch: master $:$ANH-Revision: 1.0 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015.
4 # aNetHack may be freely redistributed. See license for details.
7 # Mac OS X (Darwin) hints file
8 # This is for Mac OS X 10.10 or later, and has been tested on 10.11
9 # (El Capitan). If this doesn't work for some other
10 # version of Mac OS X, make a new file for that OS, don't change this one.
11 # And let us know about it.
12 # Useful info: http://www.opensource.apple.com/darwinsource/index.html
14 # You'll need to obtain and install XQuartz if you want X11 support.
15 # (Attempting to run X11.app will describe where to get it.)
17 # This hints file can build several different types of installations.
18 # Edit the next section to match the type of build you need.
20 # 1. Which window system(s) should be included in this binary?
25 # 1a. What is the default window system?
30 # 1b. If you set WANT_WIN_QT, you need to
31 # A) set QTDIR either here or in the environment to point to the Qt2 or Qt3
32 # library installation root. (Qt4 will not work; Qt3 does not presently
33 # compile under Leopard (MacOSX 10.5) out-of-the-box.)
34 # B) set XPMLIB to point to the Xpm library
37 LIBXPM= -L/opt/X11/lib -lXpm
40 # 2. Is this a build for a binary that will be shared among different users
41 # or will it be private to you?
43 # - it will be owned by the user and group listed
44 # - if the user does not exist, you MUST create it before installing
46 # - if the group does not exist, it will be created.
47 # NB: if the group already exists and is being used for something
48 # besides games, you probably want to specify a new group instead
49 # NB: the group will be created locally; if your computer is centrally
50 # administered this may not be what you (or your admin) want.
51 # Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
52 # - 'make install' must be run as "sudo make install"
56 # build to run in the source tree - primarily for development. Build with "make all"
57 #WANT_SOURCE_INSTALL=1
61 # At the moment this is just for debugging, but in the future it could be
62 # useful for other things. Requires SYSCF and an ANSI compiler.
66 # You shouldn't need to change anything below here.
69 #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
70 CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic
71 # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
72 # leave it out by default.
73 #CFLAGS+=-Wunreachable-code
75 # XXX -g vs -O should go here, -I../include goes in the makefile
76 CFLAGS+=-g -I../include
77 # older binaries use NOCLIPPING, but that disables SIGWINCH
79 CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
80 CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
82 CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
96 CFLAGS += -DNOTTYGRAPHICS
100 WINSRC += $(WINX11SRC)
101 WINOBJ += $(WINX11OBJ)
102 WINLIB += $(WINX11LIB)
103 LFLAGS=-L/opt/X11/lib
104 VARDATND = x11tiles aNetHack.ad pet_mark.xbm pilemark.xbm
105 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir);
106 CFLAGS += -DX11_GRAPHICS -I/opt/X11/include
107 # avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
108 CFLAGS += -Wno-variadic-macros
112 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
113 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
115 WINSRC += $(WINQTSRC)
116 WINLIB += $(WINQTLIB) $(LIBXPM)
117 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
118 WINLIB += -framework AGL
120 # prevent duplicate tile.o in WINOBJ
121 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
123 WINOBJ += $(WINTTYOBJ)
126 WINOBJ += $(WINQTOBJ)
127 endif # !WANT_WIN_X11
129 # XXX if /Developer/qt exists and QTDIR not set, use that
131 $(error QTDIR not defined in the environment or Makefile)
133 # XXX make sure QTDIR points to something reasonable
138 ifdef WANT_SHARE_INSTALL
139 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
140 # we install into ~/aanethackdir
141 ifeq ($(GAMEUID),root)
142 PREFIX:=/Library/aaNetHack
143 SHELLDIR=/usr/local/bin
144 HACKDIR=$(PREFIX)/aanethackdir
147 # We run sgid so the game has access to both HACKDIR and user preferences.
150 PREFIX:=/Users/$(GAMEUID)
151 SHELLDIR=$(PREFIX)/bin
152 HACKDIR=$(PREFIX)/Library/aaNetHack/aanethackdir
159 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
160 # XXX it's nice we don't write over sysconf, but we've already erased it
161 # make sure we have group GAMEUID and group GAMEGRP
162 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
163 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
164 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
165 else ifdef WANT_SOURCE_INSTALL
166 PREFIX=$(abspath $(NHSROOT))
167 # suppress aanethack.sh
169 HACKDIR=$(PREFIX)/playground
175 # We can use "make all" to build the whole thing - but it misses some things:
176 MOREALL=$(MAKE) install
177 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
178 else # !WANT_SOURCE_INSTALL
179 PREFIX:=$(wildcard ~)
180 SHELLDIR=$(PREFIX)/bin
181 HACKDIR=$(PREFIX)/aanethackdir
188 # install aanethack.rc as ~/.aanethackrc if no ~/.aanethackrc exists
189 PREINSTALL= cp -n win/X11/aanethack.rc ~/.aanethackrc
191 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
192 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
193 endif # !WANT_SOURCE_INSTALL
199 # ~/Library/Preferences/aNetHack Defaults
200 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
201 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
203 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
204 # package under the docs directory).
212 # 1) The Apple developer utilities must be installed in the default location.
213 # 2) Do a normal build before trying to package the game.
214 # 3) This matches the 3.4.3 Term package, but there are some things that should
218 DEVUTIL=/Developer/Applications/Utilities
219 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
220 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
222 PKGROOT_UG = PKGROOT/$(PREFIX)
223 PKGROOT_UGLN = PKGROOT/$(HACKDIR)
224 PKGROOT_BIN = PKGROOT/$(SHELLDIR)
226 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
227 -echo build_tty_pkg only works for a tty-only build
230 rm -rf aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
231 $(MAKE) build_package_root
234 #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
235 sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
236 sys/unix/hints/macosx.sh infoplist > Info.plist
238 mkdir PKGROOT/Applications
239 #osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aaNetHackRecover.app \
240 # win/macosx/aNetHackRecover.applescript
241 #cp win/macosx/recover.pl aaNetHackQt/aaNetHackQt.app/aanethackdir
242 osacompile -o PKGROOT/Applications/aNetHackRecover.app \
243 win/macosx/aNetHackRecover.applescript
244 cp win/macosx/recover.pl $(PKGROOT_UGLN)
246 osacompile -o PKGROOT/Applications/aNetHackTerm.app \
247 win/macosx/aNetHackTerm.applescript
249 # XXX integrate into Makefile.doc
250 (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
251 | tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf)
252 cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/aNetHackGuidebook.pdf
254 osacompile -o PKGROOT/Applications/aNetHackGuidebook.app \
255 win/macosx/aNetHackGuidebook.applescript
258 pkgbuild --root PKGROOT --identifier org.aanethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg
259 productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml
260 productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG aNetHack-$(SVS)-mac-Term.pkg
261 hdiutil create -verbose -srcfolder aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
264 cd src/.. # make sure we are at TOP
266 mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
267 install -p src/aanethack $(PKGROOT_BIN)
268 # XXX should this be called aanethackrecover?
269 install -p util/recover $(PKGROOT_BIN)
270 install -p doc/aanethack.6 $(PKGROOT_UG)/man/man6
271 install -p doc/recover.6 $(PKGROOT_UG)/man/man6
272 install -p doc/Guidebook $(PKGROOT_UG)/doc
273 install -p dat/anhdat $(PKGROOT_UGLN)
274 sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf
275 cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
276 # XXX these files should be somewhere else for good Mac form
277 touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile
278 mkdir $(PKGROOT_UGLN)/save
279 # XXX what about a news file?
282 echo '#!/bin/sh' > PKGSCRIPTS/postinstall
283 echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall
284 echo $(CHOWN) -R $(GAMEUID) $(HACKDIR) >> PKGSCRIPTS/postinstall
285 echo $(CHGRP) -R $(GAMEGRP) $(HACKDIR) >> PKGSCRIPTS/postinstall
286 echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/aanethack >> PKGSCRIPTS/postinstall
287 echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/aanethack >> PKGSCRIPTS/postinstall
288 echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
289 echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
290 echo chmod $(VARDIRPERM) $(HACKDIR) >> PKGSCRIPTS/postinstall
291 echo chmod $(VARDIRPERM) $(HACKDIR)/save >> PKGSCRIPTS/postinstall
292 echo chmod $(FILEPERM) $(HACKDIR)/license >> PKGSCRIPTS/postinstall
293 echo chmod $(FILEPERM) $(HACKDIR)/anhdat >> PKGSCRIPTS/postinstall
294 echo chmod $(FILEPERM) $(HACKDIR)/symbols >> PKGSCRIPTS/postinstall
295 echo chmod $(VARFILEPERM) $(HACKDIR)/perm >> PKGSCRIPTS/postinstall
296 echo chmod $(VARFILEPERM) $(HACKDIR)/record >> PKGSCRIPTS/postinstall
297 echo chmod $(VARFILEPERM) $(HACKDIR)/logfile >> PKGSCRIPTS/postinstall
298 echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall
299 echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf >> PKGSCRIPTS/postinstall
300 echo chmod $(GAMEPERM) $(SHELLDIR)/aanethack >> PKGSCRIPTS/postinstall
301 echo chmod $(EXEPERM) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
302 chmod 0775 PKGSCRIPTS/postinstall
304 endif # end of build_tty_pkg
305 endif # WANT_WIN_TTY for packaging
308 # XXX untested and incomplete (see below)
310 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
311 -echo build_qt_pkg only works for a qt-only build
314 $(MAKE) build_package_root
316 mkdir -p aNetHackQt/aNetHackQt.app/aanethackdir/save
317 mkdir aNetHackQt/Documentation
318 cp doc/Guidebook.txt doc/aanethack.txt doc/recover.txt aNetHackQt/Documentation
320 osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aNetHackRecover.app \
321 win/macosx/aNetHackRecover.applescript
322 cp win/macosx/recover.pl aNetHackQt/aNetHackQt.app/aanethackdir
324 mkdir -p aNetHackQt/aNetHackQt.app/Contents/Frameworks
325 cp $(QTDIR)/libqt-mt.3.dylib aNetHackQt/aNetHackQt.app/Contents/Frameworks
327 mkdir aNetHackQt/aNetHackQt.app/Contents/MacOS
328 mv PKGROOT/aanethack aNetHackQt/aNetHackQt.app/Contents/MacOS
330 mv PKGROOT/lib/aanethackdir aNetHackQt/aNetHackQt.app/aanethackdir
333 #aaNetHackQt/aaNetHackQt.app
336 # Resources/aanethack.icns
337 #aaNetHackQt/Documentation
338 #aNetHackQtRecover.txt
339 #aNetHack Defaults.txt
340 #changes.patch XXX is this still needed? why isn't it part of the tree?
342 hdiutil create -verbose -srcfolder aNetHackQt aNetHack-$(SVS)-macosx-qt.dmg
343 endif # end of build_qt_pkg
344 endif # WANT_WIN_QT for packaging