OSDN Git Service

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