make nethack.sh switchable from hints file

If SHELLDIR is null, don't install nethack.sh.  Also a tid in Porting
and add NHSROOT to the Makefiles which gives a path to the top of the
tree (so e.g. you can always find makedefs from a rule in a hints file).
This commit is contained in:
keni
2009-12-17 19:26:30 +00:00
parent 81e1ca40f1
commit e8fe9b4505
7 changed files with 61 additions and 24 deletions

View File

@@ -30,7 +30,7 @@ WANT_DEFAULT=tty
ifdef WANT_WIN_QT
QTDIR=/Developer/Qt
LIBXPM= -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/X11R6/lib -lXpm
endif
endif # WANT_WIN_QT
# 2. Is this a build for a binary that will be shared among different users
# or will it be private to you?
@@ -48,6 +48,8 @@ endif
#WANT_SHARE_INSTALL=1
GAMEUID = $(USER)
GAMEGRP = games
# build to run in the source tree - primarily for development. Build with "make all"
#WANT_SOURCE_INSTALL=1
#CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
CC=gcc -Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN -ansi -pedantic
@@ -66,9 +68,9 @@ WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
WINLIB = $(WINTTYLIB)
WINTTYLIB=-lncurses
else
else # !WANT_WIN_TTY
CFLAGS += -DNOTTYGRAPHICS
endif
endif # !WANT_WIN_TTY
ifdef WANT_WIN_X11
WINSRC += $(WINX11SRC)
@@ -78,7 +80,7 @@ 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
endif # WANT_WIN_X11
ifdef WANT_WIN_QT
CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
@@ -93,18 +95,19 @@ ifdef WANT_WIN_X11
WINOBJ = $(sort $(WINQTOBJ) $(WINX11OBJ))
ifdef WANT_WIN_TTY
WINOBJ += $(WINTTYOBJ)
endif
else
endif # WANT_WIN_TTY
else # !WANT_WIN_X11
WINOBJ += $(WINQTOBJ)
endif
endif # !WANT_WIN_X11
# XXX if /Developer/qt exists and QTDIR not set, use that
ifndef QTDIR
$(error QTDIR not defined in the environment or Makefile)
endif
endif # QTDIR
# XXX make sure QTDIR points to something reasonable
else
else # !WANT_WIN_QT
LINK=$(CC)
endif
endif # !WANT_WIN_QT
ifdef WANT_SHARE_INSTALL
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
@@ -117,14 +120,14 @@ CHOWN=chown
CHGRP=chgrp
# We run sgid so the game has access to both HACKDIR and user preferences.
GAMEPERM = 02755
else
else # ! root
PREFIX:=/Users/$(GAMEUID)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
CHOWN=touch
CHGRP=touch
GAMEPERM = 0500
endif
endif # ! root
VARFILEPERM = 0664
VARDIRPERM = 0775
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
@@ -133,7 +136,19 @@ ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); . sys/unix/hints/macosx.sh group2 $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
else
else ifdef WANT_SOURCE_INSTALL
PREFIX=$(abspath $(NHSROOT))
# suppress nethack.sh"
#SHELLDIR=
HACKDIR=$(PREFIX)/playground
CHOWN=touch
CHGRP=touch
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
# We can use "make all" to build the whole thing - but it misses some things:
MOREALL=$(MAKE) install
else # !WANT_SOURCE_INSTALL
PREFIX:=$(wildcard ~)
SHELLDIR=$(PREFIX)/bin
HACKDIR=$(PREFIX)/nethackdir
@@ -145,10 +160,10 @@ VARDIRPERM = 0700
ifdef WANT_WIN_X11
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc
endif
endif # WANT_WIN_X11
POSTINSTALL+= cp -n sys/unix/sysconf $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
endif
endif # !WANT_SOURCE_INSTALL
# ~/Library/Preferences/NetHack Defaults