OSDN Git Service

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