OSDN Git Service

upgrade to 3.6.2
[jnethack/source.git] / sys / unix / hints / macosx10.10-qt
1 #
2 # NetHack 3.6  macosx10.11 $NHDT-Date: 1515549543 2018/01/10 01:59:03 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $
3 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015.
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.10 or later, and has been tested on 10.11
9 # (El Capitan). If this doesn't work for some other
10 # version of Mac OS X, make a new file for that OS, don't change this one.
11 # And let us know about it.
12 # Useful info: http://www.opensource.apple.com/darwinsource/index.html
13
14 # You'll need to obtain and install XQuartz if you want X11 support.
15 # (Attempting to run X11.app will describe where to get it.)
16
17 # This hints file can build several different types of installations.
18 # Edit the next section to match the type of build you need.
19
20 # 1. Which window system(s) should be included in this binary?
21 WANT_WIN_TTY=1
22 #WANT_WIN_X11=1
23 WANT_WIN_QT=1
24
25 # 1a. What is the default window system?
26 #WANT_DEFAULT=tty
27 #WANT_DEFAULT=x11
28 WANT_DEFAULT=Qt
29
30 # 1b. If you set WANT_WIN_QT, you need to
31 #  A) set QTDIR either here or in the environment to point to the Qt5
32 #     library installation root.  (Qt2 or Qt3 will not work.)
33 ifdef WANT_WIN_QT
34 QTDIR=$(shell brew --prefix)/opt/qt
35 endif   # WANT_WIN_QT
36
37 # 2. Is this a build for a binary that will be shared among different users
38 #    or will it be private to you?
39 #    If it is shared:
40 #       - it will be owned by the user and group listed
41 #       - if the user does not exist, you MUST create it before installing
42 #         NetHack
43 #       - if the group does not exist, it will be created.
44 #         NB: if the group already exists and is being used for something
45 #          besides games, you probably want to specify a new group instead
46 #         NB: the group will be created locally; if your computer is centrally
47 #          administered this may not be what you (or your admin) want.
48 #          Consider a non-shared install (WANT_SHARE_INSTALL=0) instead.
49 #       - 'make install' must be run as "sudo make install"
50 #WANT_SHARE_INSTALL=1
51 GAMEUID  = $(USER)
52 GAMEGRP  = games
53 # build to run in the source tree - primarily for development.  Build with "make all"
54 #WANT_SOURCE_INSTALL=1
55
56 CC=clang
57 CXX=clang++ -std=gnu++11
58
59 # At the moment this is just for debugging, but in the future it could be
60 # useful for other things.  Requires SYSCF and an ANSI compiler.
61 #WANT_WIN_CHAIN=1
62
63 #
64 # You shouldn't need to change anything below here.
65 #
66
67 #CFLAGS+=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
68 CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN
69 # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
70 # leave it out by default.
71 #CFLAGS+=-Wunreachable-code
72
73 # XXX -g vs -O should go here, -I../include goes in the makefile
74 CFLAGS+=-g -I../include
75 # older binaries use NOCLIPPING, but that disables SIGWINCH
76 #CFLAGS+=-DNOCLIPPING
77 CFLAGS+= -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
78 CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
79
80 CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
81
82 ifdef WANT_WIN_CHAIN
83 CFLAGS+= -DWINCHAIN
84 HINTSRC=$(CHAINSRC)
85 HINTOBJ=$(CHAINOBJ)
86 endif
87
88 WINSRC =
89 WINOBJ0 =
90 WINLIB =
91 LINK = $(CC)
92 VARDATND =
93
94 ifdef WANT_WIN_TTY
95 WINSRC += $(WINTTYSRC)
96 WINOBJ0 += $(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 WINOBJ0 += $(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 > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); 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 += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
118 WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
119 LINK=$(CXX)
120 WINSRC += $(WINQT4SRC)
121 WINOBJ0 += $(WINQT4OBJ)
122 VARDATND += rip.xpm
123 MOC = moc
124
125 # XXX if /Developer/qt exists and QTDIR not set, use that
126 ifndef QTDIR
127 $(error QTDIR not defined in the environment or Makefile)
128 endif   # QTDIR
129 # XXX make sure QTDIR points to something reasonable
130 endif   # WANT_WIN_QT
131
132 # prevent duplicate tile.o in WINOBJ
133 WINOBJ = $(sort $(WINOBJ0))
134
135 ifdef WANT_SHARE_INSTALL
136 # if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
137 # we install into ~/nethackdir
138 ifeq ($(GAMEUID),root)
139 PREFIX:=/Library/NetHack
140 SHELLDIR=/usr/local/bin
141 HACKDIR=$(PREFIX)/nethackdir
142 CHOWN=chown
143 CHGRP=chgrp
144 # We run sgid so the game has access to both HACKDIR and user preferences.
145 GAMEPERM = 02755
146 else    # ! root
147 PREFIX:=/Users/$(GAMEUID)
148 SHELLDIR=$(PREFIX)/bin
149 HACKDIR=$(PREFIX)/Library/NetHack/nethackdir
150 CHOWN=/usr/bin/true
151 CHGRP=/usr/bin/true
152 GAMEPERM = 0500
153 endif   # ! root
154 VARFILEPERM = 0664
155 VARDIRPERM = 0775
156 ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
157 # XXX it's nice we don't write over sysconf, but we've already erased it
158 # make sure we have group GAMEUID and group GAMEGRP
159 PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
160 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
161 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
162 else ifdef WANT_SOURCE_INSTALL
163 PREFIX=$(abspath $(NHSROOT))
164 # suppress nethack.sh
165 #SHELLDIR=
166 HACKDIR=$(PREFIX)/playground
167 CHOWN=/usr/bin/true
168 CHGRP=/usr/bin/true
169 GAMEPERM = 0700
170 VARFILEPERM = 0600
171 VARDIRPERM = 0700
172 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf;
173 # We can use "make all" to build the whole thing - but it misses some things:
174 MOREALL=$(MAKE) install
175 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
176 else    # !WANT_SOURCE_INSTALL
177 PREFIX:=$(wildcard ~)
178 SHELLDIR=$(PREFIX)/bin
179 HACKDIR=$(PREFIX)/nethackdir
180 CHOWN=/usr/bin/true
181 CHGRP=/usr/bin/true
182 GAMEPERM = 0700
183 VARFILEPERM = 0600
184 VARDIRPERM = 0700
185 ifdef WANT_WIN_X11
186 # install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
187 PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
188 endif   # WANT_WIN_X11
189 POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
190 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
191 endif   # !WANT_SOURCE_INSTALL
192
193 INSTDIR=$(HACKDIR)
194 VARDIR=$(HACKDIR)
195
196
197 # ~/Library/Preferences/NetHack Defaults
198 # OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
199 # OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
200 #
201 # Install.Qt mentions a patch for macos - it's not there (it seems to be in the Qt binary
202 # package under the docs directory).
203
204 #-POST
205 ifdef MAKEFILE_TOP
206 ###
207 ### Packaging
208 ###
209 # Notes:
210 # 1) The Apple developer utilities must be installed in the default location.
211 # 2) Do a normal build before trying to package the game.
212 # 3) This matches the 3.4.3 Term package, but there are some things that should
213 #    be changed.
214
215 ifdef WANT_WIN_TTY
216 DEVUTIL=/Developer/Applications/Utilities
217 SVS=$(shell $(NHSROOT)/util/makedefs --svs)
218 SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
219
220 PKGROOT_UG      = PKGROOT/$(PREFIX)
221 PKGROOT_UGLN    = PKGROOT/$(HACKDIR)
222 PKGROOT_BIN     = PKGROOT/$(SHELLDIR)
223 build_tty_pkg:
224 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
225         -echo build_tty_pkg only works for a tty-only build
226         exit 1
227 else
228         rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
229         $(MAKE) build_package_root
230         rm -rf RESOURCES
231         mkdir RESOURCES
232         #enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
233         sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
234         sys/unix/hints/macosx.sh infoplist > Info.plist
235
236         mkdir PKGROOT/Applications
237         #osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
238         #        win/macosx/NetHackRecover.applescript
239         #cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
240         osacompile -o PKGROOT/Applications/NetHackRecover.app \
241                  win/macosx/NetHackRecover.applescript
242         cp win/macosx/recover.pl $(PKGROOT_UGLN)
243
244         osacompile -o PKGROOT/Applications/NetHackTerm.app \
245                  win/macosx/NetHackTerm.applescript
246
247         # XXX integrate into Makefile.doc
248         (cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
249         | tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf)
250         cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf
251
252         osacompile -o PKGROOT/Applications/NetHackGuidebook.app \
253                  win/macosx/NetHackGuidebook.applescript
254
255         mkdir -p PKG
256         pkgbuild --root PKGROOT --identifier org.nethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg
257         productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml
258         productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG NetHack-$(SVS)-mac-Term.pkg
259         hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
260
261 build_package_root:
262         cd src/..       # make sure we are at TOP
263         rm -rf PKGROOT
264         mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
265         install -p src/nethack $(PKGROOT_BIN)
266         # XXX should this be called nethackrecover?
267         install -p util/recover $(PKGROOT_BIN)
268         install -p doc/nethack.6 $(PKGROOT_UG)/man/man6
269         install -p doc/recover.6 $(PKGROOT_UG)/man/man6
270         install -p doc/Guidebook $(PKGROOT_UG)/doc
271         install -p dat/nhdat $(PKGROOT_UGLN)
272         sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf
273         cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
274 # XXX these files should be somewhere else for good Mac form
275         touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile
276         mkdir $(PKGROOT_UGLN)/save
277 # XXX what about a news file?
278
279         mkdir -p PKGSCRIPTS
280         echo '#!/bin/sh'                              >  PKGSCRIPTS/postinstall
281         echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall
282         echo $(CHOWN) -R $(GAMEUID) $(HACKDIR)        >> PKGSCRIPTS/postinstall
283         echo $(CHGRP) -R $(GAMEGRP) $(HACKDIR)        >> PKGSCRIPTS/postinstall
284         echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/nethack  >> PKGSCRIPTS/postinstall
285         echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/nethack  >> PKGSCRIPTS/postinstall
286         echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover  >> PKGSCRIPTS/postinstall
287         echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover  >> PKGSCRIPTS/postinstall
288         echo chmod $(VARDIRPERM)  $(HACKDIR)          >> PKGSCRIPTS/postinstall
289         echo chmod $(VARDIRPERM)  $(HACKDIR)/save     >> PKGSCRIPTS/postinstall
290         echo chmod $(FILEPERM)    $(HACKDIR)/license  >> PKGSCRIPTS/postinstall
291         echo chmod $(FILEPERM)    $(HACKDIR)/nhdat    >> PKGSCRIPTS/postinstall
292         echo chmod $(FILEPERM)    $(HACKDIR)/symbols  >> PKGSCRIPTS/postinstall
293         echo chmod $(VARFILEPERM) $(HACKDIR)/perm     >> PKGSCRIPTS/postinstall
294         echo chmod $(VARFILEPERM) $(HACKDIR)/record   >> PKGSCRIPTS/postinstall
295         echo chmod $(VARFILEPERM) $(HACKDIR)/logfile  >> PKGSCRIPTS/postinstall
296         echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall
297         echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf  >> PKGSCRIPTS/postinstall
298         echo chmod $(GAMEPERM)   $(SHELLDIR)/nethack  >> PKGSCRIPTS/postinstall
299         echo chmod $(EXEPERM)    $(SHELLDIR)/recover  >> PKGSCRIPTS/postinstall
300         chmod 0775 PKGSCRIPTS/postinstall
301
302 endif   # end of build_tty_pkg
303 endif   # WANT_WIN_TTY for packaging
304
305 ifdef WANT_WIN_QT
306 # XXX untested and incomplete (see below)
307 build_qt_pkg:
308 ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
309         -echo build_qt_pkg only works for a qt-only build
310         exit 1
311 else
312         $(MAKE) build_package_root
313         rm -rf NetHackQt
314         mkdir -p NetHackQt/NetHackQt.app/nethackdir/save
315         mkdir NetHackQt/Documentation
316         cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation
317
318         osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
319                  win/macosx/NetHackRecover.applescript
320         cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
321
322         mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks
323         cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks
324
325         mkdir NetHackQt/NetHackQt.app/Contents/MacOS
326         mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS
327
328         mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir
329
330 # XXX still missing:
331 #NetHackQt/NetHackQt.app
332 # /Contents
333 #       Info.plist
334 #       Resources/nethack.icns
335 #NetHackQt/Documentation
336 #NetHackQtRecover.txt
337 #NetHack Defaults.txt
338 #changes.patch XXX is this still needed?  why isn't it part of the tree?
339 #  doesn't go here
340         hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg
341 endif   # end of build_qt_pkg
342 endif   # WANT_WIN_QT for packaging
343 endif   # MAKEFILE_TOP