OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / sys / unix / hints / macosx10.8
1 #
2 # NetHack 3.6  macosx10.8 $NHDT-Date: 1455397109 2016/02/13 20:58:29 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2009.
4 # NetHack may be freely redistributed.  See license for details.
5 #
6 #-PRE
7 # Mac OS X (Darwin) hints file
8 # This is for Mac OS X 10.8, Mountain Lion.
9 #
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.
14 #
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
19
20 # This hints file can build several different types of installations.
21 # Edit the next section to match the type of build you need.
22
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
27
28 # 1a. What is the default window system?
29 WANT_DEFAULT=tty
30 #WANT_DEFAULT=x11
31 #WANT_DEFAULT=qt
32
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
42
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 #         NetHack
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
61
62 CC=gcc
63
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
67
68 #
69 # You shouldn't need to change anything below here.
70 #
71
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
77
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
84
85 CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
86 CFLAGS+= -DGDBPATH=\"/Developer/usr/bin/gdb\"
87
88 ifdef WANT_WIN_CHAIN
89 CFLAGS+= -DWINCHAIN
90 HINTSRC=$(CHAINSRC)
91 HINTOBJ=$(CHAINOBJ)
92 endif
93
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
102
103 ifdef WANT_WIN_X11
104 WINSRC += $(WINX11SRC)
105 WINOBJ += $(WINX11OBJ)
106 WINLIB += $(WINX11LIB)
107 LFLAGS=-L/opt/X11/lib
108 VARDATND = x11tiles NetHack.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
114
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
132
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
141
142 ifdef WANT_SHARE_INSTALL
143 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
144 # we install into ~/nethackdir
145 ifeq ($(GAMEUID),root)
146 PREFIX:=/Library/NetHack
147 SHELLDIR=/usr/local/bin
148 HACKDIR=$(PREFIX)/nethackdir
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)/nethackdir
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 nethack.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)/nethackdir
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 nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
201 PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
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
206
207
208 # ~/Library/Preferences/NetHack Defaults
209 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
210 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
211 #
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).
214
215 #-POST
216 ifdef MAKEFILE_TOP
217 ###
218 ### Packaging
219 ###
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.
225
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 .)
231
232 PKGROOT_UG      = PKGROOT/usr/games
233 PKGROOT_UGLN    = PKGROOT/usr/games/lib/nethackdir
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 NetHack-$(SVS)-mac-Term.pkg NetHack-$(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
246
247         mkdir PKGROOT/Applications
248         #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
249         #        win/macosx/NetHackRecover.applescript
250         #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
251         osacompile -o PKGROOT/Applications/NetHackRecover.app \
252                  win/macosx/NetHackRecover.applescript
253         cp win/macosx/recover.pl $(PKGROOT_UGLN)
254
255         osacompile -o PKGROOT/Applications/NetHackTerm.app \
256                  win/macosx/NetHackTerm.applescript
257
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/NetHackGuidebook.pdf
262
263         osacompile -o PKGROOT/Applications/NetHackGuidebook.app \
264                  win/macosx/NetHackGuidebook.applescript
265
266         $(PKGR) --root PKGROOT --info Info.plist -e RESOURCES -v -o NetHack-$(SVS)-mac-Term.pkg
267         hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
268
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/nethack $(PKGROOT_UG)/bin
274         # XXX should this be called nethackrecover?
275         install -p util/recover $(PKGROOT_UG)/bin
276         install -p doc/nethack.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/nhdat $(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
288
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 NetHackQt
298         mkdir -p NetHackQt/NetHackQt.app/nethackdir/save
299         mkdir NetHackQt/Documentation
300         cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation
301
302         osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
303                  win/macosx/NetHackRecover.applescript
304         cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
305
306         mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks
307         cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks
308
309         mkdir NetHackQt/NetHackQt.app/Contents/MacOS
310         mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS
311
312         mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir
313
314 # XXX still missing:
315 #NetHackQt/NetHackQt.app
316 # /Contents
317 #       Info.plist
318 #       Resources/nethack.icns
319 #NetHackQt/Documentation
320 #NetHackQtRecover.txt
321 #NetHack 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 NetHackQt NetHack-$(SVS)-macosx-qt.dmg
325 endif   # end of build_qt_pkg
326 endif   # WANT_WIN_QT for packaging
327 endif   # MAKEFILE_TOP