From 0b3e8bbd886ce021e61385ba110b50a75338cb24 Mon Sep 17 00:00:00 2001 From: keni Date: Tue, 8 Apr 2008 23:17:39 +0000 Subject: [PATCH] macosx hints file consolidation (trunk only) get macosx down to one hints file (default tty, single user) for tty, x11, qt and single or multiple users preliminary bits that might allow a macosx qt build --- include/config.h | 2 + sys/unix/Makefile.src | 2 +- sys/unix/Makefile.top | 5 +- sys/unix/hints/linux | 1 + sys/unix/hints/linux-x11 | 2 + sys/unix/hints/macosx | 126 ++++++++++++++++++++++++++++++++++---- sys/unix/hints/macosx-mu | 55 ----------------- sys/unix/hints/macosx-x11 | 41 ------------- sys/unix/hints/unix | 1 + 9 files changed, 126 insertions(+), 109 deletions(-) delete mode 100644 sys/unix/hints/macosx-mu delete mode 100644 sys/unix/hints/macosx-x11 diff --git a/include/config.h b/include/config.h index bdcf023f5..ac3b6c15e 100644 --- a/include/config.h +++ b/include/config.h @@ -88,8 +88,10 @@ # ifndef DEFAULT_WC_TILED_MAP # define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't say wc_ascii_map */ # endif +#ifndef NOUSER_SOUNDS # define USER_SOUNDS /* Use sounds */ /* # define USER_SOUNDS_REGEX */ /* Use regexps for sound message matches */ +#endif # define USE_XPM /* Use XPM format for images (required) */ # define GRAPHIC_TOMBSTONE /* Use graphical tombstone (rip.ppm) */ # ifndef DEFAULT_WINDOW_SYS diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 57377a955..563e11017 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -36,7 +36,7 @@ SHELL=/bin/sh # SHELL=E:/GEMINI2/MUPFEL.TTP # Usually, the C compiler driver is used for linking: -LINK=$(CC) +#LINK=$(CC) # Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating # system. diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 4c2ab435b..742380035 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -235,7 +235,10 @@ update: $(GAME) recover $(VARDAT) dungeon spec_levs # and a reminder @echo You may also want to install the man pages via the doc Makefile. -install: $(GAME) recover $(VARDAT) dungeon spec_levs +rootcheck: + @true; $(ROOTCHECK) + +install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs true; $(PREINSTALL) # set up the directories # not all mkdirs have -p; those that don't will create a -p directory diff --git a/sys/unix/hints/linux b/sys/unix/hints/linux index 30ece238a..46971c6e6 100644 --- a/sys/unix/hints/linux +++ b/sys/unix/hints/linux @@ -15,6 +15,7 @@ PREFIX=$(wildcard ~)/nh/install CFLAGS=-O -I../include -DNOTPARMDECL $(CFLAGS1) CFLAGS1=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" +LINK=$(CC) WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ) diff --git a/sys/unix/hints/linux-x11 b/sys/unix/hints/linux-x11 index ff3f42a87..84adc1cf2 100644 --- a/sys/unix/hints/linux-x11 +++ b/sys/unix/hints/linux-x11 @@ -16,6 +16,8 @@ CFLAGS=-O -I../include -DNOTPARMDECL $(CFLAGS1) $(CFLAGS3) CFLAGS1=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" CFLAGS3=-DX11_GRAPHICS -DDEFAULT_WINDOW_SYS=\"X11\" -DNOTTYGRAPHICS +LINK=$(CC) + WINSRC = $(WINX11SRC) WINOBJ = $(WINX11OBJ) WINLIB = $(WINX11LIB) diff --git a/sys/unix/hints/macosx b/sys/unix/hints/macosx index c6778f4e5..d542fc56a 100644 --- a/sys/unix/hints/macosx +++ b/sys/unix/hints/macosx @@ -6,28 +6,132 @@ # Mac OS X (Darwin) hints file # This is for Mac OS X 10.4.10 (Darwin 8.10). If this doesn't work for some # other version of either Darwin or Mac OS X, make a new file for that OS, -# don't change this one. +# don't change this one. And let us know about it. # Useful info: http://www.opensource.apple.com/darwinsource/index.html -# This is a tty build for a single user. +# This hints file can build several different types of installations. +# Edit the next section to match the type of build you need. -PREFIX:=$(wildcard ~) -SHELLDIR=$(PREFIX)/bin -HACKDIR=$(PREFIX)/nethackdir +# 1. Which window system(s) should be included in this binary? +WANT_WIN_TTY=1 +#WANT_WIN_X11=1 +#WANT_WIN_QT=1 -CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN +# 1a. What is the default window system? +WANT_DEFAULT=tty +#WANT_DEFAULT=x11 +#WANT_DEFAULT=qt + +# 1b. If you set WANT_WIN_QT, you need to +# A) set QTDIR either here or in the environment to point to the Qt2 or Qt3 +# library installation root. (Qt4 will not work; Qt3 does not presently +# compile under Leopard (MacOSX 10.5) out-of-the-box.) +# B) set XPMLIB to point to the Xpm library +ifdef WANT_WIN_QT +QTDIR=/Developer/Qt +LIBXPM= -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/X11R6/lib -lXpm +endif + +# 2. Is this a build for a binary that will be shared among different users +# or will it be private to you? +# If it is shared: +# - it will be owned by the user and group listed +# - you MUST create the user using System Preferences (this will also +# create the group if it is the same as the user) +# - 'make install' must be run as "sudo make install" +#WANT_SHARE_INSTALL=1 +GAMEUID = games +GAMEGRP = $(GAMEUID) + + +# +# You shouldn't need to change anything below here. +# # XXX -g vs -O should go here, -I../include goes in the makefile -CFLAGS=-g -I../include $(CFLAGS2) $(CFLAGS3) -CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" -CFLAGS3=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +CFLAGS=-g -I../include +CFLAGS+=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" +CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" +ifdef WANT_WIN_TTY WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ) WINLIB = $(WINTTYLIB) - WINTTYLIB=-lncurses +else +CFLAGS += -DNOTTYGRAPHICS +endif +ifdef WANT_WIN_X11 +WINSRC += $(WINX11SRC) +WINOBJ += $(WINX11OBJ) +WINLIB += $(WINX11LIB) +LFLAGS=-L/usr/X11R6/lib +VARDATND = x11tiles NetHack.ad pet_mark.xbm +POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir) +CFLAGS += -DX11_GRAPHICS +endif + +ifdef WANT_WIN_QT +CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS +CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 +LINK=g++ +WINSRC += $(WINQTSRC) +WINLIB += $(WINQTLIB) $(LIBXPM) +WINLIB += -framework Carbon -framework QuickTime -lz -framework OpenGL +WINLIB += -framework AGL +ifdef WANT_WIN_X11 + # prevent duplicate tile.o in WINOBJ +WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ)) +ifdef WANT_WIN_TTY +WINOBJ += $(WINTTYOBJ) +endif +else +WINOBJ += $(WINQTOBJ) +endif +# XXX if /Developer/qt exists and QTDIR not set, use that +ifndef QTDIR +$(error QTDIR not defined in the environment or Makefile) +endif +# XXX make sure QTDIR points to something reasonable +else +LINK=$(CC) +endif + +ifdef WANT_SHARE_INSTALL +# NB: do NOT use $(wildcard ~$(GAMEUID)) since the user may not exist yet. +PREFIX:=/Users/$(GAMEUID) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/nethackdir +CHOWN=chown +CHGRP=chgrp +# We run sgid so the game has access to both HACKDIR and user preferences. +GAMEPERM = 02755 +VARFILEPERM = 0664 +VARDIRPERM = 0775 +ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1) +# make sure we have group GAMEUID and group GAMEGRP +PREINSTALL= . sys/unix/hints/macosx.sh user $(GAMEUID); . sys/unix/hints/macosx.sh group $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) +POSTINSTALL= touch $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf +CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE +else +PREFIX:=$(wildcard ~) +SHELLDIR=$(PREFIX)/bin +HACKDIR=$(PREFIX)/nethackdir CHOWN=true CHGRP=true -VARDIRPERM = 0755 +GAMEPERM = 0700 +VARFILEPERM = 0600 +VARDIRPERM = 0700 +ifdef WANT_WIN_X11 +# XXX install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists +endif +endif + +CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN + +# ~/Library/Preferences/NetHack Defaults +# OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp +# OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt +# +# Install.Qt mentions a patch for macos - it's not there. diff --git a/sys/unix/hints/macosx-mu b/sys/unix/hints/macosx-mu deleted file mode 100644 index 779dfda87..000000000 --- a/sys/unix/hints/macosx-mu +++ /dev/null @@ -1,55 +0,0 @@ -# -# SCCS Id: @(#)macosx-mu 3.5 2007/12/12 -# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. -# NetHack may be freely redistributed. See license for details. -# -# Mac OS X (Darwin) hints file -# This is for Mac OS X 10.4.10 (Darwin 8.10). If this doesn't work for some -# other version of either Darwin or Mac OS X, make a new file for that OS, -# don't change this one. -# Useful info: http://www.opensource.apple.com/darwinsource/index.html - -# This is a tty build for a system with multiple users (since it is a tty -# build it does not try to look like a .app application). -# NetHack will be owned by user "games" and group "bin" - change the next 2 -# lines if this is a problem: -GAMEUID = games -GAMEGRP = bin -# NB: "make install" should be run as an admin user: -# sudo make install - -# NB: do NOT use $(wildcard ~$(GAMEUID)) since the user may not exist yet. -PREFIX:=/Users/$(GAMEUID) -SHELLDIR=$(PREFIX)/bin -HACKDIR=$(PREFIX)/nethackdir - -CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN - -# XXX -g vs -O should go here, -I../include goes in the makefile -CFLAGS=-g -I../include $(CFLAGS2) $(CFLAGS3) -CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" -CFLAGS3=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE - -WINSRC = $(WINTTYSRC) -WINOBJ = $(WINTTYOBJ) -WINLIB = $(WINTTYLIB) - -WINTTYLIB=-lncurses - -CHOWN=chown -CHGRP=chgrp - -# We run sgid so the game has access to both HACKDIR and user preferences. -GAMEPERM = 02755 -VARFILEPERM = 0664 -VARDIRPERM = 0775 - -# make sure we have group GAMEUID and group GAMEGRP -PREINSTALL= . sys/unix/hints/macosx.sh user $(GAMEUID); . sys/unix/hints/macosx.sh group $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR) -POSTINSTALL= touch $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf - - -# notes: -#1) ~games/games is owned by root. -#2) group games exists because user games was created via Accounts pane. -#3) who should own/be able to run recover? diff --git a/sys/unix/hints/macosx-x11 b/sys/unix/hints/macosx-x11 deleted file mode 100644 index 6a8a05290..000000000 --- a/sys/unix/hints/macosx-x11 +++ /dev/null @@ -1,41 +0,0 @@ -# -# SCCS Id: @(#)macosx-x11 3.5 2007/12/12 -# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. -# NetHack may be freely redistributed. See license for details. -# -# Mac OS X (Darwin) hints file for X11 -# This is for Mac OS X 10.4.10 (Darwin 8.10). If this doesn't work for some -# other version of either Darwin or Mac OS X, make a new file for that OS, -# don't change this one. -# Useful info: http://www.opensource.apple.com/darwinsource/index.html - -# This is an X11 build for a single user. - -PREFIX:=$(wildcard ~) -SHELLDIR=$(PREFIX)/bin -HACKDIR=$(PREFIX)/nethackdir - -#HACKDIR=$(PREFIX)/games/lib/$(GAME)dir -#PREFIX=/usr - -CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN - -# XXX -g vs -O should go here, -I../include goes in the makefile -CFLAGS=-g -I../include $(CFLAGS2) $(CFLAGS3) -CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\" -CFLAGS3=-DX11_GRAPHICS -DDEFAULT_WINDOW_SYS=\"X11\" -DNOTTYGRAPHICS -LFLAGS=-L/usr/X11R6/lib - -CHOWN=true -CHGRP=true - -WINSRC = $(WINX11SRC) -WINOBJ = $(WINX11OBJ) -WINLIB = $(WINX11LIB) -VARDIRPERM = 0755 - -VARDATND = x11tiles NetHack.ad pet_mark.xbm - -# XXX install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists - -POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir) diff --git a/sys/unix/hints/unix b/sys/unix/hints/unix index 4f51d2b59..4dc8c6c39 100644 --- a/sys/unix/hints/unix +++ b/sys/unix/hints/unix @@ -14,6 +14,7 @@ HACKDIR=$(PREFIX)/games/lib/$(GAME)dir SHELLDIR=$(PREFIX)/games CFLAGS=-O -I../include +LINK=$(CC) WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ)