2 # aNetHack 0.0.1 macosx10.8 $ANH-Date: 1455397109 2016/02/13 20:58:29 $ $ANH-Branch: aNetHack-3.6.0 $:$ANH-Revision: 1.0 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009.
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.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
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 WINSRC += $(WINX11SRC)
105 WINOBJ += $(WINX11OBJ)
106 WINLIB += $(WINX11LIB)
107 LFLAGS=-L/opt/X11/lib
108 VARDATND = x11tiles aNetHack.ad pet_mark.xbm pilemark.xbm
109 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir);
110 CFLAGS += -DX11_GRAPHICS -I/opt/X11/include
111 # avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
112 CFLAGS += -Wno-variadic-macros
116 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
117 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
119 WINSRC += $(WINQTSRC)
120 WINLIB += $(WINQTLIB) $(LIBXPM)
121 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
122 WINLIB += -framework AGL
124 # prevent duplicate tile.o in WINOBJ
125 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
127 WINOBJ += $(WINTTYOBJ)
130 WINOBJ += $(WINQTOBJ)
131 endif # !WANT_WIN_X11
133 # XXX if /Developer/qt exists and QTDIR not set, use that
135 $(error QTDIR not defined in the environment or Makefile)
137 # XXX make sure QTDIR points to something reasonable
142 ifdef WANT_SHARE_INSTALL
143 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
144 # we install into ~/aanethackdir
145 ifeq ($(GAMEUID),root)
146 PREFIX:=/Library/aNetHack
147 SHELLDIR=/usr/local/bin
148 HACKDIR=$(PREFIX)/aanethackdir
153 # We run sgid so the game has access to both HACKDIR and user preferences.
156 PREFIX:=/Users/$(GAMEUID)
157 SHELLDIR=$(PREFIX)/bin
158 HACKDIR=$(PREFIX)/aanethackdir
167 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
168 # XXX it's nice we don't write over sysconf, but we've already erased it
169 # make sure we have group GAMEUID and group GAMEGRP
170 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
171 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
172 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
173 else ifdef WANT_SOURCE_INSTALL
174 PREFIX=$(abspath $(NHSROOT))
175 # suppress aanethack.sh
177 HACKDIR=$(PREFIX)/playground
185 # We can use "make all" to build the whole thing - but it misses some things:
186 MOREALL=$(MAKE) install
187 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
188 else # !WANT_SOURCE_INSTALL
189 PREFIX:=$(wildcard ~)
190 SHELLDIR=$(PREFIX)/bin
191 HACKDIR=$(PREFIX)/aanethackdir
200 # install aanethack.rc as ~/.aanethackrc if no ~/.aanethackrc exists
201 PREINSTALL= cp -n win/X11/aanethack.rc ~/.aanethackrc
203 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
204 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
205 endif # !WANT_SOURCE_INSTALL
208 # ~/Library/Preferences/aNetHack Defaults
209 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
210 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
212 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
213 # package under the docs directory).
221 # 1) The Apple developer utilities must be installed in the default location.
222 # 2) Do a normal build before trying to package the game.
223 # 3) This matches the 3.4.3 Term package, but there are some things that should
227 DEVUTIL=/Developer/Applications/Utilities
228 PKGR=$(DEVUTIL)/PackageMaker.app/Contents/MacOS/PackageMaker
229 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
230 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
232 PKGROOT_UG = PKGROOT/usr/games
233 PKGROOT_UGLN = PKGROOT/usr/games/lib/aanethackdir
235 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
236 -echo build_tty_pkg only works for a tty-only build
239 rm -rf aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
240 $(MAKE) build_package_root
243 #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
244 sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
245 sys/unix/hints/macosx.sh infoplist > Info.plist
247 mkdir PKGROOT/Applications
248 #osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aNetHackRecover.app \
249 # win/macosx/aNetHackRecover.applescript
250 #cp win/macosx/recover.pl aNetHackQt/aNetHackQt.app/aanethackdir
251 osacompile -o PKGROOT/Applications/aNetHackRecover.app \
252 win/macosx/aNetHackRecover.applescript
253 cp win/macosx/recover.pl $(PKGROOT_UGLN)
255 osacompile -o PKGROOT/Applications/aNetHackTerm.app \
256 win/macosx/aNetHackTerm.applescript
258 # XXX integrate into Makefile.doc
259 (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
260 | tbl tmac.n - | groff |ps2pdf - > Guidebook.pdf)
261 cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/aNetHackGuidebook.pdf
263 osacompile -o PKGROOT/Applications/aNetHackGuidebook.app \
264 win/macosx/aNetHackGuidebook.applescript
266 $(PKGR) --root PKGROOT --info Info.plist -e RESOURCES -v -o aNetHack-$(SVS)-mac-Term.pkg
267 hdiutil create -verbose -srcfolder aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
270 cd src/.. # make sure we are at TOP
272 mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_UG)/bin $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
273 install -p src/aanethack $(PKGROOT_UG)/bin
274 # XXX should this be called aanethackrecover?
275 install -p util/recover $(PKGROOT_UG)/bin
276 install -p doc/aanethack.6 $(PKGROOT_UG)/man/man6
277 install -p doc/recover.6 $(PKGROOT_UG)/man/man6
278 install -p doc/Guidebook $(PKGROOT_UG)/doc
279 install -p dat/anhdat $(PKGROOT_UGLN)
280 cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
281 # XXX these files should be somewhere else for good Mac form
282 touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile
283 # XXX may need postinstall script to get perms right for sgid, etc.
284 mkdir $(PKGROOT_UGLN)/save
285 # XXX what about a news file?
286 endif # end of build_tty_pkg
287 endif # WANT_WIN_TTY for packaging
290 # XXX untested and incomplete (see below)
292 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
293 -echo build_qt_pkg only works for a qt-only build
296 $(MAKE) build_package_root
298 mkdir -p aNetHackQt/aNetHackQt.app/aanethackdir/save
299 mkdir aNetHackQt/Documentation
300 cp doc/Guidebook.txt doc/aanethack.txt doc/recover.txt aNetHackQt/Documentation
302 osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aNetHackRecover.app \
303 win/macosx/aNetHackRecover.applescript
304 cp win/macosx/recover.pl aNetHackQt/aNetHackQt.app/aanethackdir
306 mkdir -p aNetHackQt/aNetHackQt.app/Contents/Frameworks
307 cp $(QTDIR)/libqt-mt.3.dylib aNetHackQt/aNetHackQt.app/Contents/Frameworks
309 mkdir aNetHackQt/aNetHackQt.app/Contents/MacOS
310 mv PKGROOT/aanethack aNetHackQt/aNetHackQt.app/Contents/MacOS
312 mv PKGROOT/lib/aanethackdir aNetHackQt/aNetHackQt.app/aanethackdir
315 #aNetHackQt/aNetHackQt.app
318 # Resources/aanethack.icns
319 #aNetHackQt/Documentation
320 #aNetHackQtRecover.txt
321 #aNetHack Defaults.txt
322 #changes.patch XXX is this still needed? why isn't it part of the tree?
324 hdiutil create -verbose -srcfolder aNetHackQt aNetHack-$(SVS)-macosx-qt.dmg
325 endif # end of build_qt_pkg
326 endif # WANT_WIN_QT for packaging