initial libnethack
This commit is contained in:
+8
-1
@@ -37,7 +37,7 @@ Release/
|
|||||||
binary/
|
binary/
|
||||||
build/
|
build/
|
||||||
ipch/
|
ipch/
|
||||||
lib/
|
./lib/
|
||||||
Nethack.sln
|
Nethack.sln
|
||||||
Nethack.sdf
|
Nethack.sdf
|
||||||
Nethack.opensdf
|
Nethack.opensdf
|
||||||
@@ -81,3 +81,10 @@ win/share/monthin.txt
|
|||||||
win/share/objthin.txt
|
win/share/objthin.txt
|
||||||
win/share/oththin.txt
|
win/share/oththin.txt
|
||||||
# end of ms-dos
|
# end of ms-dos
|
||||||
|
|
||||||
|
#libnethack
|
||||||
|
src/nethack.data
|
||||||
|
src/nethack.wasm
|
||||||
|
src/nethack.js
|
||||||
|
src/wasm-data
|
||||||
|
src/libnethack.a
|
||||||
|
|||||||
+9
-2
@@ -325,8 +325,15 @@ struct version_info {
|
|||||||
unsigned long incarnation; /* actual version number */
|
unsigned long incarnation; /* actual version number */
|
||||||
unsigned long feature_set; /* bitmask of config settings */
|
unsigned long feature_set; /* bitmask of config settings */
|
||||||
unsigned long entity_count; /* # of monsters and objects */
|
unsigned long entity_count; /* # of monsters and objects */
|
||||||
|
#ifndef WASM
|
||||||
unsigned long struct_sizes1; /* size of key structs */
|
unsigned long struct_sizes1; /* size of key structs */
|
||||||
unsigned long struct_sizes2; /* size of more key structs */
|
unsigned long struct_sizes2; /* size of more key structs */
|
||||||
|
#else /* WASM */
|
||||||
|
/* 'long' in WASM is 4 bytes, which is too small to hold version numbers
|
||||||
|
* such as: VERSION_SANITY2 */
|
||||||
|
unsigned long long struct_sizes1; /* size of key structs */
|
||||||
|
unsigned long long struct_sizes2; /* size of more key structs */
|
||||||
|
#endif /* !WASM */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct savefile_info {
|
struct savefile_info {
|
||||||
@@ -390,7 +397,7 @@ struct savefile_info {
|
|||||||
|
|
||||||
/* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED
|
/* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED
|
||||||
but only for supported platforms. */
|
but only for supported platforms. */
|
||||||
#ifdef UNIX
|
#if defined(UNIX) && !defined(WASM)
|
||||||
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
|
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
|
||||||
/* see end.c */
|
/* see end.c */
|
||||||
#ifndef PANICTRACE
|
#ifndef PANICTRACE
|
||||||
@@ -405,7 +412,7 @@ struct savefile_info {
|
|||||||
#if defined(MACOSX)
|
#if defined(MACOSX)
|
||||||
#define PANICTRACE_LIBC
|
#define PANICTRACE_LIBC
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNIX
|
#if defined(UNIX) && !defined(WASM) /* no popen in WASM */
|
||||||
#define PANICTRACE_GDB
|
#define PANICTRACE_GDB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# NetHack Datafiles Makefile.dat $NHDT-Date: 1596486993 2020/08/03 20:36:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.32 $
|
||||||
|
# Copyright (c) 2018 by Pasi Kallinen
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
|
# Root of source tree:
|
||||||
|
NHSROOT=..
|
||||||
|
|
||||||
|
# for Atari
|
||||||
|
# SHELL=E:/GEMINI2/MUPFEL.TTP
|
||||||
|
# UUDECODE=uudecode
|
||||||
|
|
||||||
|
VARDAT = bogusmon data engrave epitaph rumors oracles options
|
||||||
|
|
||||||
|
all: $(VARDAT) spec_levs quest_levs
|
||||||
|
|
||||||
|
../util/makedefs:
|
||||||
|
(cd ../util ; $(MAKE) makedefs)
|
||||||
|
|
||||||
|
../util/tile2x11:
|
||||||
|
(cd ../util ; $(MAKE) tile2x11)
|
||||||
|
|
||||||
|
../util/tile2beos:
|
||||||
|
(cd ../util ; $(MAKE) tile2beos)
|
||||||
|
|
||||||
|
../util/tile2bmp:
|
||||||
|
(cd ../util ; $(MAKE) tile2bmp)
|
||||||
|
|
||||||
|
x11tiles: ../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
|
||||||
|
../win/share/other.txt \
|
||||||
|
../win/share/monsters.txt
|
||||||
|
../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
|
||||||
|
../win/share/other.txt \
|
||||||
|
-grayscale ../win/share/monsters.txt
|
||||||
|
|
||||||
|
beostiles: ../util/tile2beos ../win/share/monsters.txt \
|
||||||
|
../win/share/objects.txt \
|
||||||
|
../win/share/other.txt
|
||||||
|
../util/tile2beos ../win/share/monsters.txt \
|
||||||
|
../win/share/objects.txt \
|
||||||
|
../win/share/other.txt
|
||||||
|
|
||||||
|
nhtiles.bmp: ../util/tile2bmp ../win/share/monsters.txt \
|
||||||
|
../win/share/objects.txt \
|
||||||
|
../win/share/other.txt
|
||||||
|
../util/tile2bmp $@
|
||||||
|
|
||||||
|
NetHack.ad: ../win/X11/NetHack.ad
|
||||||
|
# handle "#define foo bar" -lines
|
||||||
|
grep ^#define ../win/X11/NetHack.ad | \
|
||||||
|
sed -e 's/^#define/s/g' -e 's/ */ /g' \
|
||||||
|
-e 's/$$/ g/g' > NetHack.ad.tmp
|
||||||
|
grep -v ^#define ../win/X11/NetHack.ad | \
|
||||||
|
sed -f NetHack.ad.tmp > NetHack.ad
|
||||||
|
-rm -f NetHack.ad.tmp
|
||||||
|
|
||||||
|
pet_mark.xbm: ../win/X11/pet_mark.xbm
|
||||||
|
cp ../win/X11/pet_mark.xbm pet_mark.xbm
|
||||||
|
|
||||||
|
pilemark.xbm: ../win/X11/pilemark.xbm
|
||||||
|
cp ../win/X11/pilemark.xbm pilemark.xbm
|
||||||
|
|
||||||
|
rip.xpm: ../win/X11/rip.xpm
|
||||||
|
cp ../win/X11/rip.xpm rip.xpm
|
||||||
|
|
||||||
|
mapbg.xpm: ../win/gnome/mapbg.xpm
|
||||||
|
cp ../win/gnome/mapbg.xpm mapbg.xpm
|
||||||
|
|
||||||
|
nhsplash.xpm: ../win/share/nhsplash.xpm
|
||||||
|
cp ../win/share/nhsplash.xpm nhsplash.xpm
|
||||||
|
|
||||||
|
nethack.icns: ../win/share/nhicns.uu
|
||||||
|
$(UUDECODE) ../win/share/nhicns.uu
|
||||||
|
|
||||||
|
Info.plist: ../win/Qt/Info.pli
|
||||||
|
cp ../win/Qt/Info.pli Info.plist
|
||||||
|
|
||||||
|
../util/tile2img.ttp:
|
||||||
|
(cd ../util ; $(MAKE) tile2img.ttp)
|
||||||
|
|
||||||
|
../util/xpm2img.ttp:
|
||||||
|
(cd ../util ; $(MAKE) xpm2img.ttp)
|
||||||
|
nh16.img: ../util/tile2img.ttp ../win/share/monsters.txt \
|
||||||
|
../win/share/objects.txt ../win/share/other.txt
|
||||||
|
../util/tile2img.ttp nh16.img
|
||||||
|
|
||||||
|
rip.img: ../util/xpm2img.ttp
|
||||||
|
../util/xpm2img.ttp ../win/X11/rip.xpm rip.img
|
||||||
|
title.img:
|
||||||
|
# cp ../win/gem/title.img title.img
|
||||||
|
$(UUDECODE) ../win/gem/title.uu
|
||||||
|
|
||||||
|
GEM_RSC.RSC:
|
||||||
|
# cp ../win/gem/GEM_RSC.RSC GEM_RSC.RSC
|
||||||
|
$(UUDECODE) ../win/gem/gem_rsc.uu
|
||||||
|
|
||||||
|
|
||||||
|
data: data.base ../util/makedefs
|
||||||
|
../util/makedefs -d
|
||||||
|
|
||||||
|
rumors: rumors.tru rumors.fal ../util/makedefs
|
||||||
|
../util/makedefs -r
|
||||||
|
|
||||||
|
oracles: oracles.txt ../util/makedefs
|
||||||
|
../util/makedefs -h
|
||||||
|
|
||||||
|
engrave: engrave.txt ../util/makedefs
|
||||||
|
../util/makedefs -s
|
||||||
|
|
||||||
|
epitaph: epitaph.txt ../util/makedefs
|
||||||
|
../util/makedefs -s
|
||||||
|
|
||||||
|
bogusmon: bogusmon.txt ../util/makedefs
|
||||||
|
../util/makedefs -s
|
||||||
|
|
||||||
|
# note: 'options' should have already been made when include/date.h was created
|
||||||
|
options: ../util/makedefs
|
||||||
|
../util/makedefs -v
|
||||||
|
|
||||||
|
# these don't actually do anything useful now that levcomp and dngcomp are gone
|
||||||
|
spec_levs:
|
||||||
|
touch spec_levs
|
||||||
|
quest_levs:
|
||||||
|
touch quest_levs
|
||||||
|
|
||||||
|
# gitinfo.txt is optionally made by src/Makefile when creating date.h
|
||||||
|
# spec_levs and quest_levs are empty marker files to control 'make' actions
|
||||||
|
clean:
|
||||||
|
-rm -f spec_levs quest_levs gitinfo.txt
|
||||||
|
|
||||||
|
spotless: clean
|
||||||
|
-rm -f nhdat $(VARDAT) \
|
||||||
|
x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm \
|
||||||
|
rip.img GEM_RSC.RSC title.img nh16.img NetHack.ad \
|
||||||
|
nhsplash.xpm nhtiles.bmp beostiles
|
||||||
|
|
||||||
|
#eof#
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,332 @@
|
|||||||
|
# NetHack Top-level Makefile.
|
||||||
|
# NetHack 3.7 Makefile.top $NHDT-Date: 1597031649 2020/08/10 03:54:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.52 $
|
||||||
|
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
|
# Root of source tree:
|
||||||
|
NHSROOT=$(abspath .)
|
||||||
|
|
||||||
|
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
|
||||||
|
# recursive make calls if $(MAKE) is used
|
||||||
|
# these makes allow $(MAKE) to be overridden by the environment if someone
|
||||||
|
# wants to (or has to) use something other than the standard make, so we do
|
||||||
|
# not want to unconditionally set $(MAKE) here
|
||||||
|
#
|
||||||
|
# unfortunately, some older makes do not predefine $(MAKE); if you have one of
|
||||||
|
# these, uncomment the following line
|
||||||
|
# (you will know that you have one if you get complaints about unable to
|
||||||
|
# execute things like 'data' and 'rumors')
|
||||||
|
# MAKE = make
|
||||||
|
|
||||||
|
# make libnethack
|
||||||
|
LIBNH = libnethack.a
|
||||||
|
|
||||||
|
# if requested, setup cross-compiler for WASM
|
||||||
|
ifdef WANT_WASM
|
||||||
|
CC=$(EMCC)
|
||||||
|
AR=$(EMAR)
|
||||||
|
RANLIB=$(EMRANLIB)
|
||||||
|
CFLAGS=$(EMCC_CFLAGS)
|
||||||
|
SYSCFLAGS=$(EMCC_CFLAGS)
|
||||||
|
INSTDIR=$(WASM_DATA_DIR)
|
||||||
|
endif # WANT_WASM
|
||||||
|
|
||||||
|
# Permissions - some places use setgid instead of setuid, for instance
|
||||||
|
# See also the option "SECURE" in include/config.h
|
||||||
|
#GAMEPERM = 04755
|
||||||
|
FILEPERM = 0644
|
||||||
|
# VARFILEPERM = 0644
|
||||||
|
EXEPERM = 0755
|
||||||
|
DIRPERM = 0755
|
||||||
|
# VARDIRPERM = 0755
|
||||||
|
|
||||||
|
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
|
||||||
|
#
|
||||||
|
# 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 HACKDIR that you want to keep
|
||||||
|
# (if there is, you'll have to do the installation by hand or modify the
|
||||||
|
# instructions)
|
||||||
|
#HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
|
||||||
|
#VARDIR = $(HACKDIR)
|
||||||
|
# Where nethack.sh in installed. If this is not defined, the wrapper is not used.
|
||||||
|
#SHELLDIR = $(PREFIX)/games
|
||||||
|
|
||||||
|
# per discussion in Install.X11 and Install.Qt
|
||||||
|
#VARDATND =
|
||||||
|
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
|
||||||
|
# VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
|
||||||
|
# for Atari/Gem
|
||||||
|
# VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
|
||||||
|
# for BeOS
|
||||||
|
# VARDATND = beostiles
|
||||||
|
# for Gnome
|
||||||
|
# VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
|
||||||
|
|
||||||
|
VARDATD = bogusmon data engrave epitaph oracles options quest.lua rumors
|
||||||
|
VARDAT = $(VARDATD) $(VARDATND)
|
||||||
|
|
||||||
|
# Some versions of make use the SHELL environment variable as the shell
|
||||||
|
# for running commands. We need this to be a Bourne shell.
|
||||||
|
# SHELL = /bin/sh
|
||||||
|
# for Atari
|
||||||
|
# SHELL=E:/GEMINI2/MUPFEL.TTP
|
||||||
|
|
||||||
|
# Commands for setting the owner and group on files during installation.
|
||||||
|
# Some systems fail with one or the other when installing over NFS or for
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Lua version
|
||||||
|
LUA_VERSION = 5.4.0
|
||||||
|
|
||||||
|
#
|
||||||
|
# end of configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
DATHELP = help hh cmdhelp keyhelp history opthelp wizhelp
|
||||||
|
|
||||||
|
SPEC_LEVS = asmodeus.lua baalz.lua bigrm-*.lua castle.lua fakewiz?.lua \
|
||||||
|
juiblex.lua knox.lua medusa-?.lua minend-?.lua minefill.lua \
|
||||||
|
minetn-?.lua oracle.lua orcus.lua sanctum.lua soko?-?.lua \
|
||||||
|
tower?.lua valley.lua wizard?.lua nhlib.lua themerms.lua \
|
||||||
|
astral.lua air.lua earth.lua fire.lua water.lua
|
||||||
|
QUEST_LEVS = ???-goal.lua ???-fil?.lua ???-loca.lua ???-strt.lua
|
||||||
|
|
||||||
|
DATNODLB = $(VARDATND) license symbols
|
||||||
|
DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
|
||||||
|
DAT = $(DATNODLB) $(DATDLB)
|
||||||
|
|
||||||
|
# first target is also the default target for 'make' without any arguments
|
||||||
|
#all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb
|
||||||
|
all: libnh
|
||||||
|
true; $(MOREALL)
|
||||||
|
@echo "Done."
|
||||||
|
|
||||||
|
libnh: src/$(LIBNH)
|
||||||
|
@echo "libnethack is up to date."
|
||||||
|
|
||||||
|
src/$(LIBNH): lua_support
|
||||||
|
( cd src ; $(MAKE))
|
||||||
|
|
||||||
|
lua_support: lib/lua/liblua.a include/nhlua.h
|
||||||
|
@true
|
||||||
|
lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h
|
||||||
|
( cd lib/lua-$(LUA_VERSION)/src \
|
||||||
|
&& make CC='$(CC)' AR='$(AR)' RANLIB='$(RANLIB)' SYSCFLAGS='$(SYSCFLAGS)' a && cd ../../.. )
|
||||||
|
lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
|
||||||
|
@( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi )
|
||||||
|
cp lib/lua-$(LUA_VERSION)/src/liblua.a $@
|
||||||
|
include/nhlua.h: lib/lua/liblua.a
|
||||||
|
echo '/* nhlua.h - generated by top Makefile */' > $@
|
||||||
|
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@
|
||||||
|
@sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \
|
||||||
|
< lib/lua-$(LUA_VERSION)/src/lua.h >> $@
|
||||||
|
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@
|
||||||
|
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@
|
||||||
|
@echo '/*nhlua.h*/' >> $@
|
||||||
|
|
||||||
|
# Note: many of the dependencies below are here to allow parallel make
|
||||||
|
# to generate valid output
|
||||||
|
|
||||||
|
Guidebook:
|
||||||
|
( cd doc ; $(MAKE) Guidebook )
|
||||||
|
|
||||||
|
manpages:
|
||||||
|
( cd doc ; $(MAKE) manpages )
|
||||||
|
|
||||||
|
data: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) data )
|
||||||
|
|
||||||
|
engrave: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) engrave )
|
||||||
|
|
||||||
|
bogusmon: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) bogusmon )
|
||||||
|
|
||||||
|
epitaph: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) epitaph )
|
||||||
|
|
||||||
|
rumors: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) rumors )
|
||||||
|
|
||||||
|
oracles: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) oracles )
|
||||||
|
|
||||||
|
# Note: options should have already been made with make, but...
|
||||||
|
options: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) options )
|
||||||
|
|
||||||
|
quest.lua: $(GAME)
|
||||||
|
|
||||||
|
spec_levs:
|
||||||
|
( cd dat ; $(MAKE) spec_levs )
|
||||||
|
( cd dat ; $(MAKE) quest_levs )
|
||||||
|
|
||||||
|
nhtiles.bmp: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) nhtiles.bmp )
|
||||||
|
|
||||||
|
x11tiles: $(GAME)
|
||||||
|
( cd util ; $(MAKE) tile2x11 )
|
||||||
|
( cd dat ; $(MAKE) x11tiles )
|
||||||
|
|
||||||
|
beostiles: $(GAME)
|
||||||
|
( cd util ; $(MAKE) tile2beos )
|
||||||
|
( cd dat ; $(MAKE) beostiles )
|
||||||
|
|
||||||
|
NetHack.ad: $(GAME)
|
||||||
|
( cd dat ; $(MAKE) NetHack.ad )
|
||||||
|
|
||||||
|
pet_mark.xbm:
|
||||||
|
( cd dat ; $(MAKE) pet_mark.xbm )
|
||||||
|
|
||||||
|
pilemark.xbm:
|
||||||
|
( cd dat ; $(MAKE) pilemark.xbm )
|
||||||
|
|
||||||
|
rip.xpm:
|
||||||
|
( cd dat ; $(MAKE) rip.xpm )
|
||||||
|
|
||||||
|
mapbg.xpm:
|
||||||
|
(cd dat ; $(MAKE) mapbg.xpm )
|
||||||
|
|
||||||
|
nhsplash.xpm:
|
||||||
|
( cd dat ; $(MAKE) nhsplash.xpm )
|
||||||
|
|
||||||
|
nh16.img: $(GAME)
|
||||||
|
( cd util ; $(MAKE) tile2img.ttp )
|
||||||
|
( cd dat ; $(MAKE) nh16.img )
|
||||||
|
|
||||||
|
rip.img:
|
||||||
|
( cd util ; $(MAKE) xpm2img.ttp )
|
||||||
|
( cd dat ; $(MAKE) rip.img )
|
||||||
|
GEM_RSC.RSC:
|
||||||
|
( cd dat ; $(MAKE) GEM_RSC.RSC )
|
||||||
|
|
||||||
|
title.img:
|
||||||
|
( cd dat ; $(MAKE) title.img )
|
||||||
|
|
||||||
|
check-dlb: options
|
||||||
|
@if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
|
||||||
|
|
||||||
|
dlb:
|
||||||
|
( cd util ; $(MAKE) dlb )
|
||||||
|
( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
|
||||||
|
|
||||||
|
# recover can be used when INSURANCE is defined in include/config.h
|
||||||
|
# and the checkpoint option is true
|
||||||
|
recover: $(GAME)
|
||||||
|
( cd util ; $(MAKE) recover )
|
||||||
|
|
||||||
|
dofiles:
|
||||||
|
target=`sed -n \
|
||||||
|
-e '/librarian/{' \
|
||||||
|
-e 's/.*/dlb/p' \
|
||||||
|
-e 'q' \
|
||||||
|
-e '}' \
|
||||||
|
-e '$$s/.*/nodlb/p' < dat/options` ; \
|
||||||
|
$(MAKE) dofiles-$${target-nodlb}
|
||||||
|
cp src/$(GAME) $(INSTDIR)
|
||||||
|
cp util/recover $(INSTDIR)
|
||||||
|
-if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
|
||||||
|
if test -n '$(SHELLDIR)'; then \
|
||||||
|
sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
|
||||||
|
-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
|
||||||
|
< sys/unix/nethack.sh \
|
||||||
|
> $(SHELLDIR)/$(GAME) ; fi
|
||||||
|
# set up their permissions
|
||||||
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(GAME) recover )
|
||||||
|
chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
|
||||||
|
chmod $(EXEPERM) $(INSTDIR)/recover
|
||||||
|
-if test -n '$(SHELLDIR)'; then \
|
||||||
|
$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
|
||||||
|
if test -n '$(SHELLDIR)'; then \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
|
||||||
|
chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
|
||||||
|
|
||||||
|
dofiles-dlb: check-dlb
|
||||||
|
( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
|
||||||
|
# set up their permissions
|
||||||
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
|
||||||
|
$(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
|
||||||
|
chmod $(FILEPERM) nhdat $(DATNODLB) )
|
||||||
|
|
||||||
|
dofiles-nodlb:
|
||||||
|
# copy over the game files
|
||||||
|
( cd dat ; cp $(DAT) $(INSTDIR) )
|
||||||
|
# set up their permissions
|
||||||
|
-( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(DAT) ; \
|
||||||
|
chmod $(FILEPERM) $(DAT) )
|
||||||
|
#
|
||||||
|
# This is not part of the dependency build hierarchy.
|
||||||
|
# It requires an explicit "make fetch-Lua".
|
||||||
|
fetch-lua: fetch-Lua
|
||||||
|
@true
|
||||||
|
|
||||||
|
fetch-Lua:
|
||||||
|
( mkdir -p lib && cd lib && \
|
||||||
|
curl -R -O http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz && \
|
||||||
|
tar zxf lua-$(LUA_VERSION).tar.gz && rm -f lua-$(LUA_VERSION).tar.gz )
|
||||||
|
|
||||||
|
update: $(GAME) recover $(VARDAT) spec_levs
|
||||||
|
# (don't yank the old version out from under people who're playing it)
|
||||||
|
-mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
|
||||||
|
-mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
|
||||||
|
# set up new versions of the game files
|
||||||
|
( $(MAKE) dofiles )
|
||||||
|
# touch time-sensitive files
|
||||||
|
-touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
|
||||||
|
-touch -c $(VARDIR)/save/*
|
||||||
|
touch $(VARDIR)/perm $(VARDIR)/record
|
||||||
|
# and a reminder
|
||||||
|
@echo You may also want to install the man pages via the doc Makefile.
|
||||||
|
|
||||||
|
rootcheck:
|
||||||
|
@true; $(ROOTCHECK)
|
||||||
|
|
||||||
|
install: rootcheck $(GAME) recover $(VARDAT) spec_levs
|
||||||
|
true; $(PREINSTALL)
|
||||||
|
# set up the directories
|
||||||
|
# not all mkdirs have -p; those that don't will create a -p directory
|
||||||
|
-if test -n '$(SHELLDIR)'; then \
|
||||||
|
mkdir -p $(SHELLDIR); fi
|
||||||
|
rm -rf $(INSTDIR) $(VARDIR)
|
||||||
|
-mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
||||||
|
if test -d ./-p; then rmdir ./-p; fi
|
||||||
|
-$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
||||||
|
$(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save
|
||||||
|
# order counts here:
|
||||||
|
chmod $(DIRPERM) $(INSTDIR)
|
||||||
|
chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
|
||||||
|
# set up the game files
|
||||||
|
( $(MAKE) dofiles )
|
||||||
|
# set up some additional files
|
||||||
|
touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile
|
||||||
|
-( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \
|
||||||
|
$(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \
|
||||||
|
chmod $(VARFILEPERM) perm record logfile xlogfile )
|
||||||
|
true; $(POSTINSTALL)
|
||||||
|
# and a reminder
|
||||||
|
@echo You may also want to reinstall the man pages via the doc Makefile.
|
||||||
|
|
||||||
|
|
||||||
|
# 'make clean' removes all the .o files, but leaves around all the executables
|
||||||
|
# and compiled data files
|
||||||
|
clean:
|
||||||
|
( cd src ; $(MAKE) clean )
|
||||||
|
( cd util ; $(MAKE) clean )
|
||||||
|
( cd dat ; $(MAKE) clean )
|
||||||
|
( cd doc ; $(MAKE) clean )
|
||||||
|
( cd lib/lua-$(LUA_VERSION)/src && $(MAKE) clean )
|
||||||
|
|
||||||
|
# 'make spotless' returns the source tree to near-distribution condition.
|
||||||
|
# it removes .o files, executables, and compiled data files
|
||||||
|
spotless::
|
||||||
|
( cd src ; $(MAKE) spotless )
|
||||||
|
( cd util ; $(MAKE) spotless )
|
||||||
|
( cd dat ; $(MAKE) spotless )
|
||||||
|
( cd doc ; $(MAKE) spotless )
|
||||||
@@ -0,0 +1,382 @@
|
|||||||
|
# Makefile for NetHack's utility programs.
|
||||||
|
# NetHack 3.7 Makefile.utl $NHDT-Date: 1596498292 2020/08/03 23:44:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.51 $
|
||||||
|
# Copyright (c) 2018 by Robert Patrick Rankin
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
|
# Root of source tree:
|
||||||
|
NHSROOT=..
|
||||||
|
|
||||||
|
# newer makes predefine $(MAKE) to 'make' and do smarter processing of
|
||||||
|
# recursive make calls if $(MAKE) is used
|
||||||
|
# these makes allow $(MAKE) to be overridden by the environment if someone
|
||||||
|
# wants to (or has to) use something other than the standard make, so we do
|
||||||
|
# not want to unconditionally set $(MAKE) here
|
||||||
|
#
|
||||||
|
# unfortunately, some older makes do not predefine $(MAKE); if you have one of
|
||||||
|
# these, uncomment the following line
|
||||||
|
# (you will know that you have one if you get complaints about unable to
|
||||||
|
# execute things like 'foo.o')
|
||||||
|
# MAKE = make
|
||||||
|
|
||||||
|
# if you are using gcc as your compiler,
|
||||||
|
# uncomment the CC definition below if it's not in your environment
|
||||||
|
# CC = gcc
|
||||||
|
#
|
||||||
|
# For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
|
||||||
|
#
|
||||||
|
# CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
|
||||||
|
#
|
||||||
|
# If you are using GCC 2.2.2 or higher on a DPX/2, just use:
|
||||||
|
#
|
||||||
|
# CC = gcc -ansi
|
||||||
|
#
|
||||||
|
# For HP/UX 10.20 with GCC:
|
||||||
|
# CC = gcc -D_POSIX_SOURCE
|
||||||
|
#
|
||||||
|
# if your make doesn't define a default SHELL properly, you may need
|
||||||
|
# the line below (Atari users will need a bourne work-alike)
|
||||||
|
# SHELL = /bin/sh
|
||||||
|
# for Atari
|
||||||
|
# SHELL=E:/GEMINI2/MUPFEL.TTP
|
||||||
|
|
||||||
|
# flags may have to be changed as required
|
||||||
|
# flags for 286 Xenix:
|
||||||
|
# CFLAGS = -Ml2t16 -O -LARGE -I../include
|
||||||
|
# LFLAGS = -Ml -F 4000 -SEG 512
|
||||||
|
|
||||||
|
# flags for 286 Microport SysV-AT
|
||||||
|
# CFLAGS = -DDUMB -Ml -I../include
|
||||||
|
# LFLAGS = -Ml
|
||||||
|
|
||||||
|
# flags for Atari GCC (3.2.1)
|
||||||
|
# CFLAGS = -O -I../include
|
||||||
|
# LFLAGS = -s
|
||||||
|
# flags for Atari GCC (3.3)
|
||||||
|
# CFLAGS = -mshort -O2 -I../include
|
||||||
|
# LFLAGS = -mshort -s
|
||||||
|
|
||||||
|
# flags for Apollos using their native cc
|
||||||
|
# (as long as it claims to be __STDC__ but isn't)
|
||||||
|
# CFLAGS = -DAPOLLO -O -I../include
|
||||||
|
|
||||||
|
# flags for AIX 3.1 cc on IBM RS/6000 to define
|
||||||
|
# a suitable subset of standard libraries
|
||||||
|
# (note that there is more info regarding the "-qchars=signed"
|
||||||
|
# switch in file Install.unx note 8)
|
||||||
|
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
|
||||||
|
# and for AIX 3.2:
|
||||||
|
# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -D_ALL_SOURCE -O -I../include -qchars=signed
|
||||||
|
|
||||||
|
# flags for A/UX 2.01 using native cc or c89
|
||||||
|
# gcc predefines AUX so that's not needed there
|
||||||
|
# CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
|
||||||
|
|
||||||
|
# flags for IRIX 4.0.x using native cc
|
||||||
|
# SGI cc 3.10 will fail to compile makedefs with -O
|
||||||
|
# CFLAGS = -I../include -D__STDC__ -woff 100,293
|
||||||
|
|
||||||
|
# flags for Linux
|
||||||
|
# compile normally
|
||||||
|
# CFLAGS = -O2 -fomit-frame-pointer -I../include
|
||||||
|
# LFLAGS = -L/usr/X11R6/lib
|
||||||
|
# OR compile backwards compatible a.out format
|
||||||
|
# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include
|
||||||
|
# LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
|
||||||
|
|
||||||
|
# flags for BeOS using the command line
|
||||||
|
# BeOS on a Mac/BeBox:
|
||||||
|
#CC = mwcc
|
||||||
|
#CFLAGS = -I../include
|
||||||
|
# BeOS on Intel:
|
||||||
|
# the default values are fine
|
||||||
|
|
||||||
|
# flags for debugging:
|
||||||
|
# CFLAGS = -g -I../include
|
||||||
|
|
||||||
|
#CFLAGS = -O -I../include
|
||||||
|
#LFLAGS =
|
||||||
|
|
||||||
|
# -lm required by lua
|
||||||
|
LFLAGS += -lm
|
||||||
|
|
||||||
|
# we specify C preprocessor flags via CFLAGS; files built with default rules
|
||||||
|
# might include $(CPPFLAGS) which could get a value from user's environment;
|
||||||
|
# we avoid that by forcing it empty rather than by overriding default rules
|
||||||
|
CPPFLAGS =
|
||||||
|
|
||||||
|
LIBS =
|
||||||
|
|
||||||
|
# If you are cross-compiling, you must use this:
|
||||||
|
OBJDIR = .
|
||||||
|
# otherwise, you can save a little bit of disk space with this:
|
||||||
|
#OBJDIR = ../src
|
||||||
|
|
||||||
|
# if you change this to 1, feedback while building will omit -Dthis -Wthat
|
||||||
|
# -Isomewhere so that each file being compiled is listed on one short line;
|
||||||
|
# it requires support for '$<' in rules with more than one prerequisite
|
||||||
|
# (rather than just in suffix default rule), such as is implemented by
|
||||||
|
# gnu make and others which have picked up its extensions;
|
||||||
|
# allowed values are 0, 1, and empty (which behaves like 0)
|
||||||
|
QUIETCC=0
|
||||||
|
|
||||||
|
# TODO? the link/load commands below are handled differently from the ones
|
||||||
|
# in Makefile.src; these use '$(CC) $(LFLAGS)' and ought to be changed to use
|
||||||
|
# $(LD) or $(LINK) as appropriate [quiet mode echoes a misleading $< value]
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
#
|
||||||
|
# Nothing below this line should have to be changed.
|
||||||
|
|
||||||
|
# Verbosity definitions, begin
|
||||||
|
# Set QUIETCC=1 above to output less feedback while building.
|
||||||
|
# CC and CXX obey verbosity, LD and LINK don't.
|
||||||
|
# AT is @ when not verbose, empty otherwise
|
||||||
|
ACTUAL_CC := $(CC)
|
||||||
|
ACTUAL_CXX := $(CXX)
|
||||||
|
ACTUAL_LD := $(LD)
|
||||||
|
ACTUAL_LINK := $(LINK)
|
||||||
|
|
||||||
|
CC_V0 = $(ACTUAL_CC)
|
||||||
|
CC_V = $(CC_V0)
|
||||||
|
CC_V1 = @echo "[CC] $<"; $(ACTUAL_CC)
|
||||||
|
CC = $(CC_V$(QUIETCC))
|
||||||
|
|
||||||
|
CXX_V0 = $(ACTUAL_CXX)
|
||||||
|
CXX_V = $(CXX_V0)
|
||||||
|
CXX_V1 = @echo "[CXX] $<"; $(ACTUAL_CXX)
|
||||||
|
CXX = $(CXX_V$(QUIETCC))
|
||||||
|
|
||||||
|
CFLAGS+=-I../include
|
||||||
|
ifdef WANT_WASM
|
||||||
|
CFLAGS+=-DWASM
|
||||||
|
endif
|
||||||
|
|
||||||
|
# LD and LINK might be based on invoking CC and may not be able to substitute
|
||||||
|
# for QUIETCC, so feedback from them is handled differently (via $AT)
|
||||||
|
LD = $(ACTUAL_LD)
|
||||||
|
LINK = $(ACTUAL_LINK)
|
||||||
|
|
||||||
|
AT_V0 :=
|
||||||
|
AT_V := $(AT_V0)
|
||||||
|
AT_V1 := @
|
||||||
|
AT = $(AT_V$(QUIETCC))
|
||||||
|
# Verbosity, end
|
||||||
|
|
||||||
|
# timestamps for primary header files, matching src/Makefile
|
||||||
|
CONFIG_H = ../src/config.h-t
|
||||||
|
HACK_H = ../src/hack.h-t
|
||||||
|
|
||||||
|
# utility .c files
|
||||||
|
MAKESRC = makedefs.c ../src/mdlib.c
|
||||||
|
RECOVSRC = recover.c
|
||||||
|
DLBSRC = dlb_main.c
|
||||||
|
UTILSRCS = $(MAKESRC) panic.c $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC)
|
||||||
|
|
||||||
|
# files that define all monsters and objects
|
||||||
|
CMONOBJ = ../src/monst.c ../src/objects.c
|
||||||
|
OMONOBJ = $(OBJDIR)/monst.o $(OBJDIR)/objects.o
|
||||||
|
# files that provide access to NetHack's names
|
||||||
|
CNAMING = ../src/drawing.c $(CMONOBJ)
|
||||||
|
ONAMING = $(OBJDIR)/drawing.o $(OMONOBJ)
|
||||||
|
# dynamic memory allocation
|
||||||
|
CALLOC = ../src/alloc.c panic.c
|
||||||
|
OALLOC = $(OBJDIR)/alloc.o panic.o
|
||||||
|
|
||||||
|
# object files for makedefs
|
||||||
|
MAKEOBJS = makedefs.o $(OMONOBJ)
|
||||||
|
|
||||||
|
# object files for recovery utility
|
||||||
|
RECOVOBJS = recover.o
|
||||||
|
|
||||||
|
# object files for the data librarian
|
||||||
|
DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC)
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies for makedefs
|
||||||
|
#
|
||||||
|
makedefs: $(MAKEOBJS) mdgrep.h
|
||||||
|
$(CC) $(LFLAGS) -o makedefs $(MAKEOBJS)
|
||||||
|
|
||||||
|
makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) ../include/permonst.h \
|
||||||
|
../include/objclass.h ../include/monsym.h \
|
||||||
|
../include/artilist.h ../include/dungeon.h ../include/obj.h \
|
||||||
|
../include/monst.h ../include/you.h ../include/flag.h \
|
||||||
|
../include/dlb.h ../include/patchlevel.h
|
||||||
|
|
||||||
|
# Don't require perl to build; that is why mdgrep.h is spelled wrong below.
|
||||||
|
mdgreph: mdgrep.pl
|
||||||
|
perl mdgrep.pl
|
||||||
|
|
||||||
|
../include/onames.h: makedefs
|
||||||
|
./makedefs -o
|
||||||
|
../include/pm.h: makedefs
|
||||||
|
./makedefs -p
|
||||||
|
../include/vis_tab.h: makedefs
|
||||||
|
./makedefs -z
|
||||||
|
# makedefs -z makes both vis_tab.h and vis_tab.c, but writes the .h first
|
||||||
|
../src/vis_tab.c: ../include/vis_tab.h
|
||||||
|
|
||||||
|
lintdefs:
|
||||||
|
@lint -axbh -I../include -DLINT $(MAKESRC) $(CMONOBJ) | sed '/_flsbuf/d'
|
||||||
|
|
||||||
|
|
||||||
|
# we defer this makedefs call to the src Makefile, since it knows all about
|
||||||
|
# the main src and include files date.h is a timestamp for
|
||||||
|
../include/date.h::
|
||||||
|
@( cd ../src ; $(MAKE) ../include/date.h )
|
||||||
|
|
||||||
|
# support code used by several of the utility programs (but not makedefs)
|
||||||
|
panic.o: panic.c $(CONFIG_H)
|
||||||
|
|
||||||
|
|
||||||
|
# with all of extern.h's functions to complain about, we drown in
|
||||||
|
# 'defined but not used' without -u
|
||||||
|
lintdgn:
|
||||||
|
@lint -axhu -I../include -DLINT $(DGNCOMPSRC) $(CALLOC) | sed '/_flsbuf/d'
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies for recover
|
||||||
|
#
|
||||||
|
recover: $(RECOVOBJS)
|
||||||
|
$(CC) $(LFLAGS) -o recover $(RECOVOBJS) $(LIBS)
|
||||||
|
|
||||||
|
recover.o: recover.c $(CONFIG_H) ../include/date.h
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies for dlb
|
||||||
|
#
|
||||||
|
dlb: $(DLBOBJS)
|
||||||
|
$(CC) $(LFLAGS) -o dlb $(DLBOBJS) $(LIBS)
|
||||||
|
|
||||||
|
dlb_main.o: dlb_main.c $(CONFIG_H) ../include/dlb.h ../include/date.h
|
||||||
|
$(CC) $(CFLAGS) -c dlb_main.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies for tile utilities
|
||||||
|
#
|
||||||
|
TEXT_IO = tiletext.o tiletxt.o $(OALLOC) $(ONAMING)
|
||||||
|
GIFREADERS = gifread.o
|
||||||
|
PPMWRITERS = ppmwrite.o
|
||||||
|
|
||||||
|
tileutils: tilemap gif2txt txt2ppm tile2x11
|
||||||
|
|
||||||
|
gif2txt: $(GIFREADERS) $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o gif2txt $(GIFREADERS) $(TEXT_IO) $(LIBS)
|
||||||
|
txt2ppm: $(PPMWRITERS) $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o txt2ppm $(PPMWRITERS) $(TEXT_IO) $(LIBS)
|
||||||
|
|
||||||
|
tile2x11: tile2x11.o $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o tile2x11 tile2x11.o $(TEXT_IO) $(LIBS)
|
||||||
|
|
||||||
|
tile2img.ttp: tile2img.o bitmfile.o $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o tile2img.ttp tile2img.o bitmfile.o $(TEXT_IO) $(LIBS)
|
||||||
|
|
||||||
|
tile2bmp: tile2bmp.o $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o tile2bmp tile2bmp.o $(TEXT_IO)
|
||||||
|
|
||||||
|
xpm2img.ttp: xpm2img.o bitmfile.o
|
||||||
|
$(CC) $(LFLAGS) -o xpm2img.ttp xpm2img.o bitmfile.o $(LIBS)
|
||||||
|
|
||||||
|
tile2beos: tile2beos.o $(TEXT_IO)
|
||||||
|
$(CC) $(LFLAGS) -o tile2beos tile2beos.o $(TEXT_IO) -lbe
|
||||||
|
|
||||||
|
#--compiling and linking in one step leaves extra debugging files (in their
|
||||||
|
# own subdirectories!) on OSX; compile and link separately to suppress
|
||||||
|
# that without mucking about with extra OS-specific CFLAGS and/or LFLAGS
|
||||||
|
#tilemap: ../win/share/tilemap.c $(HACK_H)
|
||||||
|
# $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS)
|
||||||
|
tilemap: tilemap.o
|
||||||
|
$(CC) $(LFLAGS) -o tilemap tilemap.o $(LIBS)
|
||||||
|
../src/tile.c: tilemap
|
||||||
|
./tilemap
|
||||||
|
|
||||||
|
../include/tile.h: ../win/share/tile.h
|
||||||
|
cp ../win/share/tile.h ../include/tile.h
|
||||||
|
tiletext.o: ../win/share/tiletext.c $(CONFIG_H) ../include/tile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/share/tiletext.c
|
||||||
|
tiletxt.c: ./Makefile
|
||||||
|
@echo '/* alternate compilation for tilemap.c to create tiletxt.o' > tiletxt.c
|
||||||
|
@echo ' that does not rely on "cc -c -o tiletxt.o tilemap.c"' >> tiletxt.c
|
||||||
|
@echo ' since many pre-POSIX compilers did not support that */' >> tiletxt.c
|
||||||
|
echo '#define TILETEXT' >> tiletxt.c
|
||||||
|
echo '#include "../win/share/tilemap.c"' >> tiletxt.c
|
||||||
|
@echo '/*tiletxt.c*/' >> tiletxt.c
|
||||||
|
tiletxt.o: tiletxt.c ../win/share/tilemap.c $(HACK_H)
|
||||||
|
$(CC) $(CFLAGS) -c tiletxt.c
|
||||||
|
tilemap.o: ../win/share/tilemap.c $(HACK_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../win/share/tilemap.c
|
||||||
|
|
||||||
|
gifread.o: ../win/share/gifread.c $(CONFIG_H) ../include/tile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/share/gifread.c
|
||||||
|
ppmwrite.o: ../win/share/ppmwrite.c $(CONFIG_H) ../include/tile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/share/ppmwrite.c
|
||||||
|
|
||||||
|
tile2bmp.o: ../win/share/tile2bmp.c $(HACK_H) ../include/tile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/share/tile2bmp.c
|
||||||
|
|
||||||
|
tile2x11.o: ../win/X11/tile2x11.c $(HACK_H) ../include/tile.h \
|
||||||
|
../include/tile2x11.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/X11/tile2x11.c
|
||||||
|
|
||||||
|
tile2img.o: ../win/gem/tile2img.c $(HACK_H) ../include/tile.h \
|
||||||
|
../include/bitmfile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/gem/tile2img.c
|
||||||
|
xpm2img.o: ../win/gem/xpm2img.c $(HACK_H) ../include/bitmfile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/gem/xpm2img.c
|
||||||
|
bitmfile.o: ../win/gem/bitmfile.c ../include/bitmfile.h
|
||||||
|
$(CC) $(CFLAGS) -c ../win/gem/bitmfile.c
|
||||||
|
|
||||||
|
tile2beos.o: ../win/BeOS/tile2beos.cpp $(HACK_H) ../include/tile.h
|
||||||
|
$(CXX) $(CFLAGS) -c ../win/BeOS/tile2beos.cpp
|
||||||
|
|
||||||
|
tileedit: tileedit.cpp $(TEXT_IO)
|
||||||
|
$(QTDIR)/bin/moc -o tileedit.moc tileedit.h
|
||||||
|
$(CC) -o tileedit -I../include -I$(QTDIR)/include -L$(QTDIR)/lib \
|
||||||
|
tileedit.cpp $(TEXT_IO) -lqt
|
||||||
|
|
||||||
|
# using dependencies like
|
||||||
|
# ../src/foo::
|
||||||
|
# @( cd ../src ; $(MAKE) foo )
|
||||||
|
# would always force foo to be up-to-date according to the src Makefile
|
||||||
|
# when it's needed here. Unfortunately, some makes believe this syntax
|
||||||
|
# means foo always changes, instead of foo should always be checked.
|
||||||
|
# therefore, approximate via config.h dependencies, and hope that anybody
|
||||||
|
# changing anything other than basic configuration also knows when not
|
||||||
|
# to improvise things not in the instructions, like 'make makedefs' here
|
||||||
|
# in util...
|
||||||
|
|
||||||
|
# make sure object files from src are available when needed
|
||||||
|
#
|
||||||
|
$(OBJDIR)/alloc.o: ../src/alloc.c $(CONFIG_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../src/alloc.c -o $@
|
||||||
|
$(OBJDIR)/drawing.o: ../src/drawing.c $(CONFIG_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../src/drawing.c -o $@
|
||||||
|
$(OBJDIR)/decl.o: ../src/decl.c $(CONFIG_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../src/decl.c -o $@
|
||||||
|
$(OBJDIR)/monst.o: ../src/monst.c $(CONFIG_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../src/monst.c -o $@
|
||||||
|
$(OBJDIR)/objects.o: ../src/objects.c $(CONFIG_H)
|
||||||
|
$(CC) $(CFLAGS) -c ../src/objects.c -o $@
|
||||||
|
$(OBJDIR)/dlb.o: ../src/dlb.c $(CONFIG_H) ../include/dlb.h
|
||||||
|
$(CC) $(CFLAGS) -c ../src/dlb.c -o $@
|
||||||
|
|
||||||
|
# make sure hack.h dependencies get transitive information
|
||||||
|
$(HACK_H): $(CONFIG_H)
|
||||||
|
@( cd ../src ; $(MAKE) $(HACK_H) )
|
||||||
|
$(CONFIG_H): ../include/config.h
|
||||||
|
@( cd ../src ; $(MAKE) $(CONFIG_H) )
|
||||||
|
|
||||||
|
SYSSHARE=../sys/share/
|
||||||
|
|
||||||
|
tags: $(UTILSRCS)
|
||||||
|
@ctags -tw $(UTILSRCS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f *.o
|
||||||
|
|
||||||
|
spotless: clean
|
||||||
|
-rm -f ../include/tile.h tiletxt.c
|
||||||
|
-rm -f makedefs recover dlb
|
||||||
|
-rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp \
|
||||||
|
tilemap tileedit tile2bmp
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# NetHack 3.7 multiw-1.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
|
||||||
|
|
||||||
|
# 1. Which windowing interface(s) should be included in this binary?
|
||||||
|
# One or more of these can be manually uncommented and/or can be specified
|
||||||
|
# on the 'make' command line. If none are enabled, tty will be used.
|
||||||
|
#WANT_WIN_TTY=1
|
||||||
|
#WANT_WIN_CURSES=1
|
||||||
|
#WANT_WIN_X11=1
|
||||||
|
#WANT_WIN_QT=1
|
||||||
|
|
||||||
|
# 2. What is the default window system?
|
||||||
|
# Exactly one of these can be manually uncommented and/or can be specified
|
||||||
|
# on the 'make' command line. If none is enabled, the first among
|
||||||
|
# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
|
||||||
|
#WANT_DEFAULT=tty
|
||||||
|
#WANT_DEFAULT=curses
|
||||||
|
#WANT_DEFAULT=Qt
|
||||||
|
#WANT_DEFAULT=X11
|
||||||
|
|
||||||
|
# 3. compiler detection or optional override
|
||||||
|
CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
|
||||||
|
ifeq "$(CCISCLANG)" ""
|
||||||
|
CXX=g++ -std=gnu++11
|
||||||
|
else
|
||||||
|
CXX=clang++ -std=gnu++11
|
||||||
|
endif
|
||||||
|
# if you want to override the compiler detection just carried out
|
||||||
|
# uncomment one of the following pairs as desired.
|
||||||
|
#CC= gcc
|
||||||
|
#CXX= g++ -std-gnu++11
|
||||||
|
#
|
||||||
|
#CC= clang
|
||||||
|
#CXX=clang++ -std=gnu++11
|
||||||
|
|
||||||
|
#end of multiw-1.2020
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# NetHack 3.7 multiw-2.2020 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-3.7 $
|
||||||
|
#
|
||||||
|
# Sorts out support for multiple window ports (interfaces) to included in the build.
|
||||||
|
#
|
||||||
|
# Included from:
|
||||||
|
# hints/linux.2020
|
||||||
|
# hints/macOS.2020
|
||||||
|
#
|
||||||
|
# The following will be set appropriately following this:
|
||||||
|
# - WANT_WIN_XXX (at least one will be set; default is TTY)
|
||||||
|
# - WANT_DEFAULT (set to match one of the enabled WANT_WIN_XXX)
|
||||||
|
# - WINCFLAGS
|
||||||
|
# - WINSRC
|
||||||
|
# - WINOBJ0
|
||||||
|
#---
|
||||||
|
# User selections could be specified as combinations of any of the following:
|
||||||
|
# WIN_WANT_TTY=1, WIN_WANT_CURSES=1, WIN_WANT_QT=1, WIN_WANT_X11=1
|
||||||
|
# The selections will all be linked into the same binary.
|
||||||
|
#
|
||||||
|
# Assuming you have the prerequisite packages mentioned above, you can
|
||||||
|
# specify, right on the make command line, which window ports (or interfaces)
|
||||||
|
# to include in your build. Doing it via the make command line means that won't
|
||||||
|
# have to edit the Makefile.
|
||||||
|
#
|
||||||
|
# make WANT_WIN_QT=1 WANT_WIN_X11=1 WANT_WIN_CURSES=1 WANT_WIN_TTY=1 install
|
||||||
|
#
|
||||||
|
# Add WANT_DEFAULT=Qt (or other interface) if you want nethack to use
|
||||||
|
# something other than tty as the default interface.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Make sure that at least one interface is enabled.
|
||||||
|
ifndef WANT_WIN_ALL
|
||||||
|
ifndef WANT_WIN_TTY
|
||||||
|
ifndef WANT_WIN_CURSES
|
||||||
|
ifndef WANT_WIN_X11
|
||||||
|
ifndef WANT_WIN_QT
|
||||||
|
WANT_WIN_TTY=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_ALL
|
||||||
|
WANT_WIN_TTY=1
|
||||||
|
WANT_WIN_CURSES=1
|
||||||
|
WANT_WIN_X11=1
|
||||||
|
WANT_WIN_QT=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Make sure that a default interface is specified; this doesn't guarantee
|
||||||
|
# sanity for something like 'make WANT_WIN_CURSES=1 WANT_DEFAULT=X11' but
|
||||||
|
# 'makedefs -v' would notice, complain, and quit causing 'make' to quit.
|
||||||
|
ifndef WANT_DEFAULT
|
||||||
|
# pick the first one enabled among { tty, curses, X11, Qt }
|
||||||
|
ifdef WANT_WIN_TTY
|
||||||
|
WANT_DEFAULT=tty
|
||||||
|
else
|
||||||
|
ifdef WANT_WIN_CURSES
|
||||||
|
WANT_DEFAULT=curses
|
||||||
|
else
|
||||||
|
ifdef WANT_WIN_X11
|
||||||
|
WANT_DEFAULT=X11
|
||||||
|
else
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
WANT_DEFAULT=Qt
|
||||||
|
else
|
||||||
|
# ? shouldn't be able to get here...
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
WINCFLAGS=
|
||||||
|
WINSRC =
|
||||||
|
WINOBJ0 =
|
||||||
|
|
||||||
|
ifdef WANT_WIN_TTY
|
||||||
|
WINSRC += $(WINTTYSRC)
|
||||||
|
WINOBJ0 += $(WINTTYOBJ)
|
||||||
|
else
|
||||||
|
WINCFLAGS += -DNOTTYGRAPHICS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_CURSES
|
||||||
|
WINCFLAGS += -DCURSES_GRAPHICS
|
||||||
|
WINSRC += $(WINCURSESSRC)
|
||||||
|
WINOBJ0 += $(WINCURSESOBJ)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_X11
|
||||||
|
WINCFLAGS += -DX11_GRAPHICS
|
||||||
|
WINSRC += $(WIINX11SRC)
|
||||||
|
WINOBJ0 += $(WINX11OBJ)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
WINCFLAGS += -DQT_GRAPHICS
|
||||||
|
WINSRC += $(WINQTSRC)
|
||||||
|
WINOBJ0 += $(WINQTOBJ)
|
||||||
|
endif
|
||||||
|
|
||||||
|
#end of hints/include/multiw-2.2020
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
Executable
+443
@@ -0,0 +1,443 @@
|
|||||||
|
# NetHack 3.7 macOS.2020 $NHDT-Date: 1597704793 2020/08/17 22:53:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $
|
||||||
|
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015.
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
#
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# MacOS hints file with support for multiple window ports (interfaces)
|
||||||
|
# Tested on:
|
||||||
|
# - MacOS Catalina 10.15
|
||||||
|
#
|
||||||
|
# If this doesn't work for some other version of Mac OS X, consider
|
||||||
|
# making a new hints file it, rather than changing this one.
|
||||||
|
# And let us know about it.
|
||||||
|
# Useful info: http://www.opensource.apple.com/darwinsource/index.html
|
||||||
|
|
||||||
|
#-PRE xxxx
|
||||||
|
# macOS X hints file
|
||||||
|
#
|
||||||
|
|
||||||
|
####-INCLUDE multiw-1.2020
|
||||||
|
|
||||||
|
# 4. If you set WANT_WIN_QT, you need to
|
||||||
|
# A) set QTDIR either here or in the environment to point to the Qt5
|
||||||
|
# library installation root. (Qt2, Qt3, Qt4 will not work)
|
||||||
|
# B) set XPMLIB to point to the Xpm library
|
||||||
|
ifndef WANT_WIN_QT
|
||||||
|
ifdef WANT_WIN_ALL
|
||||||
|
WANT_WIN_QT=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
#QTDIR=/Developer/Qt
|
||||||
|
# Qt installed via homebrew
|
||||||
|
QTDIR=$(shell brew --prefix)/opt/qt
|
||||||
|
# Qt installed via macports
|
||||||
|
#QTDIR=/opt/local/libexec/qt5
|
||||||
|
endif # WANT_WIN_QT
|
||||||
|
ifndef LIBXPM
|
||||||
|
LIBXPM= -L/opt/X11/lib -lXpm
|
||||||
|
endif
|
||||||
|
|
||||||
|
# 5. Other
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# You shouldn't need to change anything below here (in the hints file; if
|
||||||
|
# you're reading this in Makefile augmented by hints, that may not be true).
|
||||||
|
#
|
||||||
|
|
||||||
|
####-INCLUDE multiw-2.2020
|
||||||
|
|
||||||
|
# XXX -g vs -O should go here, -I../include goes in the makefile
|
||||||
|
CFLAGS+=-g -I../include -DNOTPARMDECL
|
||||||
|
ifndef WANT_WIN_QT
|
||||||
|
# these are normally used when compiling nethack's core
|
||||||
|
CFLAGS+=-ansi -pedantic -Wno-long-long
|
||||||
|
# but -ansi forces -std=c90 for C or -std=c++98 for C++;
|
||||||
|
# win/Qt/qt_*.cpp compiled with C++98 semantics trigger
|
||||||
|
#In file included from .../qt5/include/QtCore/qglobal.h:105:
|
||||||
|
#.../qt5/include/QtCore/qcompilerdetection.h:561:6:
|
||||||
|
# error Qt requires a C++11 compiler and yours does not seem to be that.
|
||||||
|
# so we suppress -ansi when the build includes Qt
|
||||||
|
endif
|
||||||
|
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
|
||||||
|
# leave it out by default.
|
||||||
|
#CFLAGS+=-Wunreachable-code
|
||||||
|
#TODO NHLIB
|
||||||
|
#CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
|
||||||
|
CFLAGS+=-Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wformat -Wswitch -Wshadow -Wwrite-strings
|
||||||
|
CFLAGS+=-DGCC_WARN
|
||||||
|
|
||||||
|
# NetHack sources control
|
||||||
|
CFLAGS+=-DDLB
|
||||||
|
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
|
||||||
|
CFLAGS+=-DDLB
|
||||||
|
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||||
|
#CFLAGS+=-DTIMED_DELAY
|
||||||
|
#CFLAGS+=-DDUMPLOG
|
||||||
|
#CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
|
||||||
|
CFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
|
||||||
|
#CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
|
||||||
|
# older binaries use NOCLIPPING, but that disables SIGWINCH
|
||||||
|
#CFLAGS+=-DNOCLIPPING
|
||||||
|
CFLAGS+=-DNOMAIL
|
||||||
|
#CFLAGS+=-DEXTRA_SANITY_CHECKS
|
||||||
|
#CFLAGS+=-DEDIT_GETLIN
|
||||||
|
#CFLAGS+=-DSCORE_ON_BOTL
|
||||||
|
#CFLAGS+=-DMSGHANDLER
|
||||||
|
#CFLAGS+=-DTTY_TILES_ESCCODES
|
||||||
|
#CFLAGS+=-DTTY_SOUND_ESCCODES
|
||||||
|
|
||||||
|
#CFLAGS+=-DDEFAULT_WINDOW_SYS=\"shim\" -DNOTTYGRAPHICS -DLIBNH
|
||||||
|
|
||||||
|
CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.2020
|
||||||
|
|
||||||
|
VARDATND =
|
||||||
|
VARDATND0 =
|
||||||
|
CURSESLIB =
|
||||||
|
|
||||||
|
ifdef WANT_WIN_CHAIN
|
||||||
|
HINTSRC=$(CHAINSRC)
|
||||||
|
HINTOBJ=$(CHAINOBJ)
|
||||||
|
endif # WANT_WIN_CHAIN
|
||||||
|
|
||||||
|
ifdef WANT_WIN_TTY
|
||||||
|
CURSESLIB = -lncurses
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_CURSES
|
||||||
|
CURSESLIB = -lncurses
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CURSESLIB
|
||||||
|
WINLIB += $(CURSESLIB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_WIN_X11
|
||||||
|
USE_XPM=1
|
||||||
|
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
|
||||||
|
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
|
||||||
|
# -x: if built without dlb, some versions of mkfontdir think *.lev are fonts
|
||||||
|
POSTINSTALL += bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev );
|
||||||
|
# separate from CFLAGS so that we don't pass it to every file
|
||||||
|
X11CFLAGS = -I/opt/X11/include
|
||||||
|
# avoid repeated complaints about _X_NONNULL(args...) in <X11/Xfuncproto.h>
|
||||||
|
X11CFLAGS += -Wno-variadic-macros
|
||||||
|
ifdef USE_XPM
|
||||||
|
CFLAGS += -DUSE_XPM
|
||||||
|
WINX11LIB += -lXpm
|
||||||
|
VARDATND0 += rip.xpm
|
||||||
|
endif
|
||||||
|
WINLIB += $(WINX11LIB)
|
||||||
|
LFLAGS=-L/opt/X11/lib
|
||||||
|
endif # WANT_WIN_X11
|
||||||
|
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
# Qt5 requires C++11
|
||||||
|
LINK = $(CXX)
|
||||||
|
QTCXXFLAGS += -Wno-deprecated-declarations
|
||||||
|
QTCXXFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
|
||||||
|
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
||||||
|
WINSRC += $(WINQTSRC)
|
||||||
|
WINOBJ0 += $(WINQTOBJ)
|
||||||
|
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
|
||||||
|
# XXX if /Developer/qt exists and QTDIR not set, use that
|
||||||
|
ifndef QTDIR
|
||||||
|
$(error QTDIR not defined in the environment or Makefile)
|
||||||
|
endif # QTDIR
|
||||||
|
# XXX make sure QTDIR points to something reasonable
|
||||||
|
else # !WANT_WIN_QT
|
||||||
|
LINK=$(CC)
|
||||||
|
endif # !WANT_WIN_QT
|
||||||
|
|
||||||
|
# prevent duplicate tile.o in WINOBJ
|
||||||
|
WINOBJ = $(sort $(WINOBJ0))
|
||||||
|
# prevent duplicates in VARDATND if both X11 and Qt are being supported
|
||||||
|
VARDATND += $(sort $(VARDATND0))
|
||||||
|
|
||||||
|
WANT_BUNDLE=1
|
||||||
|
ifdef WANT_SHARE_INSTALL
|
||||||
|
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
|
||||||
|
# we install into ~/nethackdir
|
||||||
|
ifeq ($(GAMEUID),root)
|
||||||
|
PREFIX:=/Library/NetHack
|
||||||
|
SHELLDIR=/usr/local/bin
|
||||||
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
|
CHOWN=chown
|
||||||
|
CHGRP=chgrp
|
||||||
|
# We run sgid so the game has access to both HACKDIR and user preferences.
|
||||||
|
GAMEPERM = 02755
|
||||||
|
else # ! root
|
||||||
|
PREFIX:=/Users/$(GAMEUID)
|
||||||
|
SHELLDIR=$(PREFIX)/bin
|
||||||
|
HACKDIR=$(PREFIX)/Library/NetHack/nethackdir
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0500
|
||||||
|
endif # ! root
|
||||||
|
VARFILEPERM = 0664
|
||||||
|
VARDIRPERM = 0775
|
||||||
|
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
|
||||||
|
# XXX it's nice we don't write over sysconf, but we've already erased it
|
||||||
|
# make sure we have group GAMEUID and group GAMEGRP
|
||||||
|
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); \
|
||||||
|
. sys/unix/hints/macosx.sh group2 $(GAMEGRP); \
|
||||||
|
mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
|
||||||
|
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
|
||||||
|
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
|
||||||
|
|
||||||
|
else ifdef WANT_SOURCE_INSTALL
|
||||||
|
|
||||||
|
PREFIX=$(abspath $(NHSROOT))
|
||||||
|
# suppress nethack.sh
|
||||||
|
#SHELLDIR=
|
||||||
|
HACKDIR=$(PREFIX)/playground
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0700
|
||||||
|
VARFILEPERM = 0600
|
||||||
|
VARDIRPERM = 0700
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf;
|
||||||
|
# We can use "make all" to build the whole thing - but it misses some things:
|
||||||
|
MOREALL=$(MAKE) install
|
||||||
|
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||||
|
|
||||||
|
else # !WANT_SOURCE_INSTALL
|
||||||
|
|
||||||
|
PREFIX:=$(wildcard ~)
|
||||||
|
SHELLDIR=$(PREFIX)/bin
|
||||||
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0700
|
||||||
|
VARFILEPERM = 0600
|
||||||
|
VARDIRPERM = 0700
|
||||||
|
ifdef ($(WANT_DEFAULT),X11)
|
||||||
|
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
|
||||||
|
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true
|
||||||
|
endif # WANT_DEFAULT X11
|
||||||
|
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
|
||||||
|
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
|
||||||
|
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
|
||||||
|
ifdef WANT_BUNDLE
|
||||||
|
#
|
||||||
|
# Bundle
|
||||||
|
#
|
||||||
|
# $(HACKDIR)/$(GAME).app/
|
||||||
|
# Contents/
|
||||||
|
# Frameworks/
|
||||||
|
# Info.plist
|
||||||
|
# MacOS/
|
||||||
|
# $(GAME)
|
||||||
|
# PkgInfo/
|
||||||
|
# PlugIns/
|
||||||
|
# Resources/
|
||||||
|
# SharedFrameWorks/
|
||||||
|
#
|
||||||
|
BUNDLE = mkdir -p $(HACKDIR)/nethack.app/Contents/MacOS; \
|
||||||
|
sys/unix/hints/macosx.sh infoplist > $(HACKDIR)/nethack.app/Contents/Info.plist; \
|
||||||
|
mv $(HACKDIR)/nethack $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
|
||||||
|
ifdef WANT_SHARE_INSTALL
|
||||||
|
BUNDLE+= chmod $(GAMEPERM) $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
|
||||||
|
endif
|
||||||
|
|
||||||
|
POSTINSTALL+= $(BUNDLE)
|
||||||
|
POSTINSTALL+= if test -f $(SHELLDIR)/$(GAME); then \
|
||||||
|
sed -i '' 's;HACKDIR/$(GAME);HACKDIR/$(GAME).app/Contents/MacOS/$(GAME);' $(SHELLDIR)/$(GAME) ; fi;
|
||||||
|
endif # WANT_BUNDLE
|
||||||
|
endif # !WANT_SHARE_INSTALL
|
||||||
|
|
||||||
|
INSTDIR=$(HACKDIR)
|
||||||
|
VARDIR=$(HACKDIR)
|
||||||
|
|
||||||
|
# ~/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 (it seems to be in the Qt binary
|
||||||
|
# package under the docs directory).
|
||||||
|
|
||||||
|
#-POST
|
||||||
|
ifdef MAKEFILE_TOP
|
||||||
|
###
|
||||||
|
### Packaging
|
||||||
|
###
|
||||||
|
# Notes:
|
||||||
|
# 1) The Apple developer utilities must be installed in the default location.
|
||||||
|
# 2) Do a normal build before trying to package the game.
|
||||||
|
# 3) This matches the 3.4.3 Term package, but there are some things that
|
||||||
|
# should be changed.
|
||||||
|
#
|
||||||
|
# Packages that are being distributed must be signed by a Developer ID
|
||||||
|
# Installer certificate. Set DEVELOPER_CERT to the name of the certificate
|
||||||
|
# if you wish for your package to be signed for distribution.
|
||||||
|
#
|
||||||
|
# If building a package for signing, you must use sudo approriately.
|
||||||
|
# the binaries and package using sudo but you DO NOT use sudo to sign the
|
||||||
|
# package. If you use sudo to sign the package, it will fail.
|
||||||
|
#
|
||||||
|
# sudo make all
|
||||||
|
# sudo make build_tty_pkg
|
||||||
|
# make sign_tty_pkg
|
||||||
|
#
|
||||||
|
|
||||||
|
ifdef WANT_WIN_TTY
|
||||||
|
DEVUTIL=/Developer/Applications/Utilities
|
||||||
|
SVS=$(shell $(NHSROOT)/util/makedefs --svs)
|
||||||
|
SVSDOT=$(shell $(NHSROOT)/util/makedefs --svs .)
|
||||||
|
|
||||||
|
PKGROOT_UG = PKGROOT/$(PREFIX)
|
||||||
|
PKGROOT_UGLN = PKGROOT/$(HACKDIR)
|
||||||
|
PKGROOT_BIN = PKGROOT/$(SHELLDIR)
|
||||||
|
|
||||||
|
#DEVELOPER_CERT = Developer ID Installer: Bart House
|
||||||
|
DEVELOPER_CERT = NONE
|
||||||
|
|
||||||
|
spotless::
|
||||||
|
rm -rf RESOURCES
|
||||||
|
rm -rf PKG
|
||||||
|
rm -rf PKGSCRIPTS
|
||||||
|
rm -rf PKGROOT
|
||||||
|
rm -f Info.plist
|
||||||
|
rm -f Distribution.xml
|
||||||
|
rm -f NetHack-*-mac-Term*
|
||||||
|
|
||||||
|
build_tty_pkg:
|
||||||
|
ifneq (,$(WANT_WIN_X11)$(WANT_WIN_QT))
|
||||||
|
-echo build_tty_pkg only works for a tty-only build
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
rm -rf NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
|
||||||
|
$(MAKE) build_package_root
|
||||||
|
rm -rf RESOURCES
|
||||||
|
mkdir RESOURCES
|
||||||
|
#enscript --language=rtf -o - < dat/license >RESOURCES/License.rtf
|
||||||
|
sys/unix/hints/macosx.sh descplist > RESOURCES/Description.plist
|
||||||
|
sys/unix/hints/macosx.sh infoplist > Info.plist
|
||||||
|
|
||||||
|
mkdir PKGROOT/Applications
|
||||||
|
#osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
|
||||||
|
# win/macosx/NetHackRecover.applescript
|
||||||
|
#cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
|
||||||
|
osacompile -o PKGROOT/Applications/NetHackRecover.app \
|
||||||
|
win/macosx/NetHackRecover.applescript
|
||||||
|
cp win/macosx/recover.pl $(PKGROOT_UGLN)
|
||||||
|
|
||||||
|
osacompile -o PKGROOT/Applications/NetHackTerm.app \
|
||||||
|
win/macosx/NetHackTerm.applescript
|
||||||
|
|
||||||
|
# XXX integrate into Makefile.doc
|
||||||
|
(cd doc; cat Guidebook.mn | ../util/makedefs --grep --input - --output - \
|
||||||
|
| tbl tmac.n - | groff | pstopdf -i -o Guidebook.pdf)
|
||||||
|
cp doc/Guidebook.pdf $(PKGROOT_UG)/doc/NetHackGuidebook.pdf
|
||||||
|
|
||||||
|
osacompile -o PKGROOT/Applications/NetHackGuidebook.app \
|
||||||
|
win/macosx/NetHackGuidebook.applescript
|
||||||
|
|
||||||
|
mkdir -p PKG
|
||||||
|
pkgbuild --root PKGROOT --identifier org.nethack.term --scripts PKGSCRIPTS PKG/NH-Term.pkg
|
||||||
|
productbuild --synthesize --product Info.plist --package PKG/NH-Term.pkg Distribution.xml
|
||||||
|
productbuild --distribution Distribution.xml --resources RESOURCES --package-path PKG NetHack-$(SVS)-mac-Term-unsigned.pkg
|
||||||
|
ifeq ($(DEVELOPER_CERT),NONE)
|
||||||
|
cp NetHack-$(SVS)-mac-Term-unsigned.pkg NetHack-$(SVS)-mac-Term.pkg
|
||||||
|
hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term-unsigned.pkg NetHack-$(SVS)-mac-Term-unsigned.dmg
|
||||||
|
@echo -------------------------------------------
|
||||||
|
@echo PACKAGE IS NOT SIGNED FOR DISTRIBUTION!!!!!
|
||||||
|
@echo ===========================================
|
||||||
|
else
|
||||||
|
@echo "run 'make sign_tty_pkg' to complete package"
|
||||||
|
endif
|
||||||
|
|
||||||
|
sign_tty_pkg:
|
||||||
|
productsign --timestamp=none --sign "$(DEVELOPER_CERT)" NetHack-$(SVS)-mac-Term-unsigned.pkg NetHack-$(SVS)-mac-Term.pkg || (echo "Package signing failed"; exit 1)
|
||||||
|
spctl -a -v --type install NetHack-$(SVS)-mac-Term.pkg || (echo "Package not signed properly"; exit 1)
|
||||||
|
hdiutil create -verbose -srcfolder NetHack-$(SVS)-mac-Term.pkg NetHack-$(SVS)-mac-Term.dmg
|
||||||
|
|
||||||
|
build_package_root:
|
||||||
|
cd src/.. # make sure we are at TOP
|
||||||
|
rm -rf PKGROOT
|
||||||
|
mkdir -p $(PKGROOT_UG)/lib $(PKGROOT_BIN) $(PKGROOT_UG)/man/man6 $(PKGROOT_UG)/doc $(PKGROOT_UGLN)
|
||||||
|
install -p src/nethack $(PKGROOT_BIN)
|
||||||
|
# XXX should this be called nethackrecover?
|
||||||
|
install -p util/recover $(PKGROOT_BIN)
|
||||||
|
install -p doc/nethack.6 $(PKGROOT_UG)/man/man6
|
||||||
|
install -p doc/recover.6 $(PKGROOT_UG)/man/man6
|
||||||
|
install -p doc/Guidebook $(PKGROOT_UG)/doc
|
||||||
|
install -p dat/nhdat $(PKGROOT_UGLN)
|
||||||
|
sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf
|
||||||
|
cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
|
||||||
|
# XXX these files should be somewhere else for good Mac form
|
||||||
|
touch $(PKGROOT_UGLN)/perm $(PKGROOT_UGLN)/record $(PKGROOT_UGLN)/logfile $(PKGROOT_UGLN)/xlogfile
|
||||||
|
mkdir $(PKGROOT_UGLN)/save
|
||||||
|
# XXX what about a news file?
|
||||||
|
|
||||||
|
mkdir -p PKGSCRIPTS
|
||||||
|
echo '#!/bin/sh' > PKGSCRIPTS/postinstall
|
||||||
|
echo dseditgroup -o create -r '"Games Group"' -s 3600 $(GAMEGRP) >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHOWN) $(GAMEUID) $(HACKDIR) >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHOWN) $(GAMEUID) $(HACKDIR)/* >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHGRP) $(GAMEGRP) $(HACKDIR) >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHGRP) $(GAMEGRP) $(HACKDIR)/* >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHOWN) $(GAMEUID) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
|
||||||
|
echo $(CHGRP) $(GAMEGRP) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARDIRPERM) $(HACKDIR) >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARDIRPERM) $(HACKDIR)/save >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(FILEPERM) $(HACKDIR)/license >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(FILEPERM) $(HACKDIR)/nhdat >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(FILEPERM) $(HACKDIR)/symbols >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARFILEPERM) $(HACKDIR)/perm >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARFILEPERM) $(HACKDIR)/record >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARFILEPERM) $(HACKDIR)/logfile >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARFILEPERM) $(HACKDIR)/xlogfile >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(VARFILEPERM) $(HACKDIR)/sysconf >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(GAMEPERM) $(SHELLDIR)/nethack >> PKGSCRIPTS/postinstall
|
||||||
|
echo chmod $(EXEPERM) $(SHELLDIR)/recover >> PKGSCRIPTS/postinstall
|
||||||
|
chmod 0775 PKGSCRIPTS/postinstall
|
||||||
|
|
||||||
|
endif # end of build_tty_pkg
|
||||||
|
endif # WANT_WIN_TTY for packaging
|
||||||
|
|
||||||
|
ifdef WANT_WIN_QT
|
||||||
|
# XXX untested and incomplete (see below)
|
||||||
|
build_qt_pkg:
|
||||||
|
ifneq (,$(WANT_WIN_X11)$(WANT_WIN_TTY))
|
||||||
|
-echo build_qt_pkg only works for a qt-only build
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
$(MAKE) build_package_root
|
||||||
|
rm -rf NetHackQt
|
||||||
|
mkdir -p NetHackQt/NetHackQt.app/nethackdir/save
|
||||||
|
mkdir NetHackQt/Documentation
|
||||||
|
cp doc/Guidebook.txt doc/nethack.txt doc/recover.txt NetHackQt/Documentation
|
||||||
|
|
||||||
|
osacompile -o NetHackQt/NetHackQt.app/nethackdir/NetHackRecover.app \
|
||||||
|
win/macosx/NetHackRecover.applescript
|
||||||
|
cp win/macosx/recover.pl NetHackQt/NetHackQt.app/nethackdir
|
||||||
|
|
||||||
|
mkdir -p NetHackQt/NetHackQt.app/Contents/Frameworks
|
||||||
|
cp $(QTDIR)/libqt-mt.3.dylib NetHackQt/NetHackQt.app/Contents/Frameworks
|
||||||
|
|
||||||
|
mkdir NetHackQt/NetHackQt.app/Contents/MacOS
|
||||||
|
mv PKGROOT/nethack NetHackQt/NetHackQt.app/Contents/MacOS
|
||||||
|
|
||||||
|
mv PKGROOT/lib/nethackdir NetHackQt/NetHackQt.app/nethackdir
|
||||||
|
|
||||||
|
# XXX still missing:
|
||||||
|
#NetHackQt/NetHackQt.app
|
||||||
|
# /Contents
|
||||||
|
# Info.plist
|
||||||
|
# Resources/nethack.icns
|
||||||
|
#NetHackQt/Documentation
|
||||||
|
#NetHackQtRecover.txt
|
||||||
|
#NetHack Defaults.txt
|
||||||
|
#changes.patch XXX is this still needed? why isn't it part of the tree?
|
||||||
|
# doesn't go here
|
||||||
|
hdiutil create -verbose -srcfolder NetHackQt NetHack-$(SVS)-macosx-qt.dmg
|
||||||
|
endif # end of build_qt_pkg
|
||||||
|
endif # WANT_WIN_QT for packaging
|
||||||
|
endif # MAKEFILE_TOP
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
|
||||||
|
#-PRE xxxx
|
||||||
|
# enscripten WebAssembly config
|
||||||
|
|
||||||
|
WANT_WASM=1
|
||||||
|
WASM_DEBUG=1
|
||||||
|
WASM_DATA_DIR=$(NHSROOT)/src/wasm-data/Users/ampower/nethackdir
|
||||||
|
|
||||||
|
# toolchain
|
||||||
|
EMCC=emcc
|
||||||
|
EMAR=emar rcu
|
||||||
|
EMRANLIB=emranlib
|
||||||
|
|
||||||
|
# link flags
|
||||||
|
EMCC_LFLAGS=-s SINGLE_FILE=1
|
||||||
|
EMCC_LFLAGS=-s WASM=1
|
||||||
|
EMCC_LFLAGS+=-s ALLOW_TABLE_GROWTH
|
||||||
|
EMCC_LFLAGS+=-s ASYNCIFY -s ASYNCIFY_IMPORTS='["_nhmain"]' -O3
|
||||||
|
EMCC_LFLAGS+=-s MODULARIZE
|
||||||
|
EMCC_LFLAGS+=-s EXPORTED_FUNCTIONS='["_main"]'
|
||||||
|
EMCC_LFLAGS+=-s EXPORTED_RUNTIME_METHODS='["cwrap", "ccall", "addFunction", "removeFunction", "UTF8ToString"]'
|
||||||
|
EMCC_LFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=0
|
||||||
|
EMCC_LFLAGS+=--embed-file wasm-data@/
|
||||||
|
|
||||||
|
# WASM C flags
|
||||||
|
EMCC_CFLAGS=
|
||||||
|
EMCC_CFLAGS+=-Wall -Werror
|
||||||
|
EMCC_CFLAGS+=-DWASM
|
||||||
|
EMCC_DEBUG_CFLAGS+=-s ASSERTIONS=1
|
||||||
|
EMCC_DEBUG_CFLAGS+=-s STACK_OVERFLOW_CHECK=2
|
||||||
|
EMCC_DEBUG_CFLAGS+=-s SAFE_HEAP=1
|
||||||
|
EMCC_DEBUG_CFLAGS+=-s LLD_REPORT_UNDEFINED
|
||||||
|
EMCC_PROD_CFLAGS+=-O3
|
||||||
|
|
||||||
|
# Nethack C flags
|
||||||
|
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||||
|
CFLAGS+=-g -I../include -DNOTPARMDECL
|
||||||
|
CFLAGS+=-Wall -Werror
|
||||||
|
CFLAGS+=-DGCC_WARN
|
||||||
|
|
||||||
|
# NetHack sources control
|
||||||
|
CFLAGS+=-DDLB
|
||||||
|
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
|
||||||
|
CFLAGS+=-DDLB
|
||||||
|
CFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
|
||||||
|
CFLAGS+=-DNOMAIL
|
||||||
|
|
||||||
|
ifdef WASM_DEBUG
|
||||||
|
EMCC_CFLAGS+=$(EMCC_DEBUG_CFLAGS)
|
||||||
|
else
|
||||||
|
EMCC_CFLAGS+=$(EMCC_PROD_CFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WANT_SHARE_INSTALL
|
||||||
|
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
|
||||||
|
# we install into ~/nethackdir
|
||||||
|
ifeq ($(GAMEUID),root)
|
||||||
|
PREFIX:=/Library/NetHack
|
||||||
|
SHELLDIR=/usr/local/bin
|
||||||
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
|
CHOWN=chown
|
||||||
|
CHGRP=chgrp
|
||||||
|
# We run sgid so the game has access to both HACKDIR and user preferences.
|
||||||
|
GAMEPERM = 02755
|
||||||
|
else # ! root
|
||||||
|
PREFIX:=/Users/$(GAMEUID)
|
||||||
|
SHELLDIR=$(PREFIX)/bin
|
||||||
|
HACKDIR=$(PREFIX)/Library/NetHack/nethackdir
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0500
|
||||||
|
endif # ! root
|
||||||
|
VARFILEPERM = 0664
|
||||||
|
VARDIRPERM = 0775
|
||||||
|
ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
|
||||||
|
# XXX it's nice we don't write over sysconf, but we've already erased it
|
||||||
|
# make sure we have group GAMEUID and group GAMEGRP
|
||||||
|
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); \
|
||||||
|
. sys/unix/hints/macosx.sh group2 $(GAMEGRP); \
|
||||||
|
mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
|
||||||
|
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
|
||||||
|
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
|
||||||
|
|
||||||
|
else ifdef WANT_SOURCE_INSTALL
|
||||||
|
|
||||||
|
PREFIX=$(abspath $(NHSROOT))
|
||||||
|
# suppress nethack.sh
|
||||||
|
#SHELLDIR=
|
||||||
|
HACKDIR=$(PREFIX)/playground
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0700
|
||||||
|
VARFILEPERM = 0600
|
||||||
|
VARDIRPERM = 0700
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf;
|
||||||
|
# We can use "make all" to build the whole thing - but it misses some things:
|
||||||
|
MOREALL=$(MAKE) install
|
||||||
|
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||||
|
|
||||||
|
else # !WANT_SOURCE_INSTALL
|
||||||
|
|
||||||
|
PREFIX:=$(wildcard ~)
|
||||||
|
SHELLDIR=$(PREFIX)/bin
|
||||||
|
HACKDIR=$(PREFIX)/nethackdir
|
||||||
|
CHOWN=/usr/bin/true
|
||||||
|
CHGRP=/usr/bin/true
|
||||||
|
GAMEPERM = 0700
|
||||||
|
VARFILEPERM = 0600
|
||||||
|
VARDIRPERM = 0700
|
||||||
|
ifdef ($(WANT_DEFAULT),X11)
|
||||||
|
# install nethack.rc as ~/.nethackrc if no ~/.nethackrc exists
|
||||||
|
PREINSTALL= cp -n win/X11/nethack.rc ~/.nethackrc || true
|
||||||
|
endif # WANT_DEFAULT X11
|
||||||
|
|
||||||
|
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
|
||||||
|
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
|
||||||
|
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
|
||||||
|
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
|
||||||
|
ifdef WANT_BUNDLE
|
||||||
|
#
|
||||||
|
# Bundle
|
||||||
|
#
|
||||||
|
# $(HACKDIR)/$(GAME).app/
|
||||||
|
# Contents/
|
||||||
|
# Frameworks/
|
||||||
|
# Info.plist
|
||||||
|
# MacOS/
|
||||||
|
# $(GAME)
|
||||||
|
# PkgInfo/
|
||||||
|
# PlugIns/
|
||||||
|
# Resources/
|
||||||
|
# SharedFrameWorks/
|
||||||
|
#
|
||||||
|
BUNDLE = mkdir -p $(HACKDIR)/nethack.app/Contents/MacOS; \
|
||||||
|
sys/unix/hints/macosx.sh infoplist > $(HACKDIR)/nethack.app/Contents/Info.plist; \
|
||||||
|
mv $(HACKDIR)/nethack $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
|
||||||
|
ifdef WANT_SHARE_INSTALL
|
||||||
|
BUNDLE+= chmod $(GAMEPERM) $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
|
||||||
|
endif
|
||||||
|
|
||||||
|
POSTINSTALL+= $(BUNDLE)
|
||||||
|
POSTINSTALL+= if test -f $(SHELLDIR)/$(GAME); then \
|
||||||
|
sed -i '' 's;HACKDIR/$(GAME);HACKDIR/$(GAME).app/Contents/MacOS/$(GAME);' $(SHELLDIR)/$(GAME) ; fi;
|
||||||
|
endif # WANT_BUNDLE
|
||||||
|
endif # !WANT_SHARE_INSTALL
|
||||||
|
|
||||||
|
INSTDIR=$(HACKDIR)
|
||||||
|
VARDIR=$(HACKDIR)
|
||||||
|
|
||||||
|
#-POST
|
||||||
|
# no post
|
||||||
@@ -0,0 +1,824 @@
|
|||||||
|
/* NetHack 3.7 unixmain.c $NHDT-Date: 1596498297 2020/08/03 23:44:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ */
|
||||||
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
|
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||||
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
|
/* main.c - Unix NetHack */
|
||||||
|
|
||||||
|
#include "hack.h"
|
||||||
|
#include "dlb.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#ifndef O_RDONLY
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* for cross-compiling to WebAssembly (WASM) */
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
#include <emscripten/emscripten.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX)
|
||||||
|
#if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__))
|
||||||
|
#if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX)
|
||||||
|
extern struct passwd *FDECL(getpwuid, (uid_t));
|
||||||
|
#else
|
||||||
|
extern struct passwd *FDECL(getpwuid, (int));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
extern struct passwd *FDECL(getpwnam, (const char *));
|
||||||
|
#ifdef CHDIR
|
||||||
|
static void FDECL(chdirx, (const char *, BOOLEAN_P));
|
||||||
|
#endif /* CHDIR */
|
||||||
|
static boolean NDECL(whoami);
|
||||||
|
static void FDECL(process_options, (int, char **));
|
||||||
|
|
||||||
|
#ifdef _M_UNIX
|
||||||
|
extern void NDECL(check_sco_console);
|
||||||
|
extern void NDECL(init_sco_cons);
|
||||||
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
extern void NDECL(check_linux_console);
|
||||||
|
extern void NDECL(init_linux_cons);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void NDECL(wd_message);
|
||||||
|
static boolean wiz_error_flag = FALSE;
|
||||||
|
static struct passwd *NDECL(get_unix_pw);
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
/* if WebAssembly, export this API and don't optimize it out */
|
||||||
|
EMSCRIPTEN_KEEPALIVE
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
|
||||||
|
#else /* !__EMSCRIPTEN__ */
|
||||||
|
|
||||||
|
int
|
||||||
|
nhmain(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
|
||||||
|
#endif /* __EMSCRIPTEN__ */
|
||||||
|
{
|
||||||
|
#ifdef CHDIR
|
||||||
|
register char *dir;
|
||||||
|
#endif
|
||||||
|
NHFILE *nhfp;
|
||||||
|
boolean exact_username;
|
||||||
|
boolean resuming = FALSE; /* assume new game */
|
||||||
|
boolean plsel_once = FALSE;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
printf ("nhmain\n");
|
||||||
|
printf ("argc: %d\n", argc);
|
||||||
|
printf ("argv: %p\n", (void *)argv);
|
||||||
|
for (i = 0; i < argc; i++) {
|
||||||
|
printf ("argv[%d]: %s\n", i, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
early_init();
|
||||||
|
|
||||||
|
#if 0 /* __APPLE__ */
|
||||||
|
{
|
||||||
|
/* special hack to change working directory to a resource fork when
|
||||||
|
running from finder --sam */
|
||||||
|
#define MAC_PATH_VALUE ".app/Contents/MacOS/"
|
||||||
|
char mac_cwd[1024], *mac_exe = argv[0], *mac_tmp;
|
||||||
|
int arg0_len = strlen(mac_exe), mac_tmp_len, mac_lhs_len = 0;
|
||||||
|
getcwd(mac_cwd, 1024);
|
||||||
|
if (mac_exe[0] == '/' && !strcmp(mac_cwd, "/")) {
|
||||||
|
if ((mac_exe = strrchr(mac_exe, '/')))
|
||||||
|
mac_exe++;
|
||||||
|
else
|
||||||
|
mac_exe = argv[0];
|
||||||
|
mac_tmp_len = (strlen(mac_exe) * 2) + strlen(MAC_PATH_VALUE);
|
||||||
|
if (mac_tmp_len <= arg0_len) {
|
||||||
|
mac_tmp = malloc(mac_tmp_len + 1);
|
||||||
|
sprintf(mac_tmp, "%s%s%s", mac_exe, MAC_PATH_VALUE, mac_exe);
|
||||||
|
if (!strcmp(argv[0] + (arg0_len - mac_tmp_len), mac_tmp)) {
|
||||||
|
mac_lhs_len =
|
||||||
|
(arg0_len - mac_tmp_len) + strlen(mac_exe) + 5;
|
||||||
|
if (mac_lhs_len > mac_tmp_len - 1)
|
||||||
|
mac_tmp = realloc(mac_tmp, mac_lhs_len);
|
||||||
|
strncpy(mac_tmp, argv[0], mac_lhs_len);
|
||||||
|
mac_tmp[mac_lhs_len] = '\0';
|
||||||
|
chdir(mac_tmp);
|
||||||
|
}
|
||||||
|
free(mac_tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
|
g.hname = argv[0];
|
||||||
|
g.hackpid = getpid();
|
||||||
|
(void) umask(0777 & ~FCMASK);
|
||||||
|
|
||||||
|
choose_windows(DEFAULT_WINDOW_SYS);
|
||||||
|
|
||||||
|
#ifdef CHDIR /* otherwise no chdir() */
|
||||||
|
/*
|
||||||
|
* See if we must change directory to the playground.
|
||||||
|
* (Perhaps hack runs suid and playground is inaccessible
|
||||||
|
* for the player.)
|
||||||
|
* The environment variable HACKDIR is overridden by a
|
||||||
|
* -d command line option (must be the first option given).
|
||||||
|
*/
|
||||||
|
dir = nh_getenv("NETHACKDIR");
|
||||||
|
if (!dir)
|
||||||
|
dir = nh_getenv("HACKDIR");
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
if (argcheck(argc, argv, ARG_VERSION) == 2)
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
|
if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) {
|
||||||
|
#ifdef CHDIR
|
||||||
|
chdirx((char *) 0, 0);
|
||||||
|
#endif
|
||||||
|
iflags.initoptions_noterminate = TRUE;
|
||||||
|
initoptions();
|
||||||
|
iflags.initoptions_noterminate = FALSE;
|
||||||
|
reveal_paths();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
|
||||||
|
/* avoid matching "-dec" for DECgraphics; since the man page
|
||||||
|
* says -d directory, hope nobody's using -desomething_else
|
||||||
|
*/
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
dir = argv[0] + 2;
|
||||||
|
if (*dir == '=' || *dir == ':')
|
||||||
|
dir++;
|
||||||
|
if (!*dir && argc > 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
dir = argv[0];
|
||||||
|
}
|
||||||
|
if (!*dir)
|
||||||
|
error("Flag -d must be followed by a directory name.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CHDIR */
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
/*
|
||||||
|
* Now we know the directory containing 'record' and
|
||||||
|
* may do a prscore(). Exclude `-style' - it's a Qt option.
|
||||||
|
*/
|
||||||
|
if (!strncmp(argv[1], "-s", 2) && strncmp(argv[1], "-style", 6)) {
|
||||||
|
#ifdef CHDIR
|
||||||
|
chdirx(dir, 0);
|
||||||
|
#endif
|
||||||
|
#ifdef SYSCF
|
||||||
|
initoptions();
|
||||||
|
#endif
|
||||||
|
#ifdef PANICTRACE
|
||||||
|
ARGV0 = g.hname; /* save for possible stack trace */
|
||||||
|
#ifndef NO_SIGNAL
|
||||||
|
panictrace_setsignals(TRUE);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
prscore(argc, argv);
|
||||||
|
/* FIXME: shouldn't this be using nh_terminate() to free
|
||||||
|
up any memory allocated by initoptions() */
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
} /* argc > 1 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change directories before we initialize the window system so
|
||||||
|
* we can find the tile file.
|
||||||
|
*/
|
||||||
|
#ifdef CHDIR
|
||||||
|
chdirx(dir, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _M_UNIX
|
||||||
|
check_sco_console();
|
||||||
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
check_linux_console();
|
||||||
|
#endif
|
||||||
|
initoptions();
|
||||||
|
#ifdef PANICTRACE
|
||||||
|
ARGV0 = g.hname; /* save for possible stack trace */
|
||||||
|
#ifndef NO_SIGNAL
|
||||||
|
panictrace_setsignals(TRUE);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
exact_username = whoami();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It seems you really want to play.
|
||||||
|
*/
|
||||||
|
u.uhp = 1; /* prevent RIP on early quits */
|
||||||
|
g.program_state.preserve_locks = 1;
|
||||||
|
#ifndef NO_SIGNAL
|
||||||
|
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
process_options(argc, argv); /* command line options */
|
||||||
|
#ifdef WINCHAIN
|
||||||
|
commit_windowchain();
|
||||||
|
#endif
|
||||||
|
init_nhwindows(&argc, argv); /* now we can set up window system */
|
||||||
|
#ifdef _M_UNIX
|
||||||
|
init_sco_cons();
|
||||||
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
init_linux_cons();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEF_PAGER
|
||||||
|
if (!(g.catmore = nh_getenv("HACKPAGER"))
|
||||||
|
&& !(g.catmore = nh_getenv("PAGER")))
|
||||||
|
g.catmore = DEF_PAGER;
|
||||||
|
#endif
|
||||||
|
#ifdef MAIL
|
||||||
|
getmailstatus();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* wizard mode access is deferred until here */
|
||||||
|
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||||
|
/* hide any hyphens from plnamesuffix() */
|
||||||
|
g.plnamelen = exact_username ? (int) strlen(g.plname) : 0;
|
||||||
|
/* strip role,race,&c suffix; calls askname() if plname[] is empty
|
||||||
|
or holds a generic user name like "player" or "games" */
|
||||||
|
plnamesuffix();
|
||||||
|
|
||||||
|
if (wizard) {
|
||||||
|
/* use character name rather than lock letter for file names */
|
||||||
|
g.locknum = 0;
|
||||||
|
} else {
|
||||||
|
/* suppress interrupts while processing lock file */
|
||||||
|
(void) signal(SIGQUIT, SIG_IGN);
|
||||||
|
(void) signal(SIGINT, SIG_IGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
dlb_init(); /* must be before newgame() */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the vision system. This must be before mklev() on a
|
||||||
|
* new game or before a level restore on a saved game.
|
||||||
|
*/
|
||||||
|
vision_init();
|
||||||
|
|
||||||
|
display_gamewindows();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* First, try to find and restore a save file for specified character.
|
||||||
|
* We'll return here if new game player_selection() renames the hero.
|
||||||
|
*/
|
||||||
|
attempt_restore:
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getlock() complains and quits if there is already a game
|
||||||
|
* in progress for current character name (when g.locknum == 0)
|
||||||
|
* or if there are too many active games (when g.locknum > 0).
|
||||||
|
* When proceeding, it creates an empty <lockname>.0 file to
|
||||||
|
* designate the current game.
|
||||||
|
* getlock() constructs <lockname> based on the character
|
||||||
|
* name (for !g.locknum) or on first available of alock, block,
|
||||||
|
* clock, &c not currently in use in the playground directory
|
||||||
|
* (for g.locknum > 0).
|
||||||
|
*/
|
||||||
|
if (*g.plname) {
|
||||||
|
getlock();
|
||||||
|
g.program_state.preserve_locks = 0; /* after getlock() */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*g.plname && (nhfp = restore_saved_game()) != 0) {
|
||||||
|
const char *fq_save = fqname(g.SAVEF, SAVEPREFIX, 1);
|
||||||
|
|
||||||
|
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
||||||
|
#ifndef NO_SIGNAL
|
||||||
|
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||||
|
#endif
|
||||||
|
#ifdef NEWS
|
||||||
|
if (iflags.news) {
|
||||||
|
display_file(NEWS, FALSE);
|
||||||
|
iflags.news = FALSE; /* in case dorecover() fails */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pline("Restoring save file...");
|
||||||
|
mark_synch(); /* flush output */
|
||||||
|
if (dorecover(nhfp)) {
|
||||||
|
resuming = TRUE; /* not starting new game */
|
||||||
|
wd_message();
|
||||||
|
if (discover || wizard) {
|
||||||
|
/* this seems like a candidate for paranoid_confirmation... */
|
||||||
|
if (yn("Do you want to keep the save file?") == 'n') {
|
||||||
|
(void) delete_savefile();
|
||||||
|
} else {
|
||||||
|
(void) chmod(fq_save, FCMASK); /* back to readable */
|
||||||
|
nh_compress(fq_save);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!resuming) {
|
||||||
|
boolean neednewlock = (!*g.plname);
|
||||||
|
/* new game: start by choosing role, race, etc;
|
||||||
|
player might change the hero's name while doing that,
|
||||||
|
in which case we try to restore under the new name
|
||||||
|
and skip selection this time if that didn't succeed */
|
||||||
|
if (!iflags.renameinprogress || iflags.defer_plname || neednewlock) {
|
||||||
|
if (!plsel_once)
|
||||||
|
player_selection();
|
||||||
|
plsel_once = TRUE;
|
||||||
|
if (neednewlock && *g.plname)
|
||||||
|
goto attempt_restore;
|
||||||
|
if (iflags.renameinprogress) {
|
||||||
|
/* player has renamed the hero while selecting role;
|
||||||
|
if locking alphabetically, the existing lock file
|
||||||
|
can still be used; otherwise, discard current one
|
||||||
|
and create another for the new character name */
|
||||||
|
if (!g.locknum) {
|
||||||
|
delete_levelfile(0); /* remove empty lock file */
|
||||||
|
getlock();
|
||||||
|
}
|
||||||
|
goto attempt_restore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newgame();
|
||||||
|
wd_message();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* moveloop() never returns but isn't flagged NORETURN */
|
||||||
|
moveloop(resuming);
|
||||||
|
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
/*NOTREACHED*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* caveat: argv elements might be arbitrary long */
|
||||||
|
static void
|
||||||
|
process_options(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
int i, l;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process options.
|
||||||
|
*/
|
||||||
|
while (argc > 1 && argv[1][0] == '-') {
|
||||||
|
argv++;
|
||||||
|
argc--;
|
||||||
|
l = (int) strlen(*argv);
|
||||||
|
/* must supply at least 4 chars to match "-XXXgraphics" */
|
||||||
|
if (l < 4)
|
||||||
|
l = 4;
|
||||||
|
|
||||||
|
switch (argv[0][1]) {
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
if ((argv[0][1] == 'D' && !argv[0][2])
|
||||||
|
|| !strcmpi(*argv, "-debug")) {
|
||||||
|
wizard = TRUE, discover = FALSE;
|
||||||
|
} else if (!strncmpi(*argv, "-DECgraphics", l)) {
|
||||||
|
load_symset("DECGraphics", PRIMARY);
|
||||||
|
switch_symbols(TRUE);
|
||||||
|
} else {
|
||||||
|
raw_printf("Unknown option: %.60s", *argv);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'X':
|
||||||
|
discover = TRUE, wizard = FALSE;
|
||||||
|
break;
|
||||||
|
#ifdef NEWS
|
||||||
|
case 'n':
|
||||||
|
iflags.news = FALSE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 'u':
|
||||||
|
if (argv[0][2]) {
|
||||||
|
(void) strncpy(g.plname, argv[0] + 2, sizeof g.plname - 1);
|
||||||
|
g.plnamelen = 0; /* plname[] might have -role-race attached */
|
||||||
|
} else if (argc > 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
(void) strncpy(g.plname, argv[0], sizeof g.plname - 1);
|
||||||
|
g.plnamelen = 0;
|
||||||
|
} else {
|
||||||
|
raw_print("Player name expected after -u");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
case 'i':
|
||||||
|
if (!strncmpi(*argv, "-IBMgraphics", l)) {
|
||||||
|
load_symset("IBMGraphics", PRIMARY);
|
||||||
|
load_symset("RogueIBM", ROGUESET);
|
||||||
|
switch_symbols(TRUE);
|
||||||
|
} else {
|
||||||
|
raw_printf("Unknown option: %.60s", *argv);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'p': /* profession (role) */
|
||||||
|
if (argv[0][2]) {
|
||||||
|
if ((i = str2role(&argv[0][2])) >= 0)
|
||||||
|
flags.initrole = i;
|
||||||
|
} else if (argc > 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
if ((i = str2role(argv[0])) >= 0)
|
||||||
|
flags.initrole = i;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'r': /* race */
|
||||||
|
if (argv[0][2]) {
|
||||||
|
if ((i = str2race(&argv[0][2])) >= 0)
|
||||||
|
flags.initrace = i;
|
||||||
|
} else if (argc > 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
if ((i = str2race(argv[0])) >= 0)
|
||||||
|
flags.initrace = i;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'w': /* windowtype */
|
||||||
|
config_error_init(FALSE, "command line", FALSE);
|
||||||
|
choose_windows(&argv[0][2]);
|
||||||
|
config_error_done();
|
||||||
|
break;
|
||||||
|
case '@':
|
||||||
|
flags.randomall = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if ((i = str2role(&argv[0][1])) >= 0) {
|
||||||
|
flags.initrole = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* else raw_printf("Unknown option: %.60s", *argv); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SYSCF
|
||||||
|
if (argc > 1)
|
||||||
|
raw_printf("MAXPLAYERS are set in sysconf file.\n");
|
||||||
|
#else
|
||||||
|
/* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */
|
||||||
|
if (argc > 1)
|
||||||
|
g.locknum = atoi(argv[1]);
|
||||||
|
#endif
|
||||||
|
#ifdef MAX_NR_OF_PLAYERS
|
||||||
|
/* limit to compile-time limit */
|
||||||
|
if (!g.locknum || g.locknum > MAX_NR_OF_PLAYERS)
|
||||||
|
g.locknum = MAX_NR_OF_PLAYERS;
|
||||||
|
#endif
|
||||||
|
#ifdef SYSCF
|
||||||
|
/* let syscf override compile-time limit */
|
||||||
|
if (!g.locknum || (sysopt.maxplayers && g.locknum > sysopt.maxplayers))
|
||||||
|
g.locknum = sysopt.maxplayers;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CHDIR
|
||||||
|
static void
|
||||||
|
chdirx(dir, wr)
|
||||||
|
const char *dir;
|
||||||
|
boolean wr;
|
||||||
|
{
|
||||||
|
if (dir /* User specified directory? */
|
||||||
|
#ifdef HACKDIR
|
||||||
|
&& strcmp(dir, HACKDIR) /* and not the default? */
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
#ifdef SECURE
|
||||||
|
(void) setgid(getgid());
|
||||||
|
(void) setuid(getuid()); /* Ron Wessels */
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
/* non-default data files is a sign that scores may not be
|
||||||
|
* compatible, or perhaps that a binary not fitting this
|
||||||
|
* system's layout is being used.
|
||||||
|
*/
|
||||||
|
#ifdef VAR_PLAYGROUND
|
||||||
|
int len = strlen(VAR_PLAYGROUND);
|
||||||
|
|
||||||
|
g.fqn_prefix[SCOREPREFIX] = (char *) alloc(len + 2);
|
||||||
|
Strcpy(g.fqn_prefix[SCOREPREFIX], VAR_PLAYGROUND);
|
||||||
|
if (g.fqn_prefix[SCOREPREFIX][len - 1] != '/') {
|
||||||
|
g.fqn_prefix[SCOREPREFIX][len] = '/';
|
||||||
|
g.fqn_prefix[SCOREPREFIX][len + 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HACKDIR
|
||||||
|
if (dir == (const char *) 0)
|
||||||
|
dir = HACKDIR;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (dir && chdir(dir) < 0) {
|
||||||
|
perror(dir);
|
||||||
|
error("Cannot chdir to %s.", dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* warn the player if we can't write the record file
|
||||||
|
* perhaps we should also test whether . is writable
|
||||||
|
* unfortunately the access system-call is worthless.
|
||||||
|
*/
|
||||||
|
if (wr) {
|
||||||
|
#ifdef VAR_PLAYGROUND
|
||||||
|
g.fqn_prefix[LEVELPREFIX] = g.fqn_prefix[SCOREPREFIX];
|
||||||
|
g.fqn_prefix[SAVEPREFIX] = g.fqn_prefix[SCOREPREFIX];
|
||||||
|
g.fqn_prefix[BONESPREFIX] = g.fqn_prefix[SCOREPREFIX];
|
||||||
|
g.fqn_prefix[LOCKPREFIX] = g.fqn_prefix[SCOREPREFIX];
|
||||||
|
g.fqn_prefix[TROUBLEPREFIX] = g.fqn_prefix[SCOREPREFIX];
|
||||||
|
#endif
|
||||||
|
check_recordfile(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CHDIR */
|
||||||
|
|
||||||
|
/* returns True iff we set plname[] to username which contains a hyphen */
|
||||||
|
static boolean
|
||||||
|
whoami()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS
|
||||||
|
* 2. Use $USER or $LOGNAME (if 1. fails)
|
||||||
|
* 3. Use getlogin() (if 2. fails)
|
||||||
|
* The resulting name is overridden by command line options.
|
||||||
|
* If everything fails, or if the resulting name is some generic
|
||||||
|
* account like "games", "play", "player", "hack" then eventually
|
||||||
|
* we'll ask him.
|
||||||
|
* Note that we trust the user here; it is possible to play under
|
||||||
|
* somebody else's name.
|
||||||
|
*/
|
||||||
|
if (!*g.plname) {
|
||||||
|
register const char *s;
|
||||||
|
|
||||||
|
s = nh_getenv("USER");
|
||||||
|
if (!s || !*s)
|
||||||
|
s = nh_getenv("LOGNAME");
|
||||||
|
if (!s || !*s)
|
||||||
|
s = getlogin();
|
||||||
|
|
||||||
|
if (s && *s) {
|
||||||
|
(void) strncpy(g.plname, s, sizeof g.plname - 1);
|
||||||
|
if (index(g.plname, '-'))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sethanguphandler(handler)
|
||||||
|
void FDECL((*handler), (int));
|
||||||
|
{
|
||||||
|
#ifdef SA_RESTART
|
||||||
|
/* don't want reads to restart. If SA_RESTART is defined, we know
|
||||||
|
* sigaction exists and can be used to ensure reads won't restart.
|
||||||
|
* If it's not defined, assume reads do not restart. If reads restart
|
||||||
|
* and a signal occurs, the game won't do anything until the read
|
||||||
|
* succeeds (or the stream returns EOF, which might not happen if
|
||||||
|
* reading from, say, a window manager). */
|
||||||
|
struct sigaction sact;
|
||||||
|
|
||||||
|
(void) memset((genericptr_t) &sact, 0, sizeof sact);
|
||||||
|
sact.sa_handler = (SIG_RET_TYPE) handler;
|
||||||
|
(void) sigaction(SIGHUP, &sact, (struct sigaction *) 0);
|
||||||
|
#ifdef SIGXCPU
|
||||||
|
(void) sigaction(SIGXCPU, &sact, (struct sigaction *) 0);
|
||||||
|
#endif
|
||||||
|
#else /* !SA_RESTART */
|
||||||
|
(void) signal(SIGHUP, (SIG_RET_TYPE) handler);
|
||||||
|
#ifdef SIGXCPU
|
||||||
|
(void) signal(SIGXCPU, (SIG_RET_TYPE) handler);
|
||||||
|
#endif
|
||||||
|
#endif /* ?SA_RESTART */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PORT_HELP
|
||||||
|
void
|
||||||
|
port_help()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Display unix-specific help. Just show contents of the helpfile
|
||||||
|
* named by PORT_HELP.
|
||||||
|
*/
|
||||||
|
display_file(PORT_HELP, TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* validate wizard mode if player has requested access to it */
|
||||||
|
boolean
|
||||||
|
authorize_wizard_mode()
|
||||||
|
{
|
||||||
|
struct passwd *pw = get_unix_pw();
|
||||||
|
|
||||||
|
if (pw && sysopt.wizards && sysopt.wizards[0]) {
|
||||||
|
if (check_user_string(sysopt.wizards))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
wiz_error_flag = TRUE; /* not being allowed into wizard mode */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wd_message()
|
||||||
|
{
|
||||||
|
if (wiz_error_flag) {
|
||||||
|
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||||
|
char *tmp = build_english_list(sysopt.wizards);
|
||||||
|
pline("Only user%s %s may access debug (wizard) mode.",
|
||||||
|
index(sysopt.wizards, ' ') ? "s" : "", tmp);
|
||||||
|
free(tmp);
|
||||||
|
} else
|
||||||
|
pline("Entering explore/discovery mode instead.");
|
||||||
|
wizard = 0, discover = 1; /* (paranoia) */
|
||||||
|
} else if (discover)
|
||||||
|
You("are in non-scoring explore/discovery mode.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a slash to any name not ending in /. There must
|
||||||
|
* be room for the /
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
append_slash(name)
|
||||||
|
char *name;
|
||||||
|
{
|
||||||
|
char *ptr;
|
||||||
|
|
||||||
|
if (!*name)
|
||||||
|
return;
|
||||||
|
ptr = name + (strlen(name) - 1);
|
||||||
|
if (*ptr != '/') {
|
||||||
|
*++ptr = '/';
|
||||||
|
*++ptr = '\0';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
check_user_string(optstr)
|
||||||
|
char *optstr;
|
||||||
|
{
|
||||||
|
struct passwd *pw;
|
||||||
|
int pwlen;
|
||||||
|
char *eop, *w;
|
||||||
|
char *pwname = 0;
|
||||||
|
|
||||||
|
if (optstr[0] == '*')
|
||||||
|
return TRUE; /* allow any user */
|
||||||
|
if (sysopt.check_plname)
|
||||||
|
pwname = g.plname;
|
||||||
|
else if ((pw = get_unix_pw()) != 0)
|
||||||
|
pwname = pw->pw_name;
|
||||||
|
if (!pwname || !*pwname)
|
||||||
|
return FALSE;
|
||||||
|
pwlen = (int) strlen(pwname);
|
||||||
|
eop = eos(optstr);
|
||||||
|
w = optstr;
|
||||||
|
while (w + pwlen <= eop) {
|
||||||
|
if (!*w)
|
||||||
|
break;
|
||||||
|
if (isspace(*w)) {
|
||||||
|
w++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strncmp(w, pwname, pwlen)) {
|
||||||
|
if (!w[pwlen] || isspace(w[pwlen]))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
while (*w && !isspace(*w))
|
||||||
|
w++;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct passwd *
|
||||||
|
get_unix_pw()
|
||||||
|
{
|
||||||
|
char *user;
|
||||||
|
unsigned uid;
|
||||||
|
static struct passwd *pw = (struct passwd *) 0;
|
||||||
|
|
||||||
|
if (pw)
|
||||||
|
return pw; /* cache answer */
|
||||||
|
|
||||||
|
uid = (unsigned) getuid();
|
||||||
|
user = getlogin();
|
||||||
|
if (user) {
|
||||||
|
pw = getpwnam(user);
|
||||||
|
if (pw && ((unsigned) pw->pw_uid != uid))
|
||||||
|
pw = 0;
|
||||||
|
}
|
||||||
|
if (pw == 0) {
|
||||||
|
user = nh_getenv("USER");
|
||||||
|
if (user) {
|
||||||
|
pw = getpwnam(user);
|
||||||
|
if (pw && ((unsigned) pw->pw_uid != uid))
|
||||||
|
pw = 0;
|
||||||
|
}
|
||||||
|
if (pw == 0) {
|
||||||
|
pw = getpwuid(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
get_login_name()
|
||||||
|
{
|
||||||
|
static char buf[BUFSZ];
|
||||||
|
struct passwd *pw = get_unix_pw();
|
||||||
|
|
||||||
|
buf[0] = '\0';
|
||||||
|
if (pw)
|
||||||
|
(void)strcpy(buf, pw->pw_name);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /* __APPLE__ */
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
void
|
||||||
|
port_insert_pastebuf(buf)
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
/* This should be replaced when there is a Cocoa port. */
|
||||||
|
const char *errfmt;
|
||||||
|
size_t len;
|
||||||
|
FILE *PB = popen("/usr/bin/pbcopy", "w");
|
||||||
|
|
||||||
|
if (!PB) {
|
||||||
|
errfmt = "Unable to start pbcopy (%d)\n";
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = strlen(buf);
|
||||||
|
/* Remove the trailing \n, carefully. */
|
||||||
|
if (buf[len - 1] == '\n')
|
||||||
|
len--;
|
||||||
|
|
||||||
|
/* XXX Sorry, I'm too lazy to write a loop for output this short. */
|
||||||
|
if (len != fwrite(buf, 1, len, PB)) {
|
||||||
|
errfmt = "Error sending data to pbcopy (%d)\n";
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pclose(PB) != -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
errfmt = "Error finishing pbcopy (%d)\n";
|
||||||
|
|
||||||
|
error:
|
||||||
|
raw_printf(errfmt, strerror(errno));
|
||||||
|
}
|
||||||
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
|
unsigned long
|
||||||
|
sys_random_seed()
|
||||||
|
{
|
||||||
|
unsigned long seed = 0L;
|
||||||
|
unsigned long pid = (unsigned long) getpid();
|
||||||
|
boolean no_seed = TRUE;
|
||||||
|
#ifdef DEV_RANDOM
|
||||||
|
FILE *fptr;
|
||||||
|
|
||||||
|
fptr = fopen(DEV_RANDOM, "r");
|
||||||
|
if (fptr) {
|
||||||
|
fread(&seed, sizeof (long), 1, fptr);
|
||||||
|
has_strong_rngseed = TRUE; /* decl.c */
|
||||||
|
no_seed = FALSE;
|
||||||
|
(void) fclose(fptr);
|
||||||
|
} else {
|
||||||
|
/* leaves clue, doesn't exit */
|
||||||
|
paniclog("sys_random_seed", "falling back to weak seed");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (no_seed) {
|
||||||
|
seed = (unsigned long) getnow(); /* time((TIME_type) 0) */
|
||||||
|
/* Quick dirty band-aid to prevent PRNG prediction */
|
||||||
|
if (pid) {
|
||||||
|
if (!(pid & 3L))
|
||||||
|
pid -= 1L;
|
||||||
|
seed *= pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*unixmain.c*/
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# NetHack 3.7 mkmkfile.sh $NHDT-Date: 1597332770 2020/08/13 15:32:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $
|
||||||
|
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
|
# build one makefile
|
||||||
|
# args are:
|
||||||
|
# $1 basefile
|
||||||
|
# $2 basefile tag
|
||||||
|
# $3 install path
|
||||||
|
# $4 hints file (path)
|
||||||
|
# $5 hints file (as given by user)
|
||||||
|
|
||||||
|
echo "#" > $3
|
||||||
|
echo "# This file is generated automatically. Do not edit." >> $3
|
||||||
|
echo "# Your changes will be lost." >> $3
|
||||||
|
echo "# Identify this file:" >> $3
|
||||||
|
echo "MAKEFILE_$2=1" >> $3
|
||||||
|
echo "" >> $3
|
||||||
|
|
||||||
|
echo "###" >> $3
|
||||||
|
echo "### Start $5 PRE" >> $3
|
||||||
|
echo "###" >> $3
|
||||||
|
awk '/^#-PRE/,/^#-POST/{ \
|
||||||
|
if(index($0, "#-PRE") == 1) print "# (new segment at source line",NR,")"; \
|
||||||
|
if(index($0, "#-INCLUDE") == 1) system("cat hints/include/"$2); \
|
||||||
|
else if(index($0, "#-P") != 1) print}' $4 >> $3
|
||||||
|
echo "### End $5 PRE" >> $3
|
||||||
|
echo "" >> $3
|
||||||
|
|
||||||
|
echo "###" >> $3
|
||||||
|
echo "### Start $1" >> $3
|
||||||
|
echo "###" >> $3
|
||||||
|
cat $1 >> $3
|
||||||
|
echo "### End $1" >> $3
|
||||||
|
echo "" >> $3
|
||||||
|
|
||||||
|
echo "###" >> $3
|
||||||
|
echo "### Start $5 POST" >> $3
|
||||||
|
echo "###" >> $3
|
||||||
|
awk '/^#-POST/,/^#-PRE/{ \
|
||||||
|
if(index($0, "#-POST") == 1) print "# (new segment at source line",NR,")"; \
|
||||||
|
if(index($0, "#-P") != 1) print}' $4 >> $3
|
||||||
|
echo "### End $5 POST" >> $3
|
||||||
Executable
+37
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# NetHack 3.7 setup.sh $NHDT-Date: 1596498296 2020/08/03 23:44:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $
|
||||||
|
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
#
|
||||||
|
# Build and install makefiles.
|
||||||
|
#
|
||||||
|
# Argument is the hints file to use (or no argument for traditional setup).
|
||||||
|
# e.g.:
|
||||||
|
# sh setup.sh
|
||||||
|
# or
|
||||||
|
# sh setup.sh hints/macosx10.5 (from sys/unix)
|
||||||
|
# or
|
||||||
|
# sh setup.sh sys/unix/hints/macosx10.5 (from top)
|
||||||
|
|
||||||
|
# Were we started from the top level? Cope.
|
||||||
|
prefix=.
|
||||||
|
if [ -f sys/unix/Makefile.top ]; then cd sys/unix; prefix=../..; fi
|
||||||
|
|
||||||
|
case "x$1" in
|
||||||
|
x) hints=/dev/null
|
||||||
|
hfile=/dev/null
|
||||||
|
;;
|
||||||
|
*) hints=$prefix/$1
|
||||||
|
hfile=$1
|
||||||
|
# sanity check
|
||||||
|
if [ ! -f "$hints" ]; then
|
||||||
|
echo "Cannot find hints file $hfile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile $hints $hfile
|
||||||
|
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile $hints $hfile
|
||||||
|
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile $hints $hfile
|
||||||
|
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile $hints $hfile
|
||||||
+150
@@ -0,0 +1,150 @@
|
|||||||
|
# NetHack 3.7 sysconf $NHDT-Date: 1596498296 2020/08/03 23:44:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.39 $
|
||||||
|
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
|
||||||
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
#
|
||||||
|
# Sample sysconf file.
|
||||||
|
# The sysconf file is only used if NetHack is compiled with SYSCF defined.
|
||||||
|
# It can be used to augment or override certain settings compiled into the
|
||||||
|
# program.
|
||||||
|
#
|
||||||
|
# This file can also be used to set local system defaults for run-time
|
||||||
|
# options, using the same syntax as an individual user's ./nethackrc file.
|
||||||
|
|
||||||
|
# Which users can use debug mode (aka wizard mode; accessed via '-D' command
|
||||||
|
# line flag or OPTIONS=playmode:debug in the runtime options config file).
|
||||||
|
# A value of * allows anyone to enter debugging mode.
|
||||||
|
WIZARDS=root games
|
||||||
|
|
||||||
|
# Which users can use explore mode (aka discover mode; accessed via '-X'
|
||||||
|
# command line flag or OPTIONS=playmode:explore in runtime options file or
|
||||||
|
# via '#exploremode' command during normal play). Same syntax as WIZARDS.
|
||||||
|
EXPLORERS=*
|
||||||
|
|
||||||
|
# Users allowed to use the '!' (shell escape) and '^Z' (suspend process)
|
||||||
|
# commands to temporarily leave the game and enter a shell process.
|
||||||
|
# (To resume play, use the shell command 'exit' (for most shells) to
|
||||||
|
# return from '!' or the shell command 'fg' to return from '^Z'.
|
||||||
|
# For the typical multi-user system where players have access to a shell
|
||||||
|
# prompt when logged in and run the game from their own username, a value
|
||||||
|
# of 'SHELLERS=*' is appropriate. However, some inexperienced players
|
||||||
|
# occasionally get stuck outside the game by accidentally typing '!' or
|
||||||
|
# '^Z' during play and not knowing how to go back.)
|
||||||
|
# Uses the same syntax as the WIZARDS and EXPLORERS options above.
|
||||||
|
#SHELLERS=
|
||||||
|
|
||||||
|
# If the user name is found in this list, prompt for username instead.
|
||||||
|
# Uses the same syntax as the WIZARDS option above.
|
||||||
|
# A public server should probably disable this.
|
||||||
|
# ["ec2-user" is the default user name on Amazon Linux]
|
||||||
|
GENERICUSERS=play player game games nethack nethacker ec2-user
|
||||||
|
|
||||||
|
# Use the player name for matching WIZARDS, EXPLORERS and SHELLERS,
|
||||||
|
# instead of the user's login name.
|
||||||
|
#CHECK_PLNAME=1
|
||||||
|
|
||||||
|
# Limit the number of simultaneous games (see also nethack.sh).
|
||||||
|
# Valid values are 0-25.
|
||||||
|
# Commenting this out or setting the value to 0 constructs lock files
|
||||||
|
# with UID and playername, so each user may have one game at a time,
|
||||||
|
# but number of different players is not limited.
|
||||||
|
# Setting this to any other value constructs the lock files with
|
||||||
|
# letter and "lock" (eg. alock, block, ...)
|
||||||
|
MAXPLAYERS=10
|
||||||
|
|
||||||
|
# If not null, added to string "To get local support, " in the support
|
||||||
|
# information help.
|
||||||
|
#SUPPORT=call Izchak at extension 42.
|
||||||
|
|
||||||
|
# If not null, displayed at the end of a panic-save sequence.
|
||||||
|
#RECOVER=Run the recover program.
|
||||||
|
|
||||||
|
# Uncomment the next line to disable the SEDUCE option, causing succubi and
|
||||||
|
# incubi to use nymphs' charm behavior rather than their own seduce behavior.
|
||||||
|
#SEDUCE=0
|
||||||
|
|
||||||
|
# Uncomment the next line to enable some accessibility features such
|
||||||
|
# as S_hero_override and S_pet_override symbols for screen readers
|
||||||
|
# in the user config file.
|
||||||
|
#ACCESSIBILITY=1
|
||||||
|
|
||||||
|
# Uncomment to disable savefile UID checking.
|
||||||
|
#CHECK_SAVE_UID=0
|
||||||
|
|
||||||
|
# Record (high score) file options.
|
||||||
|
# CAUTION: changing these after people have started playing games can
|
||||||
|
# lead to lost high scores!
|
||||||
|
# Maximum entries for one person.
|
||||||
|
#PERSMAX=10
|
||||||
|
# Maximum entries in the record file.
|
||||||
|
#ENTRYMAX=100
|
||||||
|
# Minimum points to get an entry.
|
||||||
|
#POINTSMIN=1
|
||||||
|
# Determine identity of "person" in the score file with name (0) or
|
||||||
|
# numeric (1) user id.
|
||||||
|
#PERS_IS_UID=1
|
||||||
|
|
||||||
|
# Maximum number of score file entries to use for random statue names
|
||||||
|
#MAX_STATUENAME_RANK=10
|
||||||
|
|
||||||
|
# Show debugging information originating from these source files.
|
||||||
|
# Use '*' for all, or list source files separated by spaces.
|
||||||
|
# Only available if game has been compiled with DEBUG, and can be
|
||||||
|
# overridden via DEBUGFILES environment variable.
|
||||||
|
#DEBUGFILES=*
|
||||||
|
|
||||||
|
# Save end of game dump log to this file.
|
||||||
|
# Only available if NetHack was compiled with DUMPLOG
|
||||||
|
# Allows following placeholders:
|
||||||
|
# %% literal '%'
|
||||||
|
# %v version (eg. "3.7.0-0")
|
||||||
|
# %u game UID
|
||||||
|
# %t game start time, UNIX timestamp format
|
||||||
|
# %T current time, UNIX timestamp format
|
||||||
|
# %d game start time, YYYYMMDDhhmmss format
|
||||||
|
# %D current time, YYYYMMDDhhmmss format
|
||||||
|
# %n player name
|
||||||
|
# %N first character of player name
|
||||||
|
#DUMPLOGFILE=/tmp/nethack.%n.%d.log
|
||||||
|
|
||||||
|
# Number of bones file pools.
|
||||||
|
# The pool you belong to is determined at game start. You will
|
||||||
|
# load and save bones only from that pool. Generally useful
|
||||||
|
# for public servers only.
|
||||||
|
# Changing this might make existing bones inaccessible.
|
||||||
|
# Disabled by setting to 0, or commenting out.
|
||||||
|
#BONES_POOLS=10
|
||||||
|
|
||||||
|
# Try to get more info in case of a program bug or crash. Only used
|
||||||
|
# if the program is built with the PANICTRACE compile-time option enabled.
|
||||||
|
# By default PANICTRACE is enabled if (NH_DEVEL_STATUS != NH_STATUS_RELEASED),
|
||||||
|
# otherwise disabled.
|
||||||
|
# Using GDB can get more information and works on more systems but requires
|
||||||
|
# 'gdb' be available; using LIBC only works if NetHack is linked with a
|
||||||
|
# libc that supports the backtrace(3) API. Both require certain compilation
|
||||||
|
# options. See src/end.c and sys/unix/hints/* for more information.
|
||||||
|
#GDBPATH=/usr/bin/gdb
|
||||||
|
#GREPPATH=/bin/grep
|
||||||
|
# Values are priorities: 0 - do not use this method, 1 - low priority,
|
||||||
|
# 2 - high priority. Non-zero priority methods are tried in order.
|
||||||
|
PANICTRACE_GDB=0
|
||||||
|
PANICTRACE_LIBC=0
|
||||||
|
|
||||||
|
# 'portable_device_paths' is only supported for Windows. Starting with
|
||||||
|
# 3.6.3, nethack on Windows treats the folder containing nethack.exe and
|
||||||
|
# nethackW.exe as read-only and puts data files which are generated or
|
||||||
|
# modified during play or by the user in assorted folders derived from
|
||||||
|
# user name. 3.6.4 added PORTABLE_DEVICE_PATHS to allow reverting to
|
||||||
|
# the old behavior of having the run-time configuration file and other
|
||||||
|
# data in the same directory as the executable so that the whole thing
|
||||||
|
# can be moved from one machine to another (flash drive or perhaps cloud)
|
||||||
|
# without updating folder paths.
|
||||||
|
#PORTABLE_DEVICE_PATHS=0
|
||||||
|
|
||||||
|
# Ordinary run-time options can be set here to override the builtin-in
|
||||||
|
# default values. Unlike all the SYSCF values above, individual users
|
||||||
|
# can override the overridden options set here by choosing their own
|
||||||
|
# option settings via NETHACKOPTIONS in their environment or via
|
||||||
|
# ~/.nethackrc run-time configuration file.
|
||||||
|
#OPTIONS=!autopickup,fruit:tomato,symset:DECgraphics
|
||||||
|
|
||||||
|
#eof
|
||||||
@@ -1218,10 +1218,18 @@ do_date()
|
|||||||
#endif
|
#endif
|
||||||
Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count,
|
Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count,
|
||||||
ul_sfx);
|
ul_sfx);
|
||||||
|
#ifndef WASM
|
||||||
Fprintf(ofp, "#define VERSION_SANITY2 0x%08lx%s\n", version.struct_sizes1,
|
Fprintf(ofp, "#define VERSION_SANITY2 0x%08lx%s\n", version.struct_sizes1,
|
||||||
ul_sfx);
|
ul_sfx);
|
||||||
Fprintf(ofp, "#define VERSION_SANITY3 0x%08lx%s\n", version.struct_sizes2,
|
Fprintf(ofp, "#define VERSION_SANITY3 0x%08lx%s\n", version.struct_sizes2,
|
||||||
ul_sfx);
|
ul_sfx);
|
||||||
|
#else /* WASM */
|
||||||
|
Fprintf(ofp, "#define VERSION_SANITY2 0x%08llx%s\n", version.struct_sizes1,
|
||||||
|
ul_sfx);
|
||||||
|
Fprintf(ofp, "#define VERSION_SANITY3 0x%08llx%s\n", version.struct_sizes2,
|
||||||
|
ul_sfx);
|
||||||
|
#endif /* !WASM */
|
||||||
|
|
||||||
Fprintf(ofp, "\n");
|
Fprintf(ofp, "\n");
|
||||||
Fprintf(ofp, "#define VERSION_STRING \"%s\"\n", version_string(buf, "."));
|
Fprintf(ofp, "#define VERSION_STRING \"%s\"\n", version_string(buf, "."));
|
||||||
Fprintf(ofp, "#define VERSION_ID \\\n \"%s\"\n",
|
Fprintf(ofp, "#define VERSION_ID \\\n \"%s\"\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user