NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / unix / hints / macosx10.8
blob4d1dbb3adaacbbc101cb53e6fd4da8bbefed4296
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.
6 #-PRE
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?
24 WANT_WIN_TTY=1
25 #WANT_WIN_X11=1
26 #WANT_WIN_QT=1
28 # 1a. What is the default window system?
29 WANT_DEFAULT=tty
30 #WANT_DEFAULT=x11
31 #WANT_DEFAULT=qt
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
38 ifdef WANT_WIN_QT
39 QTDIR=/Developer/Qt
40 LIBXPM= -L/opt/X11/lib -lXpm
41 endif   # WANT_WIN_QT
43 # 2. Is this a build for a binary that will be shared among different users
44 #    or will it be private to you?
45 #    If it is shared:
46 #       - it will be owned by the user and group listed
47 #       - if the user does not exist, you MUST create it before installing
48 #         aNetHack
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"
56 #WANT_SHARE_INSTALL=1
57 GAMEUID  = $(USER)
58 GAMEGRP  = games
59 # build to run in the source tree - primarily for development.  Build with "make all"
60 #WANT_SOURCE_INSTALL=1
62 CC=gcc
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.
66 #WANT_WIN_CHAIN=1
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
81 #CFLAGS+=-DNOCLIPPING
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\"
88 ifdef WANT_WIN_CHAIN
89 CFLAGS+= -DWINCHAIN
90 HINTSRC=$(CHAINSRC)
91 HINTOBJ=$(CHAINOBJ)
92 endif
94 ifdef WANT_WIN_TTY
95 WINSRC = $(WINTTYSRC)
96 WINOBJ = $(WINTTYOBJ)
97 WINLIB = $(WINTTYLIB)
98 WINTTYLIB=-lncurses
99 else    # !WANT_WIN_TTY
100 CFLAGS += -DNOTTYGRAPHICS
101 endif   # !WANT_WIN_TTY
103 ifdef WANT_WIN_X11
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
113 endif   # WANT_WIN_X11
115 ifdef WANT_WIN_QT
116 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
117 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
118 LINK=g++
119 WINSRC += $(WINQTSRC)
120 WINLIB += $(WINQTLIB) $(LIBXPM)
121 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
122 WINLIB += -framework AGL
123 ifdef WANT_WIN_X11
124         # prevent duplicate tile.o in WINOBJ
125 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
126 ifdef WANT_WIN_TTY
127 WINOBJ += $(WINTTYOBJ)
128 endif   # WANT_WIN_TTY
129 else    # !WANT_WIN_X11
130 WINOBJ += $(WINQTOBJ)
131 endif   # !WANT_WIN_X11
133 # XXX if /Developer/qt exists and QTDIR not set, use that
134 ifndef QTDIR
135 $(error QTDIR not defined in the environment or Makefile)
136 endif   # QTDIR
137 # XXX make sure QTDIR points to something reasonable
138 else    # !WANT_WIN_QT
139 LINK=$(CC)
140 endif   # !WANT_WIN_QT
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
149 INSTDIR=$(HACKDIR)
150 VARDIR=$(HACKDIR)
151 CHOWN=chown
152 CHGRP=chgrp
153 # We run sgid so the game has access to both HACKDIR and user preferences.
154 GAMEPERM = 02755
155 else    # ! root
156 PREFIX:=/Users/$(GAMEUID)
157 SHELLDIR=$(PREFIX)/bin
158 HACKDIR=$(PREFIX)/aanethackdir
159 INSTDIR=$(HACKDIR)
160 VARDIR=$(HACKDIR)
161 CHOWN=/usr/bin/true
162 CHGRP=/usr/bin/true
163 GAMEPERM = 0500
164 endif   # ! root
165 VARFILEPERM = 0664
166 VARDIRPERM = 0775
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
176 #SHELLDIR=
177 HACKDIR=$(PREFIX)/playground
178 INSTDIR=$(HACKDIR)
179 VARDIR=$(HACKDIR)
180 CHOWN=/usr/bin/true
181 CHGRP=/usr/bin/true
182 GAMEPERM = 0700
183 VARFILEPERM = 0600
184 VARDIRPERM = 0700
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
192 INSTDIR=$(HACKDIR)
193 VARDIR=$(HACKDIR)
194 CHOWN=/usr/bin/true
195 CHGRP=/usr/bin/true
196 GAMEPERM = 0700
197 VARFILEPERM = 0600
198 VARDIRPERM = 0700
199 ifdef WANT_WIN_X11
200 # install aanethack.rc as ~/.aanethackrc if no ~/.aanethackrc exists
201 PREINSTALL= cp -n win/X11/aanethack.rc ~/.aanethackrc
202 endif   # WANT_WIN_X11
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).
215 #-POST
216 ifdef MAKEFILE_TOP
218 ### Packaging
220 # Notes:
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
224 #    be changed.
226 ifdef WANT_WIN_TTY
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
234 build_tty_pkg:
235 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
236         -echo build_tty_pkg only works for a tty-only build
237         exit 1
238 else
239         rm -rf aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
240         $(MAKE) build_package_root
241         rm -rf RESOURCES
242         mkdir RESOURCES
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
269 build_package_root:
270         cd src/..       # make sure we are at TOP
271         rm -rf PKGROOT
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
289 ifdef WANT_WIN_QT
290 # XXX untested and incomplete (see below)
291 build_qt_pkg:
292 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
293         -echo build_qt_pkg only works for a qt-only build
294         exit 1
295 else
296         $(MAKE) build_package_root
297         rm -rf aNetHackQt
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
314 # XXX still missing:
315 #aNetHackQt/aNetHackQt.app
316 # /Contents
317 #       Info.plist
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?
323 #  doesn't go here
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
327 endif   # MAKEFILE_TOP