From 05e64d24294c9f52e9468e3de1ebf77697f83c71 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 25 Nov 2019 10:07:11 -0800 Subject: [PATCH 01/10] more questpgr removal from makedefs --- util/makedefs.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/util/makedefs.c b/util/makedefs.c index bedacf153..c9db1eb42 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makedefs.c $NHDT-Date: 1574634383 2019/11/24 22:26:23 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.163 $ */ +/* NetHack 3.6 makedefs.c $NHDT-Date: 1574705221 2019/11/25 18:07:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.165 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* Copyright (c) M. Stephenson, 1990, 1991. */ @@ -69,8 +69,10 @@ static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.7\t2019/11/19"; #define DGN_I_FILE "dungeon.def" #define DGN_O_FILE "dungeon.pdf" #define MON_STR_C "monstr.c" +#if 0 #define QTXT_I_FILE "quest.txt" #define QTXT_O_FILE "quest.dat" +#endif #define VIS_TAB_H "vis_tab.h" #define VIS_TAB_C "vis_tab.c" #define GITINFO_FILE "gitinfo.txt" @@ -179,17 +181,6 @@ static void FDECL(do_rnd_access_file, (const char *)); static boolean FDECL(d_filter, (char *)); static boolean FDECL(h_filter, (char *)); static void FDECL(opt_out_words, (char *, int *)); -static boolean FDECL(qt_comment, (char *)); -static boolean FDECL(qt_control, (char *)); -static int FDECL(get_hdr, (char *)); -static boolean FDECL(new_id, (char *)); -static boolean FDECL(known_msg, (int, int)); -static void FDECL(new_msg, (char *, int, int)); -static char *FDECL(valid_qt_summary, (char *, BOOLEAN_P)); -static void FDECL(do_qt_control, (char *)); -static void FDECL(do_qt_text, (char *)); -static void NDECL(adjust_qt_hdrs); -static void NDECL(put_qt_hdrs); #ifdef VISION_TABLES static void NDECL(H_close_gen); From 1b2b330e9f9a598e67d1ed86cf7f7ee98c79388b Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 25 Nov 2019 12:20:42 -0800 Subject: [PATCH 02/10] lua reorganization Reduce the implied reliance of a specific version of lua. Instead of copying liblua.a to src/, copy it to lib/. Instead of telling the compiler to look for headers in lib/lua-5.3.5/src/ as well as in include/, copy the relevant ones to lib/ and tell the compiler to look for them there. 'make spotless' in src/ will remove both the object library and the header files from lib/ but there really should be a new Makefile.lib to take care of that directory. Update Makefile.src to be able to build lua in case someone starts with 'make all' there instead of in the top Makefile. It doesn't duplicate the option to fetch the lua source package though. NHinternal/../genFiles.c has been updated to mention lib/liblua.a and lib/lua*.h as 'generated at compile time' in Files and to skip lib/lua-* entirely if it comes across that (so not operating on a completely clean tree). But it won't be accurate unless/until other ports stage their lua files there instead of in src/ and lib/lua-$(VERSION)/src/. I haven't tried 'make depend' to see what it makes of the numerous changes.... --- sys/unix/Makefile.src | 30 ++++++++++++++++++------------ sys/unix/Makefile.top | 29 +++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 4c22ff244..4e580ba2c 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.6 Makefile.src $NHDT-Date: 1550876124 2019/02/22 22:55:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.70 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1574713234 2019/11/25 20:20:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $ # Copyright (c) 2018 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. @@ -49,7 +49,7 @@ SHELL=/bin/sh # for UNIX systems SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \ ../sys/unix/unixunix.c ../sys/unix/unixres.c -SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o liblua.a +SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/liblua.a # # for Systos # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ @@ -173,7 +173,7 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome #CFLAGS = -O -I../include #LFLAGS = -CFLAGS += -I../lib/lua-5.3.5/src +CFLAGS += -I../lib # -lm required by lua LIBS += -lm @@ -447,9 +447,9 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \ dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \ files.c fountain.c hack.c hacklib.c invent.c isaac64.c light.c \ lock.c mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c \ - minion.c mklev.c mkmap.c nhlua.c nhlsel.c \ - mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \ - mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \ + minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \ + mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \ + nhlua.c nhlsel.c o_init.c objects.c objnam.c \ options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \ priest.c quest.c questpgr.c read.c rect.c region.c restore.c \ rip.c rnd.c role.c rumors.c save.c sfstruct.c \ @@ -504,8 +504,10 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ tradstdc.h trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \ wincurs.h winX.h winprocs.h wintype.h you.h youprop.h -HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h \ - dgn_file.h +HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.h + +# relative to src +LUA_HEADERS = ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h # the following .o's _must_ be made before any others (for makedefs) FIRSTOBJ = monst.o objects.o @@ -516,9 +518,9 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \ drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \ extralev.o files.o fountain.o hack.o hacklib.o invent.o isaac64.o \ light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o \ - minion.o mklev.o mkmap.o nhlua.o nhlsel.o \ - mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o \ - mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o \ + minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o \ + mondata.o monmove.o mplayer.o mthrowu.o muse.o music.o \ + nhlua.o nhlsel.o o_init.o objnam.o options.o \ pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \ quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \ role.o rumors.o save.o sfstruct.o \ @@ -587,6 +589,8 @@ DUMB.Setup: ../include/extern.h all: $(GAME) +lib/liblua.a $(LUA_HEADERS): + @( cd .. ; $(MAKE) lua_support ) # dependencies for makedefs and its outputs, which the util # Makefile is responsible for keeping up to date @@ -720,6 +724,7 @@ clean: spotless: clean -rm -f a.out core $(GAME) Sys* + -rm -f ../lib/liblua.a $(LUA_HEADERS) -rm -f ../include/date.h ../include/onames.h ../include/pm.h -rm -f ../include/vis_tab.h vis_tab.c tile.c *.moc -rm -f ../win/gnome/gn_rip.h @@ -751,7 +756,8 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/system.h ../include/unixconf.h ../include/os2conf.h \ ../include/micro.h ../include/pcconf.h ../include/tosconf.h \ ../include/amiconf.h ../include/macconf.h ../include/beconf.h \ - ../include/wceconf.h ../include/ntconf.h + ../include/wceconf.h ../include/ntconf.h \ + ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h touch $(CONFIG_H) # hack.h timestamp $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index e55f34fc5..da01f1a95 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -1,5 +1,5 @@ # NetHack Top-level Makefile. -# NetHack 3.6 Makefile.top $NHDT-Date: 1524689449 2018/04/25 20:50:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $ +# NetHack 3.6 Makefile.top $NHDT-Date: 1574713236 2019/11/25 20:20:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -94,8 +94,23 @@ DATNODLB = $(VARDATND) license symbols DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DAT = $(DATNODLB) $(DATDLB) -$(GAME): - ( cd lib/lua-5.3.5/src && make a && cp liblua.a ../../../src/ ) +LUA_HEADERS = lib/lua.h lib/luaconf.h lib/lualib.h lib/lauxlib.h +lua_support: lib/liblua.a $(LUA_HEADERS) + @true +lib/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a + @( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. ) + cp lib/lua-$(LUA_VERSION)/src/liblua.a $@ +lib/lua.h: lib/lua-$(LUA_VERSION)/src/lua.h + sed -e '/(lua_error)/s/;/ NORETURN;/' \ + < lib/lua-$(LUA_VERSION)/src/lua.h > $@ +lib/luaconf.h: lib/lua-$(LUA_VERSION)/src/luaconf.h + cp lib/lua-$(LUA_VERSION)/src/luaconf.h $@ +lib/lualib.h: lib/lua-$(LUA_VERSION)/src/lualib.h + cp lib/lua-$(LUA_VERSION)/src/lualib.h $@ +lib/lauxlib.h: lib/lua-$(LUA_VERSION)/src/lauxlib.h + cp lib/lua-$(LUA_VERSION)/src/lauxlib.h $@ + +$(GAME): lua_support ( cd src ; $(MAKE) ) all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb @@ -238,11 +253,13 @@ dofiles-nodlb: # 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 ) + 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 @@ -291,7 +308,7 @@ clean: ( cd src ; $(MAKE) clean ) ( cd util ; $(MAKE) clean ) ( cd doc ; $(MAKE) clean ) - ( cd lib/lua-5.3.5/src && $(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 From 7fcccdf5c6ebba566d9a60f29604cf6fe13b8c7d Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 25 Nov 2019 22:47:54 -0500 Subject: [PATCH 03/10] linux-hosted msdos cross-compiler updates --- sys/msdos/Makefile1.cross | 27 ++++++-------- sys/msdos/Makefile2.cross | 8 ++--- sys/msdos/msdos-cross-compile.sh | 60 ++++++++++++++++---------------- sys/unix/hints/linux | 4 --- 4 files changed, 45 insertions(+), 54 deletions(-) diff --git a/sys/msdos/Makefile1.cross b/sys/msdos/Makefile1.cross index 06053ab71..d00d19852 100644 --- a/sys/msdos/Makefile1.cross +++ b/sys/msdos/Makefile1.cross @@ -319,7 +319,7 @@ $(DAT)/nhdat: $(U)dlb_main $(DAT)/data $(DAT)/rumors \ cd $(DAT); \ pwd; \ cp $(MSYS)/msdoshlp.txt .; \ - ls -1 data oracles options quest.dat rumors help hh >dlb.lst; \ + ls -1 data oracles options rumors help hh >dlb.lst; \ ls -1 cmdhelp history opthelp wizhelp license >>dlb.lst; \ ls -1 bogusmon engrave epitaph tribute msdoshlp.txt >>dlb.lst; \ ls -1 *.lua >>dlb.lst; \ @@ -363,11 +363,6 @@ $(DAT)/rumors: $(HOST_O)utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal $(DAT)/oracles: $(HOST_O)utility.tag $(DAT)/oracles.txt $(U)makedefs -h -ifndef LUA_QTEXT_FILE -$(DAT)/quest.dat: $(HOST_O)utility.tag $(DAT)/quest.txt - $(U)makedefs -q -endif - $(DAT)/bogusmon: $(HOST_O)utility.tag $(DAT)/bogusmon.txt $(U)makedefs -s @@ -560,30 +555,30 @@ clean: spotless: clean if [ -f $(INCL)/pm.h ]; then rm $(INCL)/pm.h; fi; -# if [ -f $(U)dgn_flex.c ]; then rm $(U)dgn_flex.c; fi; -# if [ -f $(U)dgn_lex.c ]; then rm $(U)dgn_lex.c; fi; +## if [ -f $(U)dgn_flex.c ]; then rm $(U)dgn_flex.c; fi; +## if [ -f $(U)dgn_lex.c ]; then rm $(U)dgn_lex.c; fi; # if [ -f $(U)makedefs ]; then rm $(U)makedefs; fi; -# if [ -f $(U)dgn_comp ]; then rm $(U)dgn_comp; fi; +## if [ -f $(U)dgn_comp ]; then rm $(U)dgn_comp; fi; # if [ -f $(U)recover.exe ]; then rm $(U)recover.exe; fi; # if [ -f $(U)tilemap ]; then rm $(U)tilemap; fi; # if [ -f $(U)tile2bmp ]; then rm $(U)tile2bmp; fi; -# if [ -f $(U)tile2bin ]; then rm $(U)tile2bin; fi; -# if [ -f $(U)til2bin2 ]; then rm $(U)til2bin2; fi; -# if [ -f $(U)thintile ]; then rm $(U)thintile; fi; +## if [ -f $(U)tile2bin ]; then rm $(U)tile2bin; fi; +## if [ -f $(U)til2bin2 ]; then rm $(U)til2bin2; fi; +## if [ -f $(U)thintile ]; then rm $(U)thintile; fi; # if [ -f $(U)dlb_main ]; then rm $(U)dlb_main; fi; # if [ -f $(INCL)/vis_tab.h ]; then rm $(INCL)/vis_tab.h; fi; # if [ -f $(INCL)/onames.h ]; then rm $(INCL)/onames.h; fi; # if [ -f $(INCL)/pm.h ]; then rm $(INCL)/pm.h; fi; # if [ -f $(INCL)/date.h ]; then rm $(INCL)/date.h; fi; -# if [ -f $(INCL)/dgn_comp.h ]; then rm $(INCL)/dgn_comp.h; fi; -# if [ -f $(INCL)/lev_comp.h ]; then rm $(INCL)/lev_comp.h; fi; +## if [ -f $(INCL)/dgn_comp.h ]; then rm $(INCL)/dgn_comp.h; fi; +## if [ -f $(INCL)/lev_comp.h ]; then rm $(INCL)/lev_comp.h; fi; # if [ -f $(SRC)/vis_tab.c ]; then rm $(SRC)/vis_tab.c; fi; # if [ -f $(SRC)/tile.c ]; then rm $(SRC)/tile.c; fi; # if [ -f $(DAT)/options ]; then rm $(DAT)/options; fi; # if [ -f $(DAT)/data ]; then rm $(DAT)/data; fi; # if [ -f $(DAT)/rumors ]; then rm $(DAT)/rumors; fi; -# if [ -f $(DAT)/dungeon.pdf ]; then rm $(DAT)/dungeon.pdf; fi; -# if [ -f $(DAT)/dungeon ]; then rm $(DAT)/dungeon; fi; +## if [ -f $(DAT)/dungeon.pdf ]; then rm $(DAT)/dungeon.pdf; fi; +## if [ -f $(DAT)/dungeon ]; then rm $(DAT)/dungeon; fi; # if [ -f $(DAT)/oracles ]; then rm $(DAT)/oracles; fi; ## if [ -f $(DAT)/quest.dat ]; then rm $(DAT)/quest.dat; fi; # if [ -f $(DAT)/bogusmon ]; then rm $(DAT)/bogusmon; fi; diff --git a/sys/msdos/Makefile2.cross b/sys/msdos/Makefile2.cross index dcb148a6e..f9a848e13 100644 --- a/sys/msdos/Makefile2.cross +++ b/sys/msdos/Makefile2.cross @@ -38,10 +38,10 @@ GAMEDIR =../msdos-binary # your machine. # ADD_CURSES=Y -PDCURSES_TOP=../../pdcurses +PDCURSES_TOP=../lib/pdcurses # Set top of djgpp if not specified through ENV variables prior to make: -#DJGPP_TOP = $(HOME)/djgpp +#DJGPP_TOP = $(HOME)/lib/djgpp #--------------------------------------------------------------- # Location of LUA @@ -83,9 +83,9 @@ WSHR = ../win/share # Executables. ifndef DJGPP_TOP ifdef TRAVIS_BUILD_DIR -DJGPP_TOP = TRAVIS_BUILD_DIR/djgpp +DJGPP_TOP = TRAVIS_BUILD_DIR/lib/djgpp else -DJGPP_TOP = $(HOME)/djgpp +DJGPP_TOP = $(HOME)/lib/djgpp endif endif diff --git a/sys/msdos/msdos-cross-compile.sh b/sys/msdos/msdos-cross-compile.sh index 1edf7b147..7516d1937 100644 --- a/sys/msdos/msdos-cross-compile.sh +++ b/sys/msdos/msdos-cross-compile.sh @@ -1,9 +1,15 @@ #!/bin/sh #set -x + if [ -z "$TRAVIS_BUILD_DIR" ]; then - export DJGPP_TOP=$(pwd)/djgpp + export DJGPP_TOP=$(pwd)/lib/djgpp else - export DJGPP_TOP="$TRAVIS_BUILD_DIR/djgpp" + export DJGPP_TOP="$TRAVIS_BUILD_DIR/lib/djgpp" +fi + +if [ ! -d "$(pwd)/lib" ]; then + echo "Set up for Unix build and 'make fetch-lua' first." + exit 1 fi DJGPP_URL="https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/" @@ -25,7 +31,11 @@ DJGPP_URL="$DJGPP_URL$DJGPP_FILE" # export -cd util +if [ ! -d lib]; then +mkdir -p lib +fi + +cd lib if [ ! -f "$DJGPP_FILE" ]; then if [ "$(uname)" = "Darwin" ]; then #Mac @@ -34,45 +44,38 @@ if [ ! -f "$DJGPP_FILE" ]; then wget --no-hsts "$DJGPP_URL" fi fi -cd ../ - -if [ ! -d ../djgpp/i586-pc-msdosdjgpp ]; then - tar xjf "util/$DJGPP_FILE" -fi - -#echo after tar -# cd ../ - -#pwd - -# PDCurses -if [ ! -d "../pdcurses" ]; then - echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git" - git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses +if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then + tar xjf "$DJGPP_FILE" + rm $DJGPP_FILE fi # DOS-extender for use with djgpp -cd djgpp -if [ ! -d cwsdpmi ]; then +if [ ! -d djgpp/cwsdpmi ]; then if [ "$(uname)" = "Darwin" ]; then #Mac curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip else wget --no-hsts http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip fi + cd djgpp mkdir -p cwsdpmi cd cwsdpmi unzip ../csdpmi7b.zip - cd ../ + cd ../../ rm csdpmi7b.zip fi + +# PDCurses +if [ ! -d "pdcurses" ]; then + echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git" ; \ + git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses +fi + cd ../ - #echo after dos extender - cd src mkdir -p ../msdos-binary @@ -93,16 +96,13 @@ make -f ../sys/msdos/Makefile2.cross unset GCC_EXEC_PREFIX #pwd -#ls ../djgpp/cwsdpmi/bin -#ls . - -if [ -f ../djgpp/cwsdpmi/bin/CWSDPMI.EXE ]; then - cp ../djgpp/cwsdpmi/bin/CWSDPMI.EXE ../msdos-binary/CWSDPMI.EXE; +if [ -f ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE ]; then + cp ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE ../msdos-binary/CWSDPMI.EXE; fi # ls -l ../msdos-binary cd ../msdos-binary -zip -9 ../NH370DOS.ZIP * +zip -9 ../lib/NH370DOS.ZIP * cd ../ -# ls -l NH370DOS.ZIP +ls -l lib/NH370DOS.ZIP diff --git a/sys/unix/hints/linux b/sys/unix/hints/linux index bcafe1cf1..dcdee332d 100644 --- a/sys/unix/hints/linux +++ b/sys/unix/hints/linux @@ -55,7 +55,3 @@ CHGRP=true VARDIRPERM = 0755 VARFILEPERM = 0600 GAMEPERM = 0755 - -CC=clang -CFLAGS+=-fsanitize=address -fno-omit-frame-pointer -LFLAGS+=-fsanitize=address -fno-omit-frame-pointer From 36983e6889da4282bc64db419fc68a02ad1079aa Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 26 Nov 2019 00:02:38 -0500 Subject: [PATCH 04/10] more msdos cross-compile fixes undefined reference to g.variables if certain parts of drawing.c are included in host-side utilities, so surround the offending code in -> #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) --- src/drawing.c | 2 + sys/msdos/Makefile1.cross | 67 +++++++++++++++----------------- sys/msdos/msdos-cross-compile.sh | 2 +- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/drawing.c b/src/drawing.c index 1bf81102e..8a97c4496 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -291,6 +291,7 @@ char ch; return i; } +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) /* * Explanations of the functions found below: * @@ -810,5 +811,6 @@ const struct symparse loadsyms[] = { { SYM_OTH, SYM_HERO_OVERRIDE + SYM_OFF_X, "S_hero_override" }, { 0, 0, (const char *) 0 } /* fence post */ }; +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /*drawing.c*/ diff --git a/sys/msdos/Makefile1.cross b/sys/msdos/Makefile1.cross index d00d19852..8c9324076 100644 --- a/sys/msdos/Makefile1.cross +++ b/sys/msdos/Makefile1.cross @@ -145,11 +145,9 @@ TEXTIO = $(HOST_O)tiletext.o $(HOST_O)tiletxt.o $(HOST_O)drawing.o $(HOST_O TEXTIO2 = $(HOST_O)tiletex2.o $(HOST_O)tiletxt2.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \ $(HOST_O)objects.o -#PLANAR_TIB = $(DAT)/NETHACK1.TIB -#OVERVIEW_TIB = $(DAT)/NETHACKO.TIB TILE_BMP = $(DAT)/NHTILES.BMP -TILEUTIL = $(TILOBJ) $(U)tile2bin $(U)til2bin2 $(TILE_BMP) $(PLANAR_TIB) $(OVERVIEW_TIB) +TILEUTIL = $(TILOBJ) $(TILE_BMP) TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt @@ -255,7 +253,7 @@ LFLAGS = #========================================== $(HOST_O)%.o : $(SRC)/%.c - $(HOST_CC) $(cflags) -o$@ $< + $(HOST_CC) $(cflags) -o$@ $< #========================================== # Rules for host files in sys/msdos @@ -303,8 +301,7 @@ $(HOST_O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ tileutil: $(U)gif2txt $(U)txt2ppm @echo Optional tile development utilities are up to date. -$(HOST_O)prereq.tag: hobj.tag $(U)makedefs $(HOST_O)utility.tag \ - $(HOST_O)thintile.tag $(DAT)/nhdat +$(HOST_O)prereq.tag: hobj.tag $(U)makedefs $(HOST_O)utility.tag $(DAT)/nhdat echo prereq done >$@ #========================================== @@ -418,17 +415,17 @@ $(HOST_O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H) $(TILE_H) # Required for tile support #========================================== -$(DAT)/NetHack1.tib: $(TILEFILES) $(U)tile2bin - @echo Creating binary tile files - cd $(DAT) - $(U)tile2bin - cd $(SRC) +#$(DAT)/NetHack1.tib: $(TILEFILES) $(U)tile2bin +# @echo Creating binary tile files +# cd $(DAT) +# $(U)tile2bin +# cd $(SRC) -$(DAT)/NetHacko.tib: $(HOST_O)thintile.tag $(TILEFILES2) $(U)til2bin2 - @echo Creating overview binary tile files - cd $(DAT) - $(U)til2bin2 - cd $(SRC) +#$(DAT)/NetHacko.tib: $(HOST_O)thintile.tag $(TILEFILES2) $(U)til2bin2 +# @echo Creating overview binary tile files +# cd $(DAT) +# $(U)til2bin2 +# cd $(SRC) $(DAT)/NHTILES.BMP: $(TILEFILES) $(U)tile2bmp @echo Creating binary tile files which may take some time @@ -441,39 +438,39 @@ $(U)tile2bmp: $(HOST_O)tile2bmp.o $(TEXTIO) ar r temp.a $(TEXTIO) $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bmp.o temp.a -$(U)tile2bin: $(HOST_O)tile2bin.o $(TEXTIO) - -rm -f temp.a - ar r temp.a $(TEXTIO) - $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bin.o temp.a +#$(U)tile2bin: $(HOST_O)tile2bin.o $(TEXTIO) +# -rm -f temp.a +# ar r temp.a $(TEXTIO) +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bin.o temp.a -$(U)til2bin2: $(HOST_O)til2bin2.o $(TEXTIO2) - -rm -f temp.a - ar r temp.a $(TEXTIO2) - $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)til2bin2.o temp.a +#$(U)til2bin2: $(HOST_O)til2bin2.o $(TEXTIO2) +# -rm -f temp.a +# ar r temp.a $(TEXTIO2) +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)til2bin2.o temp.a -$(U)thintile: $(HOST_O)thintile.o - $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)thintile.o +#$(U)thintile: $(HOST_O)thintile.o +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)thintile.o #$(HOST_O)thintile.o: $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c # -rm -f temp.a # ar r temp.a $(TEXTIO) # $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bmp.o temp.a -$(HOST_O)thintile.o: $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c - $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE -DOVERVIEW_FILE -o$@ $(WSHR)/thintile.c +#$(HOST_O)thintile.o: $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE -DOVERVIEW_FILE -o$@ $(WSHR)/thintile.c -$(HOST_O)thintile.tag: $(U)thintile $(TILEFILES) - $(U)thintile - echo thintiles created >$@ +#$(HOST_O)thintile.tag: $(U)thintile $(TILEFILES) +# $(U)thintile +# echo thintiles created >$@ $(HOST_O)tile2bmp.o: $(HACK_H) $(TILE_H) $(WSHR)/tile2bmp.c $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c -$(HOST_O)tile2bin.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c - $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/tile2bin.c +#$(HOST_O)tile2bin.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/tile2bin.c -$(HOST_O)til2bin2.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c - $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -DOVERVIEW_FILE -o$@ $(MSYS)/tile2bin.c +#$(HOST_O)til2bin2.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -DOVERVIEW_FILE -o$@ $(MSYS)/tile2bin.c $(HOST_O)tiletext.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tiletext.c $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tiletext.c diff --git a/sys/msdos/msdos-cross-compile.sh b/sys/msdos/msdos-cross-compile.sh index 7516d1937..4df9fc3cf 100644 --- a/sys/msdos/msdos-cross-compile.sh +++ b/sys/msdos/msdos-cross-compile.sh @@ -31,7 +31,7 @@ DJGPP_URL="$DJGPP_URL$DJGPP_FILE" # export -if [ ! -d lib]; then +if [ ! -d lib ]; then mkdir -p lib fi From 5f75048386c66a21b87652ab93963fb4741d559a Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 26 Nov 2019 00:34:57 -0500 Subject: [PATCH 05/10] another msdos cross-compile bit --- sys/msdos/msdos-cross-compile.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/msdos/msdos-cross-compile.sh b/sys/msdos/msdos-cross-compile.sh index 4df9fc3cf..4dd7ee617 100644 --- a/sys/msdos/msdos-cross-compile.sh +++ b/sys/msdos/msdos-cross-compile.sh @@ -47,7 +47,7 @@ fi if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then tar xjf "$DJGPP_FILE" - rm $DJGPP_FILE + rm -f $DJGPP_FILE fi # DOS-extender for use with djgpp @@ -61,7 +61,7 @@ if [ ! -d djgpp/cwsdpmi ]; then cd djgpp mkdir -p cwsdpmi cd cwsdpmi - unzip ../csdpmi7b.zip + unzip ../../csdpmi7b.zip cd ../../ rm csdpmi7b.zip fi From 1e22743b5641072b5094d009b5d4e1b9aeb7dd64 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 26 Nov 2019 19:06:45 -0500 Subject: [PATCH 06/10] msdos cross-compile bits --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index e2522cfa9..5c7ef79b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,6 +84,15 @@ matrix: - cd src - cp ../sys/winnt/Makefile.gcc ./Makefile - mingw32-make install + - os: linux + env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 + compiler: gcc + script: +# - export + - cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ + - make fetch-lua + - cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. + - sh sys/msdos/msdos-cross-compile.sh exclude: # - os: osx # osx_image: xcode10.3 From 45290941385e4f28b06d8fb86ab9db5b88bef7fc Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 26 Nov 2019 19:26:49 -0500 Subject: [PATCH 07/10] prepare branch for travis-ci --- .travis.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c7ef79b8..a8aa59d41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ matrix: - os: linux env: DESCR=linux-xenial-gcc HINTS=linux compiler: gcc - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-clang HINTS=linux compiler: clang - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-x11 HINTS=linux-x11 compiler: gcc @@ -18,7 +18,7 @@ matrix: - libx11-dev - libxaw7-dev - xfonts-utils - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-qt5 HINTS=linux-qt5 compiler: gcc @@ -31,7 +31,7 @@ matrix: - qtbase5-dev - qtmultimedia5-dev - qtbase5-dev-tools - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 && make fetch-lua && make MOC=moc install" - os: linux env: DESCR=linux-bionic-gcc-x11 HINTS=linux-x11 dist: bionic @@ -42,7 +42,7 @@ matrix: - libx11-dev - libxaw7-dev - xfonts-utils - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-minimal HINTS=linux-minimal compiler: gcc @@ -67,8 +67,18 @@ matrix: sed -i '/^#define SHELL/d' include/unixconf.h sed -i '/^#define SUSPEND/d' include/unixconf.h sed -i 's/^#define TEXTCOLOR//' include/unixconf.h - make install + make fetch-lua && make install cat dat/options + - os: linux + env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 + compiler: gcc + script: +# - export + - cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ + - make fetch-lua + - cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. + - sh sys/msdos/msdos-cross-compile.sh + exclude: - os: windows env: DESCR=windows-visualstudio language: shell @@ -84,16 +94,6 @@ matrix: - cd src - cp ../sys/winnt/Makefile.gcc ./Makefile - mingw32-make install - - os: linux - env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 - compiler: gcc - script: -# - export - - cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ - - make fetch-lua - - cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. - - sh sys/msdos/msdos-cross-compile.sh - exclude: # - os: osx # osx_image: xcode10.3 # env: DESCR=osx-xcode10.3-x11 HINTS=macosx10.14 WANT_WIN_CURSES=1 WANT_WIN_X11=1 USE_XPM=1 From 2a78011030b5037d016a7390064f5147f57858b9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 26 Nov 2019 19:35:46 -0500 Subject: [PATCH 08/10] instructional doc bit --- sys/unix/NewInstall.unx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/unix/NewInstall.unx b/sys/unix/NewInstall.unx index b9daf361d..163df601c 100644 --- a/sys/unix/NewInstall.unx +++ b/sys/unix/NewInstall.unx @@ -23,11 +23,16 @@ If you are using the traditional configuration system, see Install.unx. cd $Top/sys/unix sh setup.sh hints/NAME_OF_HINTS_FILE cd ../.. + make fetch-Lua make all If the build fails, remove all the generated files before retrying the build with: cd $Top; make spotless + The 'make fetch-Lua' step really only needs to be done one time unless + your sources get refreshed, or the lib folder and its contents get + removed. + 4. Install: Depending on your configuration, this step may or may not need to be done as root; check the hints file. From 865607a39271b8138e8e769ed9e812f6c1b1e65c Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 26 Nov 2019 19:27:00 -0800 Subject: [PATCH 09/10] 3.7 Unix Makefiles Copy lib/lua-$(VERSION)/src/liblua.h to lib/lua/ rather than lib/. Instead of copying any of the header files or telling the compiler where to find the lua ones, generate include/nhlua.h on the fly and restrict the knowledge of where they are to it (paths are relative to include/). |/* nhlua.h - generated by top Makefile */ |#include "../lib/lua-5.3.5/src/lua.h" |LUA_API int (lua_error) (lua_State *L) NORETURN; |#include "../lib/lua-5.3.5/src/lualib.h" |#include "../lib/lua-5.3.5/src/lauxlib.h" |/*nhlua.h*/ This might need to be redone (or augmented by having CFLAGS add back '-I path-to-lua') if some compiler can't find '#include "luaconf.h"' issued by lua.h. --- include/system.h | 7 +++---- src/nhlua.c | 3 +-- sys/unix/Makefile.src | 14 +++++--------- sys/unix/Makefile.top | 28 ++++++++++++++-------------- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/include/system.h b/include/system.h index 265f46f98..60437f0bc 100644 --- a/include/system.h +++ b/include/system.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 system.h $NHDT-Date: 1550268586 2019/02/15 22:09:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ +/* NetHack 3.6 system.h $NHDT-Date: 1574825213 2019/11/27 03:26:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -570,9 +570,7 @@ E int FDECL(atoi, (const char *)); #endif /* WIN32 */ #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" +#include "nhlua.h" #if defined(WIN32) #define LUA_INTCAST(i) ((int) i) @@ -580,4 +578,5 @@ E int FDECL(atoi, (const char *)); #define LUA_INTCAST(i) (i) #endif #endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ + #endif /* SYSTEM_H */ diff --git a/src/nhlua.c b/src/nhlua.c index 73431fc7f..a8f33ca8e 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 nhlua.c $NHDT-Date: 1574646949 2019/11/25 01:55:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ */ +/* NetHack 3.6 nhlua.c $NHDT-Date: 1574825214 2019/11/27 03:26:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ /* Copyright (c) 2018 by Pasi Kallinen */ /* NetHack may be freely redistributed. See license for details. */ @@ -37,7 +37,6 @@ nhl_error(L, msg) lua_State *L; const char *msg; { - extern int FDECL(lua_error, (lua_State *)) NORETURN; lua_Debug ar; char buf[BUFSZ]; diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 4e580ba2c..18323ccb2 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.6 Makefile.src $NHDT-Date: 1574713234 2019/11/25 20:20:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1574825214 2019/11/27 03:26:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.77 $ # Copyright (c) 2018 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. @@ -49,7 +49,7 @@ SHELL=/bin/sh # for UNIX systems SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \ ../sys/unix/unixunix.c ../sys/unix/unixres.c -SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/liblua.a +SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/lua/liblua.a # # for Systos # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ @@ -173,7 +173,6 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome #CFLAGS = -O -I../include #LFLAGS = -CFLAGS += -I../lib # -lm required by lua LIBS += -lm @@ -506,9 +505,6 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.h -# relative to src -LUA_HEADERS = ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h - # the following .o's _must_ be made before any others (for makedefs) FIRSTOBJ = monst.o objects.o @@ -589,7 +585,7 @@ DUMB.Setup: ../include/extern.h all: $(GAME) -lib/liblua.a $(LUA_HEADERS): +../lib/lua/liblua.a ../include/nhlua.h: @( cd .. ; $(MAKE) lua_support ) # dependencies for makedefs and its outputs, which the util @@ -724,7 +720,7 @@ clean: spotless: clean -rm -f a.out core $(GAME) Sys* - -rm -f ../lib/liblua.a $(LUA_HEADERS) + -rm -f ../lib/lua/liblua.a ../include/nhlua.h -rm -f ../include/date.h ../include/onames.h ../include/pm.h -rm -f ../include/vis_tab.h vis_tab.c tile.c *.moc -rm -f ../win/gnome/gn_rip.h @@ -757,7 +753,7 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/micro.h ../include/pcconf.h ../include/tosconf.h \ ../include/amiconf.h ../include/macconf.h ../include/beconf.h \ ../include/wceconf.h ../include/ntconf.h \ - ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h + ../include/nhlua.h touch $(CONFIG_H) # hack.h timestamp $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index da01f1a95..9d930aaa1 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -1,5 +1,5 @@ # NetHack Top-level Makefile. -# NetHack 3.6 Makefile.top $NHDT-Date: 1574713236 2019/11/25 20:20:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ +# NetHack 3.6 Makefile.top $NHDT-Date: 1574825215 2019/11/27 03:26:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -94,21 +94,21 @@ DATNODLB = $(VARDATND) license symbols DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DAT = $(DATNODLB) $(DATDLB) -LUA_HEADERS = lib/lua.h lib/luaconf.h lib/lualib.h lib/lauxlib.h -lua_support: lib/liblua.a $(LUA_HEADERS) +lua_support: lib/lua/liblua.a include/nhlua.h @true -lib/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a - @( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. ) +lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h + ( cd lib/lua-$(LUA_VERSION)/src ; make 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 $@ -lib/lua.h: lib/lua-$(LUA_VERSION)/src/lua.h - sed -e '/(lua_error)/s/;/ NORETURN;/' \ - < lib/lua-$(LUA_VERSION)/src/lua.h > $@ -lib/luaconf.h: lib/lua-$(LUA_VERSION)/src/luaconf.h - cp lib/lua-$(LUA_VERSION)/src/luaconf.h $@ -lib/lualib.h: lib/lua-$(LUA_VERSION)/src/lualib.h - cp lib/lua-$(LUA_VERSION)/src/lualib.h $@ -lib/lauxlib.h: lib/lua-$(LUA_VERSION)/src/lauxlib.h - cp lib/lua-$(LUA_VERSION)/src/lauxlib.h $@ +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*/' >> $@ $(GAME): lua_support ( cd src ; $(MAKE) ) From 503b97960b37eabfbc54cc235a4d4462dbd8b255 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 27 Nov 2019 01:25:17 -0500 Subject: [PATCH 10/10] windows Makefile updates --- sys/winnt/Makefile.gcc | 15 +++- sys/winnt/Makefile.msc | 191 +++-------------------------------------- 2 files changed, 26 insertions(+), 180 deletions(-) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 1b10a0395..ef7f9ca0b 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -100,7 +100,7 @@ TARGET_CPU=x86 # your machine. # # ADD_CURSES=Y -# PDCURSES_TOP=../../pdcurses +# PDCURSES_TOP=../lib/pdcurses #4b Qt # @@ -137,7 +137,7 @@ TARGET_CPU=x86 # successfully build NetHack-3.7. # ADD_LUA=Y -LUATOP=../../lua-5.3.5 +LUATOP=../lib/lua-5.3.5 # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -746,7 +746,7 @@ default : install all : install -install: initialchk $(O)utility.tag $(GAMEDIR)/NetHack.exe $(NETHACKW_EXE) \ +install: $(INCL)/nhlua.h initialchk $(O)utility.tag $(GAMEDIR)/NetHack.exe $(NETHACKW_EXE) \ $(O)install.tag $(EXTRA_FILES) @echo NetHack is up to date. @echo Done. @@ -795,6 +795,15 @@ $(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \ $(subst /,\,@echo utilities made >$@) @echo utilities made. +$(INCL)/nhlua.h: + 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*/' >> $@ + tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe @echo Optional tile development utilities are up to date. diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 33ae60bac..04459b5ca 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -99,7 +99,7 @@ GAMEDIR = ..\binary # Default game build directory # of your PDCurses C files. # #ADD_CURSES=Y -#PDCURSES_TOP=..\..\pdcurses +#PDCURSES_TOP=..\lib\pdcurses # #------------------------------------------------------------------------------ # OPTIONAL - zlib support (to allow compressed savefile exchange across platforms @@ -108,7 +108,7 @@ GAMEDIR = ..\binary # Default game build directory # # #ADD_ZLIB=Y -#ZLIBTOP=..\..\zlib +#ZLIBTOP=..\lib\zlib # #------------------------------------------------------------------------------ # 4. Do you want debug information available to the executable? @@ -143,7 +143,7 @@ DEBUGINFO = Y # successfully build NetHack-3.7. You cannot build a functional # version of NetHack-3.7 Work-in-progress without including Lua. # -LUATOP=..\..\lua-5.3.5 +LUATOP=..\lib\lua-5.3.5 # # #============================================================================== @@ -252,14 +252,6 @@ MAKESRC = $(U)makedefs.c MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o -!IFDEF OBSOLETE_LEVEL_COMPILER -LEVCOMPOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ - $(O)alloc.o $(O)decl.o $(O)drawing.o $(O)monst.o $(O)objects.o $(O)panic.o -!ENDIF - -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_lex.o $(O)dgn_main.o \ - $(O)alloc.o $(O)panic.o - RECOVOBJS = $(O)recover.o TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt @@ -503,9 +495,6 @@ HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\align.h $(INCL)\context.h \ LEV_H = $(INCL)\lev.h DGN_FILE_H = $(INCL)\dgn_file.h -!IFDEF OBSOLETE_LEVEL_COMPILER -LEV_COMP_H = $(INCL)\lev_comp.h -!ENDIF SP_LEV_H = $(INCL)\sp_lev.h TILE_H = ..\win\share\tile.h @@ -1025,52 +1014,22 @@ recover: $(U)recover.exe if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR) if exist $(DOC)\recover.txt copy $(DOC)\recover.txt $(GAMEDIR)\recover.txt -!IFDEF OBSOLETE_LEVEL_COMPILER -$(O)sp_lev.tag: $(O)utility.tag $(DAT)\bigroom.des $(DAT)\castle.des \ - $(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des \ - $(DAT)\medusa.des $(DAT)\oracle.des $(DAT)\tower.des \ - $(DAT)\yendor.des $(DAT)\arch.des $(DAT)\barb.des \ - $(DAT)\caveman.des $(DAT)\healer.des $(DAT)\knight.des \ - $(DAT)\monk.des $(DAT)\priest.des $(DAT)\ranger.des \ - $(DAT)\rogue.des $(DAT)\samurai.des $(DAT)\sokoban.des \ - $(DAT)\tourist.des $(DAT)\valkyrie.des $(DAT)\wizard.des - cd $(DAT) - $(U)levcomp bigroom.des - $(U)levcomp castle.des - $(U)levcomp endgame.des - $(U)levcomp gehennom.des - $(U)levcomp knox.des - $(U)levcomp mines.des - $(U)levcomp medusa.des - $(U)levcomp oracle.des - $(U)levcomp sokoban.des - $(U)levcomp tower.des - $(U)levcomp yendor.des - $(U)levcomp arch.des - $(U)levcomp barb.des - $(U)levcomp caveman.des - $(U)levcomp healer.des - $(U)levcomp knight.des - $(U)levcomp monk.des - $(U)levcomp priest.des - $(U)levcomp ranger.des - $(U)levcomp rogue.des - $(U)levcomp samurai.des - $(U)levcomp tourist.des - $(U)levcomp valkyrie.des - $(U)levcomp wizard.des - cd $(SRC) - echo sp_levs done > $(O)sp_lev.tag -!ELSE $(O)sp_lev.tag: echo sp_levs done > $(O)sp_lev.tag -!ENDIF -$(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \ +$(O)utility.tag: $(INCL)\nhlua.h $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \ $(SRC)\vis_tab.c $(INCL)\vis_tab.h $(TILEUTIL16) @echo utilities made >$@ @echo utilities made. +$(INCL)\nhlua.h: + @echo /* nhlua.h - generated by Makefile */ > $@ + @echo #include "../lib/lua-$(LUAVER)/src/lua.h" >> $@ + @echo LUA_API int (lua_error) (lua_State *L) NORETURN; >> $@ + @echo #include "../lib/lua-$(LUAVER)/src/lualib.h" >> $@ + @echo #include "../lib/lua-$(LUAVER)/src/lauxlib.h" >> $@ + @echo /*nhlua.h*/ >> $@ + tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe @echo Optional tile development utilities are up to date. @@ -1185,74 +1144,6 @@ $(MSWIN)\splash.bmp: $(U)uudecode.exe $(MSWIN)\splash.uu ..\..\util\uudecode.exe splash.uu chdir ..\..\src -#================================================= -# Level Compiler Stuff -#================================================= -# -# defer to the steps in ..\win\win32\levstuff.mak -# - -!IFDEF OBSOLETE_LEVEL_COMPILER -$(U)lev_yacc.c: $(U)lev_comp.y - nmake -nologo -f ..\win\win32\levstuff.mak $(U)lev_yacc.c - -$(U)lev_lex.c: $(U)lev_comp.l - nmake -nologo -f ..\win\win32\levstuff.mak $(U)lev_lex.c - -$(INCL)\lev_comp.h: - nmake -nologo -f ..\win\win32\levstuff.mak $(INCL)\lev_comp.h - -$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)lev_yacc.c - -$(O)lev_lex.o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) $(U)lev_lex.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)lev_lex.c - -$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) - @$(cc) $(cflagsBuild) -Fo$@ $(U)lev_main.c - -$(U)levcomp.exe: $(LEVCOMPOBJS) - @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(LEVCOMPOBJS:^ =^ - ) -<< -!ENDIF - -#================================================= -# Dungeon Compiler Stuff -#================================================= -# -!IFDEF OBSOLETE_DGN_COMPILER -# defer to the steps in ..\win\win32\dgnstuff.mak -# -$(U)dgn_yacc.c: $(U)dgn_comp.y - nmake -nologo -f ..\win\win32\dgnstuff.mak $(U)dgn_yacc.c - -$(INCL)\dgn_comp.h: - nmake -nologo -f ..\win\win32\dgnstuff.mak $(INCL)\dgn_comp.h - -$(U)dgn_lex.c: $(U)dgn_comp.l - nmake -nologo -f ..\win\win32\dgnstuff.mak $(U)dgn_lex.c - -$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_yacc.c - -$(O)dgn_lex.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ - $(U)dgn_lex.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_lex.c - -$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_main.c - -$(U)dgncomp.exe: $(DGNCOMPOBJS) - @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(DGNCOMPOBJS:^ =^ - ) -<< -!ENDIF - #================================================= # Create directory for holding object files #================================================= @@ -1339,9 +1230,6 @@ nhdat$(NHV): $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ echo history >>dlb.lst echo opthelp >>dlb.lst echo wizhelp >>dlb.lst -!IFDEF OBSOLETE_DGN_COMPILER - echo dungeon >>dlb.lst -!ENDIF echo license >>dlb.lst echo engrave >>dlb.lst echo epitaph >>dlb.lst @@ -1570,51 +1458,12 @@ spotless: clean if exist $(DAT)\ttyoptions del $(DAT)\ttyoptions if exist $(DAT)\guioptions del $(DAT)\guioptions if exist $(DAT)\data del $(DAT)\data -!IFDEF OBSOLETE_DGN_COMPILER - if exist $(DAT)\dungeon del $(DAT)\dungeon - if exist $(DAT)\dungeon.pdf del $(DAT)\dungeon.pdf -!ENDIF -!IFDEF OBSOLETE_LEVEL_COMPILER - if exist $(DAT)\???-fil?.lev del $(DAT)\???-fil?.lev - if exist $(DAT)\???-goal.lev del $(DAT)\???-goal.lev - if exist $(DAT)\???-loca.lev del $(DAT)\???-loca.lev - if exist $(DAT)\???-strt.lev del $(DAT)\???-strt.lev - if exist $(DAT)\air.lev del $(DAT)\air.lev - if exist $(DAT)\asmodeus.lev del $(DAT)\asmodeus.lev - if exist $(DAT)\astral.lev del $(DAT)\astral.lev - if exist $(DAT)\baalz.lev del $(DAT)\baalz.lev - if exist $(DAT)\bigrm-*.lev del $(DAT)\bigrm-*.lev - if exist $(DAT)\castle.lev del $(DAT)\castle.lev - if exist $(DAT)\earth.lev del $(DAT)\earth.lev - if exist $(DAT)\fakewiz?.lev del $(DAT)\fakewiz?.lev - if exist $(DAT)\fire.lev del $(DAT)\fire.lev - if exist $(DAT)\juiblex.lev del $(DAT)\juiblex.lev - if exist $(DAT)\knox.lev del $(DAT)\knox.lev - if exist $(DAT)\medusa-?.lev del $(DAT)\medusa-?.lev - if exist $(DAT)\mine*.lev del $(DAT)\mine*.lev - if exist $(DAT)\oracle.lev del $(DAT)\oracle.lev - if exist $(DAT)\orcus.lev del $(DAT)\orcus.lev - if exist $(DAT)\sanctum.lev del $(DAT)\sanctum.lev - if exist $(DAT)\soko?-?.lev del $(DAT)\soko?-?.lev - if exist $(DAT)\tower?.lev del $(DAT)\tower?.lev - if exist $(DAT)\valley.lev del $(DAT)\valley.lev - if exist $(DAT)\water.lev del $(DAT)\water.lev - if exist $(DAT)\wizard?.lev del $(DAT)\wizard?.lev -!ENDIF + clean: if exist $(O)*.o del $(O)*.o + if exist $(INCL)\nhlua.h del $(INCL)\nhlua.h if exist $(O)utility.tag del $(O)utility.tag if exist $(U)makedefs.exe del $(U)makedefs.exe -!IFDEF OBSOLETE_LEVEL_COMPILER - if exist $(U)levcomp.exe del $(U)levcomp.exe - if exist $(O)levcomp.MAP del $(O)levcomp.MAP - if exist $(O)levcomp.PDB del $(O)levcomp.PDB -!ENDIF -!IFDEF OBSOLETE_DGN_COMPILER - if exist $(U)dgncomp.exe del $(U)dgncomp.exe - if exist $(O)dgncomp.MAP del $(O)dgncomp.MAP - if exist $(O)dgncomp.PDB del $(O)dgncomp.PDB -!ENDIF if exist $(SRC)\*.lnk del $(SRC)\*.lnk if exist $(SRC)\*.map del $(SRC)\*.map if exist $(O)install.tag del $(O)install.tag @@ -1645,18 +1494,6 @@ clean: if exist $(O)sp_lev.tag del $(O)sp_lev.tag if exist $(O)uudecode.MAP del $(O)uudecode.MAP if exist $(O)uudecode.PDB del $(O)uudecode.PDB -!IFDEF OBSOLETE_LEVEL_COMPILER - rem - rem defer to the steps in ..\win\win32\levstuff.mak - rem - nmake -nologo -f ..\win\win32\levstuff.mak clean -!ENDIF -!IFDEF OBSOLETE_DGN_COMPILER - rem - rem defer to the steps in ..\win\win32\dgnstuff.mak - rem - nmake -nologo -f ..\win\win32\dgnstuff.mak clean -!ENDIF if exist $(TILEBMP16) del $(TILEBMP16) if exist $(TILEBMP32) del $(TILEBMP32)