OSDN Git Service

upgrade to 3.6.2
[jnethack/source.git] / sys / unix / hints / macosx10.8
1 #
2 # NetHack 3.6  macosx10.8 $NHDT-Date: 1546220385 2018/12/31 01:39:45 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $
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 -Wno-long-long
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 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
105 VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
106 POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; (cd $(INSTDIR); mkfontdir);
107 # separate from CFLAGS so that we don't pass it to every file
108 X11CFLAGS = -I/opt/X11/include
109 CFLAGS += -DX11_GRAPHICS
110 # avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
111 X11CFLAGS += -Wno-variadic-macros
112 ifdef USE_XPM
113 CFLAGS += -DUSE_XPM
114 WINX11LIB += -lXpm
115 VARDATND += rip.xpm
116 endif
117 WINSRC += $(WINX11SRC)
118 WINOBJ += $(WINX11OBJ)
119 WINLIB += $(WINX11LIB)
120 LFLAGS=-L/opt/X11/lib
121 endif   # WANT_WIN_X11
122
123 ifdef WANT_WIN_QT
124 CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
125 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
126 LINK=g++
127 WINSRC += $(WINQTSRC)
128 WINLIB += $(WINQTLIB) $(LIBXPM)
129 WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL
130 WINLIB += -framework AGL
131 ifdef WANT_WIN_X11
132         # prevent duplicate tile.o in WINOBJ
133 WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
134 ifdef WANT_WIN_TTY
135 WINOBJ += $(WINTTYOBJ)
136 endif   # WANT_WIN_TTY
137 else    # !WANT_WIN_X11
138 WINOBJ += $(WINQTOBJ)
139 endif   # !WANT_WIN_X11
140
141 # XXX if /Developer/qt exists and QTDIR not set, use that
142 ifndef QTDIR
143 $(error QTDIR not defined in the environment or Makefile)
144 endif   # QTDIR
145 # XXX make sure QTDIR points to something reasonable
146 else    # !WANT_WIN_QT
147 LINK=$(CC)
148 endif   # !WANT_WIN_QT
149
150 ifdef WANT_SHARE_INSTALL
151 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
152 # we install into ~/nethackdir
153 ifeq ($(GAMEUID),root)
154 PREFIX:=/Library/NetHack
155 SHELLDIR=/usr/local/bin
156 HACKDIR=$(PREFIX)/nethackdir
157 INSTDIR=$(HACKDIR)
158 VARDIR=$(HACKDIR)
159 CHOWN=chown
160 CHGRP=chgrp
161 # We run sgid so the game has access to both HACKDIR and user preferences.
162 GAMEPERM = 02755
163 else    # ! root
164 PREFIX:=/Users/$(GAMEUID)
165 SHELLDIR=$(PREFIX)/bin
166 HACKDIR=$(PREFIX)/nethackdir
167 INSTDIR=$(HACKDIR)
168 VARDIR=$(HACKDIR)
169 CHOWN=/usr/bin/true
170 CHGRP=/usr/bin/true
171 GAMEPERM = 0500
172 endif   # ! root
173 VARFILEPERM = 0664
174 VARDIRPERM = 0775
175 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
176 # XXX it's nice we don't write over sysconf, but we've already erased it
177 # make sure we have group GAMEUID and group GAMEGRP
178 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
179 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
180 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
181 else ifdef WANT_SOURCE_INSTALL
182 PREFIX=$(abspath $(NHSROOT))
183 # suppress nethack.sh
184 #SHELLDIR=
185 HACKDIR=$(PREFIX)/playground
186 INSTDIR=$(HACKDIR)
187 VARDIR=$(HACKDIR)
188 CHOWN=/usr/bin/true
189 CHGRP=/usr/bin/true
190 GAMEPERM = 0700
191 VARFILEPERM = 0600
192 VARDIRPERM = 0700
193 # We can use "make all" to build the whole thing - but it misses some things:
194 MOREALL=$(MAKE) install
195 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
196 else    # !WANT_SOURCE_INSTALL
197 PREFIX:=$(wildcard ~)
198 SHELLDIR=$(PREFIX)/bin
199 HACKDIR=$(PREFIX)/nethackdir
200 INSTDIR=$(HACKDIR)
201 VARDIR=$(HACKDIR)
202 CHOWN=/usr/bin/true
203 CHGRP=/usr/bin/true
204 GAMEPERM = 0700
205 VARFILEPERM = 0600
206 VARDIRPERM = 0700
207 ifdef WANT_WIN_X11
208 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
209 PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
210 endif   # WANT_WIN_X11
211 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
212 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
213 endif   # !WANT_SOURCE_INSTALL
214
215
216 # ~/Library/Preferences/NetHack Defaults
217 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
218 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
219 #
220 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
221 # package under the docs directory).
222
223 #-POST
224 ifdef MAKEFILE_TOP
225 ###
226 ### Packaging
227 ###
228 # Notes:
229 # 1) The Apple developer utilities must be installed in the default location.
230 # 2) Do a normal build before trying to package the game.
231 # 3) This matches the 3.4.3 Term package, but there are some things that should
232 #    be changed.
233
234 ifdef WANT_WIN_TTY
235 DEVUTIL=/Developer/Applications/Utilities
236 PKGR=$(DEVUTIL)/PackageMaker.app/Contents/MacOS/PackageMaker
237 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
238 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
239
240 PKGROOT_UG      = PKGROOT/usr/games
241 PKGROOT_UGLN    = PKGROOT/usr/games/lib/nethackdir
242 build_tty_pkg:
243 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
244         -echo build_tty_pkg only works for a tty-only build
245         exit 1
246 else
247         rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
248         $(MAKE) build_package_root
249         rm -rf RESOURCES
250         mkdir RESOURCES
251         #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
252         sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
253         sys/unix/hints/macosx.sh infoplist > Info.plist
254
255         mkdir PKGROOT/Applications
256         #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
257         #        win/macosx/NetHackRecover.applescript
258         #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
259         osacompile -o PKGROOT/Applications/NetHackRecover.app \
260                  win/macosx/NetHackRecover.applescript
261         cp win/macosx/recover.pl $(PKGROOT_UGLN)
262
263         osacompile -o PKGROOT/Applications/NetHackTerm.app \
264                  win/macosx/NetHackTerm.applescript
265
266         # XXX integrate into Makefile.doc
267         (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
268         | tbl tmac.n - | groff |ps2pdf - > Guidebook.pdf)
269         cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf
270
271         osacompile -o PKGROOT/Applications/NetHackGuidebook.app \
272                  win/macosx/NetHackGuidebook.applescript
273
274         $(PKGR) --root PKGROOT --info Info.plist -e RESOURCES -v -o NetHack-$(SVS)-mac-Term.pkg
275         hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
276
277 build_package_root:
278         cd src/..       # make sure we are at TOP
279         rm -rf PKGROOT
280         mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_UG)/bin $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
281         install -p src/nethack $(PKGROOT_UG)/bin
282         # XXX should this be called nethackrecover?
283         install -p util/recover $(PKGROOT_UG)/bin
284         install -p doc/nethack.6 $(PKGROOT_UG)/man/man6
285         install -p doc/recover.6 $(PKGROOT_UG)/man/man6
286         install -p doc/Guidebook $(PKGROOT_UG)/doc
287         install -p dat/nhdat $(PKGROOT_UGLN)
288         cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
289 # XXX these files should be somewhere else for good Mac form
290         touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile
291 # XXX may need postinstall script to get perms right for sgid, etc.
292         mkdir $(PKGROOT_UGLN)/save
293 # XXX what about a news file?
294 endif   # end of build_tty_pkg
295 endif   # WANT_WIN_TTY for packaging
296
297 ifdef WANT_WIN_QT
298 # XXX untested and incomplete (see below)
299 build_qt_pkg:
300 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
301         -echo build_qt_pkg only works for a qt-only build
302         exit 1
303 else
304         $(MAKE) build_package_root
305         rm -rf NetHackQt
306         mkdir -p NetHackQt/NetHackQt.app/nethackdir/save
307         mkdir NetHackQt/Documentation
308         cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation
309
310         osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
311                  win/macosx/NetHackRecover.applescript
312         cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
313
314         mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks
315         cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks
316
317         mkdir NetHackQt/NetHackQt.app/Contents/MacOS
318         mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS
319
320         mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir
321
322 # XXX still missing:
323 #NetHackQt/NetHackQt.app
324 # /Contents
325 #       Info.plist
326 #       Resources/nethack.icns
327 #NetHackQt/Documentation
328 #NetHackQtRecover.txt
329 #NetHack Defaults.txt
330 #changes.patch XXX is this still needed?  why isn't it part of the tree?
331 #  doesn't go here
332         hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg
333 endif   # end of build_qt_pkg
334 endif   # WANT_WIN_QT for packaging
335 endif   # MAKEFILE_TOP