First pass at a hints-based build system to augment (not replace) the existing

build system.

Anyone who wants to do a build from sys/unix and doesn't want to figure this
out just needs to do:
	sh setup.sh hints/unix
instead of:
	sh setup.sh
and then continue on as usual.

New files:
sys/unix/NewInstall.unx - the new directions
sys/unix/hints/* - the hints files.  There will be more later.
sys/unix/mkmkfile.sh - helper for setup.sh

Summary of changes:
see NewInstall.unx for info on the new build system
introduction of various preprocessor symbols to turn options off that
 are defaulted on historically
comment out nethackrc (and similar) entries that still use the old symbol
 syntax.
commenting out of Makefile.* lines that now come from hints/unix
GAMEDIR is replaced with HACKDIR so the Makefiles and the C source agree.
  Note that I have NOT changed the docs and/or Makefiles for be, msdos, os2,
  vms, or winnt.  If port maintainers don't then I will, but I can't test
  those ports.
nethack.sh now handles the font path automatically
This commit is contained in:
keni
2007-12-13 20:17:11 +00:00
parent 6e41d8e973
commit 59e64a1d40
17 changed files with 251 additions and 111 deletions

View File

@@ -25,10 +25,10 @@
in Files, which should be in the top directory.)
2. Your Makefiles may still be in sys/unix with tags on the end of them.
If so, run "sh setup.sh" in that directory to distribute the Makefiles
to places they can do their work. (If later official patches change
these Makefiles, setup.sh should be rerun to make sure you use the
current copies.)
If so, run "sh setup.sh hints/unix" in that directory to
distribute the Makefiles to places they can do their work. (If
later official patches change these Makefiles, setup.sh should
be rerun to make sure you use the current copies.)
3. Go to the include subdirectory and edit config.h according to the
comments to match your system and desired set of features. Similarly
@@ -56,7 +56,7 @@
7. Go back to the top directory and edit that Makefile, explaining where
you want everything to be installed.
Make sure that you follow the comments about setting GAMEDIR -- the
Make sure that you follow the comments about setting HACKDIR -- the
installation process will wipe out the contents of the directory you
point it at, under the assumption that it's debris from an old version
of NetHack. If this is not the case, you'll want to install somewhere
@@ -80,7 +80,7 @@
8. Read doc/recover.man or doc/recover.txt to learn how to use the recover
program. The recover program can be used in case of a crash to recover
a game that was in progress. The recover command is installed in the
GAMEDIR by default.
HACKDIR by default.
Notes:

View File

@@ -1,5 +1,5 @@
# NetHack Makefile.
# SCCS Id: @(#)Makefile.src 3.5 2006/01/07
# SCCS Id: @(#)Makefile.src 3.5 2007/12/12
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
@@ -151,8 +151,8 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome
# flags for debugging:
# CFLAGS = -g -I../include
CFLAGS = -O -I../include
LFLAGS =
#CFLAGS = -O -I../include
#LFLAGS =
# The Qt and Be window systems are written in C++, while the rest of
# NetHack is standard C. If using Qt, uncomment the LINK line here to get
@@ -214,8 +214,8 @@ WINBEOBJ =
#
#
WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
#WINSRC = $(WINTTYSRC)
#WINOBJ = $(WINTTYOBJ)
# on some systems the termcap library is in -ltermcap or -lcurses
# on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
@@ -231,7 +231,7 @@ WINOBJ = $(WINTTYOBJ)
# WINTTYLIB = -lcurses
# WINTTYLIB = -lcurses16
# WINTTYLIB = -lncurses
WINTTYLIB = -ltermlib
#WINTTYLIB = -ltermlib
#
# libraries for X11
# If USE_XPM is defined in config.h, you will also need -lXpm here.
@@ -255,7 +255,7 @@ WINGEMLIB = -le_gem -lgem
# libraries for BeOS
WINBELIB = -lbe
WINLIB = $(WINTTYLIB)
#WINLIB = $(WINTTYLIB)
# any other strange libraries your system needs (for Sysunix only -- the more
# specialized targets should already be right)

View File

@@ -1,5 +1,5 @@
# NetHack Makefile.
# SCCS Id: @(#)Makefile.top 3.5 1995/01/05
# SCCS Id: @(#)Makefile.top 3.5 2007/12/12
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
@@ -14,7 +14,7 @@
# MAKE = make
# make NetHack
PREFIX = /usr
#PREFIX = /usr
GAME = nethack
# GAME = nethack.prg
GAMEUID = games
@@ -27,20 +27,19 @@ FILEPERM = 0644
EXEPERM = 0755
DIRPERM = 0755
# GAMEDIR also appears in config.h as "HACKDIR".
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else GAMEDIR
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
#
# note that 'make install' believes in creating a nice tidy GAMEDIR for
# note that 'make install' believes in creating a nice tidy HACKDIR for
# installation, free of debris from previous NetHack versions --
# therefore there should not be anything in GAMEDIR that you want to keep
# therefore there should not be anything in HACKDIR that you want to keep
# (if there is, you'll have to do the installation by hand or modify the
# instructions)
GAMEDIR = $(PREFIX)/games/lib/$(GAME)dir
VARDIR = $(GAMEDIR)
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
VARDIR = $(HACKDIR)
SHELLDIR = $(PREFIX)/games
# per discussion in Install.X11 and Install.Qt
VARDATND =
#VARDATND =
# VARDATND = x11tiles NetHack.ad pet_mark.xbm
# VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm
# for Atari/Gem
@@ -64,8 +63,8 @@ VARDAT = $(VARDATD) $(VARDATND)
# other permission-related reasons. If that happens, you may want to set the
# command to "true", which is a no-op. Note that disabling chown or chgrp
# will only work if setuid (or setgid) behavior is not desired or required.
CHOWN = chown
CHGRP = chgrp
#CHOWN = chown
#CHGRP = chgrp
#
# end of configuration
@@ -183,48 +182,48 @@ dofiles:
-e '}' \
-e '$$s/.*/nodlb/p' < dat/options` ; \
$(MAKE) dofiles-$${target-nodlb}
(cd dat ; cp symbols $(GAMEDIR) )
cp src/$(GAME) $(GAMEDIR)
cp util/recover $(GAMEDIR)
(cd dat ; cp symbols $(HACKDIR) )
cp src/$(GAME) $(HACKDIR)
cp util/recover $(HACKDIR)
-rm -f $(SHELLDIR)/$(GAME)
sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
< sys/unix/nethack.sh \
> $(SHELLDIR)/$(GAME)
# set up their permissions
-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
$(CHGRP) $(GAMEGRP) $(GAME) recover )
chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
chmod $(EXEPERM) $(GAMEDIR)/recover
chmod $(GAMEPERM) $(HACKDIR)/$(GAME)
chmod $(EXEPERM) $(HACKDIR)/recover
-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) symbols ; \
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) symbols ; \
$(CHGRP) $(GAMEGRP) symbols ; \
chmod $(FILEPERM) symbols )
dofiles-dlb: check-dlb
( cd dat ; cp nhdat $(DATNODLB) $(GAMEDIR) )
( cd dat ; cp nhdat $(DATNODLB) $(HACKDIR) )
# set up their permissions
-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
$(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
chmod $(FILEPERM) nhdat $(DATNODLB) )
dofiles-nodlb:
# copy over the game files
( cd dat ; cp $(DAT) $(GAMEDIR) )
( cd dat ; cp $(DAT) $(HACKDIR) )
# set up their permissions
-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
-( cd $(HACKDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
$(CHGRP) $(GAMEGRP) $(DAT) ; \
chmod $(FILEPERM) $(DAT) )
update: $(GAME) recover $(VARDAT) dungeon spec_levs
# (don't yank the old version out from under people who're playing it)
-mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
-mv $(HACKDIR)/$(GAME) $(HACKDIR)/$(GAME).old
# quest.dat is also kept open and has the same problems over NFS
# (quest.dat may be inside nhdat if dlb is in use)
-mv $(GAMEDIR)/quest.dat $(GAMEDIR)/quest.dat.old
-mv $(GAMEDIR)/nhdat $(GAMEDIR)/nhdat.old
-mv $(HACKDIR)/quest.dat $(HACKDIR)/quest.dat.old
-mv $(HACKDIR)/nhdat $(HACKDIR)/nhdat.old
# set up new versions of the game files
( $(MAKE) dofiles )
# touch time-sensitive files
@@ -238,12 +237,12 @@ install: $(GAME) recover $(VARDAT) dungeon spec_levs
# set up the directories
# not all mkdirs have -p; those that don't will create a -p directory
-mkdir -p $(SHELLDIR)
-rm -rf $(GAMEDIR) $(VARDIR)
-mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save
-rm -rf $(HACKDIR) $(VARDIR)
-mkdir -p $(HACKDIR) $(VARDIR) $(VARDIR)/save
-rmdir ./-p
-$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
$(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
chmod $(DIRPERM) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
-$(CHOWN) $(GAMEUID) $(HACKDIR) $(VARDIR) $(VARDIR)/save
$(CHGRP) $(GAMEGRP) $(HACKDIR) $(VARDIR) $(VARDIR)/save
chmod $(DIRPERM) $(HACKDIR) $(VARDIR) $(VARDIR)/save
# set up the game files
( $(MAKE) dofiles )
# set up some additional files
@@ -251,6 +250,7 @@ install: $(GAME) recover $(VARDAT) dungeon spec_levs
-( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \
$(CHGRP) $(GAMEGRP) perm record logfile ; \
chmod $(FILEPERM) perm record logfile )
true; $(POSTINSTALL)
# and a reminder
@echo You may also want to reinstall the man pages via the doc Makefile.

View File

@@ -1,5 +1,5 @@
# Makefile for NetHack's utility programs.
# SCCS Id: @(#)Makefile.utl 3.5 1997/04/19
# SCCS Id: @(#)Makefile.utl 3.5 2007/12/12
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
# recursive make calls if $(MAKE) is used
@@ -89,7 +89,7 @@
# flags for debugging:
# CFLAGS = -g -I../include
CFLAGS = -O -I../include
#CFLAGS = -O -I../include
LFLAGS =
LIBS =

38
sys/unix/NewInstall.unx Normal file
View File

@@ -0,0 +1,38 @@
Instructions for installing NetHack 3.5
using the new hints system
=======================================
For the moment, we are maintaining two ways to configure NetHack. The
traditional system, in which Makefiles and includes are edited, and the
new hints system which should be easier for most users to configure.
If you are using the traditional configuration system, see Install.unx.
1. Look in the sys/unix/hints directory for a file that matches your system.
If there isn't one, build one from the other files; if you need more help
see the traditional instructions (in Install.unx) for hints. When you
get it right please submit it to us.
2. Check the hints file for anything that may need to be changed for your
installation. Most of the time little or nothing will need to be changed.
3. Configure and build:
"$Top" is the top level source directory (the one with README in it).
cd $Top/sys/unix
sh setup.sh hints/NAME_OF_HINTS_FILE
cd ../..
make all
If the build fails, remove all the generated files before retrying the
build with: cd $Top; make spotless
4. Install:
Depending on your configuration, this step may or may not need to be done
as root; check the hints file.
cd $Top
make install
5. If it all worked, you're done. If something went wrong, see Install.unx
for information about the settings the hints file tried to automate.

31
sys/unix/hints/macosx Normal file
View File

@@ -0,0 +1,31 @@
#
# SCCS Id: @(#)macosx 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 single user.
# XXX temp testing:
HACKDIR=/tmp/nhdir5
PREFIX=/tmp
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)
CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
WINLIB = $(WINTTYLIB)
WINTTYLIB=-lncurses
CHOWN=true
CHGRP=true

40
sys/unix/hints/macosx-x11 Normal file
View File

@@ -0,0 +1,40 @@
#
# 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
# XXX temp testing:
HACKDIR=/tmp/nhdir5
PREFIX=/tmp
#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
#WINTTYLIB=-lncurses
CHOWN=true
CHGRP=true
WINSRC = $(WINX11SRC)
WINOBJ = $(WINX11OBJ)
WINLIB = $(WINX11LIB)
VARDATND = x11tiles NetHack.ad pet_mark.xbm
# XXX install nethack.rc as .nethackrc
POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcd; (cd $(HACKDIR); mkfontdir)

24
sys/unix/hints/unix Normal file
View File

@@ -0,0 +1,24 @@
#
# SCCS Id: @(#)unix 3.5 2007/12/12
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
# unix hints file
# This hints file provides the legacy configuration that NetHack has shipped
# with historically - this means you will most likely need to hand edit .h
# and Makefiles.
HACKDIR=$(PREFIX)/games/lib/$(GAME)dir
PREFIX=/usr
CFLAGS=-O -I../include
WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
WINLIB = $(WINTTYLIB)
WINTTYLIB=-ltermlib
CHOWN=chown
CHGRP=chgrp

12
sys/unix/mkmkfile.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SCCS Id: @(#)macosx 3.5 2007/12/12
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
# build one makefile
# args are:
# $1 basefile
# $2 install path
# $3 hints file
cat $3 $1 > $2

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# SCCS Id: @(#)nethack.sh 3.5 1990/02/26
# SCCS Id: @(#)nethack.sh 3.5 2007/12/12
HACKDIR=/usr/games/lib/nethackdir
export HACKDIR
@@ -15,6 +15,12 @@ x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad"
esac
export XUSERFILESEARCHPATH
# Get font dir added, but only once (and only if there's an xset to be found).
xset p >/dev/null 2>&1 && (
xset fp- $HACKDIR >/dev/null 2>&1;
xset fp+ $HACKDIR
)
# see if we can find the full path name of PAGER, so help files work properly
# assume that if someone sets up a special variable (HACKPAGER) for NetHack,
# it will already be in a form acceptable to NetHack

View File

@@ -1,41 +1,24 @@
#!/bin/sh
# Copy files to their correct locations.
# SCCS Id: @(#)macosx 3.5 2007/12/12
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
# If arguments are given, try symbolic link first. This is not the default
# so that most people will have the distribution versions stay around so
# subsequent patches can be applied. People who pay enough attention to
# know there's a non-default behavior are assumed to pay enough attention
# to keep distribution versions if they modify things.
# Build and install makefiles.
#
# Argument is the hints file to use (or no argument for traditional setup).
# Were we started from the top level? Cope.
if [ -f sys/unix/Makefile.top ]; then cd sys/unix; fi
if [ $# -gt 0 ] ; then
# First, try to make a symbolic link.
#
ln -s Makefile.top Makefile >/dev/null 2>&1
if [ $? -eq 0 ] ; then
case "x$1" in
x) hints=/dev/null
;;
*) hints=$1
;;
esac
echo "Lucky you! Symbolic links."
rm -f Makefile
umask 0
ln -s sys/unix/Makefile.top ../../Makefile
ln -s ../sys/unix/Makefile.dat ../../dat/Makefile
ln -s ../sys/unix/Makefile.doc ../../doc/Makefile
ln -s ../sys/unix/Makefile.src ../../src/Makefile
ln -s ../sys/unix/Makefile.utl ../../util/Makefile
exit 0
fi
fi
#
# Otherwise...
echo "Copying Makefiles."
cp Makefile.top ../../Makefile
cp Makefile.dat ../../dat/Makefile
cp Makefile.doc ../../doc/Makefile
cp Makefile.src ../../src/Makefile
cp Makefile.utl ../../util/Makefile
/bin/sh ./mkmkfile.sh Makefile.top ../../Makefile $hints
/bin/sh ./mkmkfile.sh Makefile.dat ../../dat/Makefile $hints
/bin/sh ./mkmkfile.sh Makefile.doc ../../doc/Makefile $hints
/bin/sh ./mkmkfile.sh Makefile.src ../../src/Makefile $hints
/bin/sh ./mkmkfile.sh Makefile.utl ../../util/Makefile $hints