NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / unix / hints / macosx10.7
blob9d7f10a29fe68f938c856456107569e425f1cef0
2 # aNetHack 0.0.1  macosx10.7 $ANH-Date: 1447844589 2015/11/18 11:03:09 $  $ANH-Branch: master $:$ANH-Revision: 1.31 $
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.7.2.  If this doesn't work for some other version
9 # of Mac OS X, make a new file for that OS, don't change this one.  And
10 # let us know about it.
11 # Useful info: http://www.opensource.apple.com/darwinsource/index.html
13 # This hints file can build several different types of installations.
14 # Edit the next section to match the type of build you need.
16 # 1. Which window system(s) should be included in this binary?
17 WANT_WIN_TTY=1
18 #WANT_WIN_X11=1
19 #WANT_WIN_QT=1
21 # 1a. What is the default window system?
22 WANT_DEFAULT=tty
23 #WANT_DEFAULT=x11
24 #WANT_DEFAULT=qt
26 # 1b. If you set WANT_WIN_QT, you need to
27 #  A) set QTDIR either here or in the environment to point to the Qt2 or Qt3
28 #     library installation root.  (Qt4 will not work; Qt3 does not presently
29 #     compile under Leopard (MacOSX 10.5) out-of-the-box.)
30 #  B) set XPMLIB to point to the Xpm library
31 ifdef WANT_WIN_QT
32 QTDIR=/Developer/Qt
33 LIBXPM= -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/X11R6/lib -lXpm
34 endif   # WANT_WIN_QT
36 # 2. Is this a build for a binary that will be shared among different users
37 #    or will it be private to you?
38 #    If it is shared:
39 #       - it will be owned by the user and group listed
40 #       - if the user does not exist, you MUST create it before installing
41 #         aNetHack
42 #       - if the group does not exist, it will be created.
43 #         NB: if the group already exists and is being used for something
44 #          besides games, you probably want to specify a new group instead
45 #         NB: the group will be created locally; if your computer is centrally
46 #          administered this may not be what you (or your admin) want.
47 #          Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
48 #       - 'make install' must be run as "sudo make install"    
49 #WANT_SHARE_INSTALL=1
50 GAMEUID  = $(USER)
51 GAMEGRP  = games
52 # build to run in the source tree - primarily for development.  Build with "make all"
53 #WANT_SOURCE_INSTALL=1
55 CC=gcc
57 # At the moment this is just for debugging, but in the future it could be
58 # useful for other things.  Requires SYSCF and an ANSI compiler.
59 #WANT_WIN_CHAIN=1
62 # You shouldn't need to change anything below here.
65 #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
66 CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic
67 # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
68 # leave it out by default.
69 #CFLAGS+=-Wunreachable-code
71 # XXX -g vs -O should go here, -I../include goes in the makefile
72 CFLAGS+=-g -I../include
73 # older binaries use NOCLIPPING, but that disables SIGWINCH
74 #CFLAGS+=-DNOCLIPPING
75 CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
76 CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
78 CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
80 ifdef WANT_WIN_CHAIN
81 CFLAGS+= -DWINCHAIN
82 HINTSRC=$(CHAINSRC)
83 HINTOBJ=$(CHAINOBJ)
84 endif
86 ifdef WANT_WIN_TTY
87 WINSRC = $(WINTTYSRC)
88 WINOBJ = $(WINTTYOBJ)
89 WINLIB = $(WINTTYLIB)
90 WINTTYLIB=-lncurses
91 else    # !WANT_WIN_TTY
92 CFLAGS += -DNOTTYGRAPHICS
93 endif   # !WANT_WIN_TTY
95 ifdef WANT_WIN_X11
96 WINSRC += $(WINX11SRC)
97 WINOBJ += $(WINX11OBJ)
98 WINLIB += $(WINX11LIB)
99 LFLAGS=-L/usr/X11R6/lib
100 VARDATND = x11tiles aNetHack.ad pet_mark.xbm pilemark.xbm
101 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir);
102 CFLAGS += -DX11_GRAPHICS
103 endif   # WANT_WIN_X11
105 ifdef WANT_WIN_QT
106 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
107 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
108 LINK=g++
109 WINSRC += $(WINQTSRC)
110 WINLIB += $(WINQTLIB) $(LIBXPM)
111 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
112 WINLIB += -framework AGL
113 ifdef WANT_WIN_X11
114         # prevent duplicate tile.o in WINOBJ
115 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
116 ifdef WANT_WIN_TTY
117 WINOBJ += $(WINTTYOBJ)
118 endif   # WANT_WIN_TTY
119 else    # !WANT_WIN_X11
120 WINOBJ += $(WINQTOBJ)
121 endif   # !WANT_WIN_X11
123 # XXX if /Developer/qt exists and QTDIR not set, use that
124 ifndef QTDIR
125 $(error QTDIR not defined in the environment or Makefile)
126 endif   # QTDIR
127 # XXX make sure QTDIR points to something reasonable
128 else    # !WANT_WIN_QT
129 LINK=$(CC)
130 endif   # !WANT_WIN_QT
132 ifdef WANT_SHARE_INSTALL
133 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
134 # we install into ~/aanethackdir
135 ifeq ($(GAMEUID),root)
136 PREFIX:=/Library/aNetHack
137 SHELLDIR=/usr/local/bin
138 HACKDIR=$(PREFIX)/aanethackdir
139 INSTDIR=$(HACKDIR)
140 VARDIR=$(HACKDIR)
141 CHOWN=chown
142 CHGRP=chgrp
143 # We run sgid so the game has access to both HACKDIR and user preferences.
144 GAMEPERM = 02755
145 else    # ! root
146 PREFIX:=/Users/$(GAMEUID)
147 SHELLDIR=$(PREFIX)/bin
148 HACKDIR=$(PREFIX)/aanethackdir
149 INSTDIR=$(HACKDIR)
150 VARDIR=$(HACKDIR)
151 CHOWN=/usr/bin/true
152 CHGRP=/usr/bin/true
153 GAMEPERM = 0500
154 endif   # ! root
155 VARFILEPERM = 0664
156 VARDIRPERM = 0775
157 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
158 # XXX it's nice we don't write over sysconf, but we've already erased it
159 # make sure we have group GAMEUID and group GAMEGRP
160 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
161 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
162 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
163 else ifdef WANT_SOURCE_INSTALL
164 PREFIX=$(abspath $(NHSROOT))
165 # suppress aanethack.sh
166 #SHELLDIR=
167 HACKDIR=$(PREFIX)/playground
168 INSTDIR=$(HACKDIR)
169 VARDIR=$(HACKDIR)
170 CHOWN=/usr/bin/true
171 CHGRP=/usr/bin/true
172 GAMEPERM = 0700
173 VARFILEPERM = 0600
174 VARDIRPERM = 0700
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
182 INSTDIR=$(HACKDIR)
183 VARDIR=$(HACKDIR)
184 CHOWN=/usr/bin/true
185 CHGRP=/usr/bin/true
186 GAMEPERM = 0700
187 VARFILEPERM = 0600
188 VARDIRPERM = 0700
189 ifdef WANT_WIN_X11
190 # install aanethack.rc as ~/.aanethackrc if no ~/.aanethackrc exists
191 PREINSTALL= cp -n win/X11/aanethack.rc ~/.aanethackrc
192 endif   # WANT_WIN_X11
193 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
194 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
195 endif   # !WANT_SOURCE_INSTALL
198 # ~/Library/Preferences/aNetHack Defaults
199 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
200 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
202 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
203 # package under the docs directory).
205 #-POST
206 ifdef MAKEFILE_TOP
208 ### Packaging
210 # Notes:
211 # 1) The Apple developer utilities must be installed in the default location.
212 # 2) Do a normal build before trying to package the game.
213 # 3) This matches the 3.4.3 Term package, but there are some things that should
214 #    be changed.
216 ifdef WANT_WIN_TTY
217 DEVUTIL=/Developer/Applications/Utilities
218 PKGR=$(DEVUTIL)/PackageMaker.app/Contents/MacOS/PackageMaker
219 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
220 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
222 PKGROOT_UG      = PKGROOT/usr/games
223 PKGROOT_UGLN    = PKGROOT/usr/games/lib/aanethackdir
224 build_tty_pkg:
225 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
226         -echo build_tty_pkg only works for a tty-only build
227         exit 1
228 else
229         rm -rf aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
230         $(MAKE) build_package_root
231         rm -rf RESOURCES
232         mkdir RESOURCES
233         #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
234         sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
235         sys/unix/hints/macosx.sh infoplist > Info.plist
237         mkdir PKGROOT/Applications
238         #osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aNetHackRecover.app \
239         #        win/macosx/aNetHackRecover.applescript
240         #cp win/macosx/recover.pl aNetHackQt/aNetHackQt.app/aanethackdir
241         osacompile -o PKGROOT/Applications/aNetHackRecover.app \
242                  win/macosx/aNetHackRecover.applescript
243         cp win/macosx/recover.pl $(PKGROOT_UGLN)
245         osacompile -o PKGROOT/Applications/aNetHackTerm.app \
246                  win/macosx/aNetHackTerm.applescript
248         # XXX integrate into Makefile.doc
249         (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
250         | tbl tmac.n - | groff |ps2pdf - > Guidebook.pdf)
251         cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/aNetHackGuidebook.pdf
253         osacompile -o PKGROOT/Applications/aNetHackGuidebook.app \
254                  win/macosx/aNetHackGuidebook.applescript
256         $(PKGR) --root PKGROOT --info Info.plist -e RESOURCES -v -o aNetHack-$(SVS)-mac-Term.pkg
257         hdiutil create -verbose -srcfolder aNetHack-$(SVS)-mac-Term.pkg aNetHack-$(SVS)-mac-Term.dmg
259 build_package_root:
260         cd src/..       # make sure we are at TOP
261         rm -rf PKGROOT
262         mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_UG)/bin $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
263         install -p src/aanethack $(PKGROOT_UG)/bin
264         # XXX should this be called aanethackrecover?
265         install -p util/recover $(PKGROOT_UG)/bin
266         install -p doc/aanethack.6 $(PKGROOT_UG)/man/man6
267         install -p doc/recover.6 $(PKGROOT_UG)/man/man6
268         install -p doc/Guidebook $(PKGROOT_UG)/doc
269         install -p dat/anhdat $(PKGROOT_UGLN)
270         cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
271 # XXX these files should be somewhere else for good Mac form
272         touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile
273 # XXX may need postinstall script to get perms right for sgid, etc.
274         mkdir $(PKGROOT_UGLN)/save
275 # XXX what about a news file?
276 endif   # end of build_tty_pkg
277 endif   # WANT_WIN_TTY for packaging
279 ifdef WANT_WIN_QT
280 # XXX untested and incomplete (see below)
281 build_qt_pkg:
282 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
283         -echo build_qt_pkg only works for a qt-only build
284         exit 1
285 else
286         $(MAKE) build_package_root
287         rm -rf aNetHackQt
288         mkdir -p aNetHackQt/aNetHackQt.app/aanethackdir/save
289         mkdir aNetHackQt/Documentation
290         cp doc/Guidebook.txt doc/aanethack.txt doc/recover.txt aNetHackQt/Documentation
292         osacompile -o aNetHackQt/aNetHackQt.app/aanethackdir/aNetHackRecover.app \
293                  win/macosx/aNetHackRecover.applescript
294         cp win/macosx/recover.pl aNetHackQt/aNetHackQt.app/aanethackdir
296         mkdir -p aNetHackQt/aNetHackQt.app/Contents/Frameworks
297         cp $(QTDIR)/libqt-mt.3.dylib aNetHackQt/aNetHackQt.app/Contents/Frameworks
299         mkdir aNetHackQt/aNetHackQt.app/Contents/MacOS
300         mv PKGROOT/aanethack aNetHackQt/aNetHackQt.app/Contents/MacOS
302         mv PKGROOT/lib/aanethackdir aNetHackQt/aNetHackQt.app/aanethackdir
304 # XXX still missing:
305 #aNetHackQt/aNetHackQt.app
306 # /Contents
307 #       Info.plist
308 #       Resources/aanethack.icns
309 #aNetHackQt/Documentation
310 #aNetHackQtRecover.txt
311 #aNetHack Defaults.txt
312 #changes.patch XXX is this still needed?  why isn't it part of the tree?
313 #  doesn't go here
314         hdiutil create -verbose -srcfolder aNetHackQt aNetHack-$(SVS)-macosx-qt.dmg
315 endif   # end of build_qt_pkg
316 endif   # WANT_WIN_QT for packaging
317 endif   # MAKEFILE_TOP