| 1 | |
| 2 | |
| 3 | @@ -673,8 +673,8 @@ Sysatt: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
|
| 4 | $(DATE_O) $(BUILDMORE) Makefile
|
| 5 | @echo "Loading $(GAME)."
|
| 6 | $(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile \
|
| 7 | - -o $(GAMEBIN) $(HOSTOBJ) $(HOBJ) $(DATE_O) $(TARGET_HACKLIB) \
|
| 8 | - $(LUALIBS)
|
| 9 | + -o $(GAMEBIN) $(HOSTOBJ) $(HOBJ) $(DATE_O) \
|
| 10 | + $(TARGET_HACKLIB) $(LUALIBS)
|
| 11 | @touch Sysatt
|
| 12 |
|
| 13 | Systos: $(HOSTOBJ) $(HOBJ) $(TARGET_HACKLIB) $(GENTILEOFILE) \
|
| 14 | diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top
|
| 15 | index 5ecca32327..6641bc116a 100644
|
| 16 | |
| 17 | |
| 18 | @@ -121,13 +121,14 @@ DAT = $(DATNODLB) $(DATDLB)
|
| 19 | RECOVERBIN = recover
|
| 20 |
|
| 21 | # Lua
|
| 22 | -LUAHEADERS = lib/lua-$(LUA_VERSION)/src
|
| 23 | -LUATESTTARGET = $(LUAHEADERS)/lua.h
|
| 24 | -LUATOP = $(LUAHEADERS)
|
| 25 | -LUAMAKEFLAGS = CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
| 26 | -LUA2NHTOP = ../../..
|
| 27 | -LUABASELIB = liblua-$(LUA_VERSION).a
|
| 28 | -TOPLUALIB = lib/lua/$(LUABASELIB)
|
| 29 | +LUAHEADERS ?= lib/lua-$(LUA_VERSION)/src
|
| 30 | +LUATESTTARGET ?= $(LUAHEADERS)/lua.h
|
| 31 | +LUATOP ?= $(LUAHEADERS)
|
| 32 | +LUAMAKEFLAGS ?= CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
| 33 | +LUA2NHTOP ?= ../../..
|
| 34 | +LUABASELIB ?= liblua-$(LUA_VERSION).a
|
| 35 | +TOPLUALIB ?= lib/lua/$(LUABASELIB)
|
| 36 | +LUAHPREFIX ?= ../
|
| 37 |
|
| 38 | ALLDEP = $(PRECHECK) $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb
|
| 39 |
|
| 40 | @@ -149,12 +150,12 @@ $(TOPLUALIB): $(LUATOP)/liblua.a
|
| 41 |
|
| 42 | include/nhlua.h: $(TOPLUALIB)
|
| 43 | echo '/* nhlua.h - generated by top Makefile */' > $@
|
| 44 | - @echo '#include "../$(LUAHEADERS)/lua.h"' >> $@
|
| 45 | + @echo '#include "$(LUAHPREFIX)$(LUAHEADERS)/lua.h"' >> $@
|
| 46 | @sed -e '/(lua_error)/!d' \
|
| 47 | -e '/(lua_error)/s/LUA_API/ATTRNORETURN LUA_API/1' \
|
| 48 | -e '/(lua_error)/s/;/ NORETURN;/1' < $(LUAHEADERS)/lua.h >> $@
|
| 49 | - @echo '#include "../$(LUAHEADERS)/lualib.h"' >> $@
|
| 50 | - @echo '#include "../$(LUAHEADERS)/lauxlib.h"' >> $@
|
| 51 | + @echo '#include "$(LUAHPREFIX)$(LUAHEADERS)/lualib.h"' >> $@
|
| 52 | + @echo '#include "$(LUAHPREFIX)$(LUAHEADERS)/lauxlib.h"' >> $@
|
| 53 | @echo '/*nhlua.h*/' >> $@
|
| 54 | # LUATESTTARGET is this by default
|
| 55 | lib/lua-$(LUA_VERSION)/src/lua.h:
|
| 56 | diff --git a/sys/unix/README-hints b/sys/unix/README-hints
|
| 57 | index 283d1cf29d..196f32734a 100644
|
| 58 | |
| 59 | |
| 60 | @@ -49,6 +49,8 @@ make musl=1 Build with settings appropriate for linking with
|
| 61 | musl libc, instead of glibc. This causes
|
| 62 | NOCRASHREPORT to be defined, and avoids the use
|
| 63 | of 'col' during the build.
|
| 64 | +make WANT_SYSTEM_LUA=1 Attempt to use an existing Lua package already
|
| 65 | + on the system (initially for Alpine Linux).
|
| 66 | make resp=1 Place the majority of the compiler switches into
|
| 67 | a response file to de-clutter the build compiler
|
| 68 | command lines and eliminate some of the
|
| 69 | diff --git a/sys/unix/hints/linux.500 b/sys/unix/hints/linux.500
|
| 70 | index 8a309bfe37..d8aebe39e0 100755
|
| 71 | |
| 72 | |
| 73 | @@ -23,6 +23,7 @@
|
| 74 | HINTSVERSION := 500
|
| 75 |
|
| 76 | ifdef MAKEFILE_TOP
|
| 77 | +LUA_VERSION=5.4.8
|
| 78 | ifeq ($(MAKELEVEL),0)
|
| 79 | PRECHECK+=checkmakefiles
|
| 80 | # all files included from this hints file get listed
|
| 81 | @@ -67,6 +68,35 @@ USE_NOSTATICFN = 1
|
| 82 |
|
| 83 | #-INCLUDE compiler.500
|
| 84 |
|
| 85 | +ifdef WANT_SYSTEM_LUA
|
| 86 | +OS_ID := $(shell grep -E '^ID=' /etc/os-release 2>/dev/null | cut -d= -f2)
|
| 87 | +ifeq ($(OS_ID),alpine)
|
| 88 | +USE_SYSTEM_LUA=1
|
| 89 | +CURSPKG = ncurses
|
| 90 | +endif # Alpine Linux
|
| 91 | +
|
| 92 | +ifeq "$(USE_SYSTEM_LUA)" "1"
|
| 93 | +#5.4.8
|
| 94 | +ifndef LUA_VERSION
|
| 95 | +LUA_VERSION := 5.4.8
|
| 96 | +endif
|
| 97 | +LUASUBDELIM := $(subst ., ,$(LUA_VERSION))
|
| 98 | +LUASHVER := $(word 1, $(LUASUBDELIM)).$(word 2, $(LUASUBDELIM))
|
| 99 | +LUAHEADERS := /usr/include/lua$(LUASHVER)
|
| 100 | +LUATESTTARGET := $(LUAHEADERS)/lua.h
|
| 101 | +LUAHPREFIX :=
|
| 102 | +LUAFLAGS := $(shell pkg-config --cflags lua-$(LUASHVER))
|
| 103 | +LUALIBS := $(shell pkg-config --libs lua-$(LUASHVER))
|
| 104 | +CFLAGS += $(LUAFLAGS)
|
| 105 | +LUATOP=
|
| 106 | +LUAMAKEFLAGS=
|
| 107 | +LUA2NHTOP=
|
| 108 | +LUABASELIB=
|
| 109 | +TOPLUALIB=
|
| 110 | +LUALIB=
|
| 111 | +endif # USE_SYSTEM_LUA
|
| 112 | +endif # WANT_SYSTEM_LUA
|
| 113 | +
|
| 114 | ifdef WANT_WIN_QT
|
| 115 | ifdef WANT_WIN_QT5
|
| 116 | QTDIR=/usr
|
| 117 | @@ -96,6 +126,7 @@ LFLAGS+=-fsanitize=undefined
|
| 118 | endif
|
| 119 |
|
| 120 | ifeq "$(USE_CURSESLIB)" "1"
|
| 121 | +CURSPKG ?= ncursesw
|
| 122 | # default
|
| 123 | CURSESLIB = -lncurses -ltinfo
|
| 124 | # If CURSES_UNICODE is defined, we need ncursesw.
|
| 125 | @@ -103,8 +134,8 @@ CURSESLIB = -lncurses -ltinfo
|
| 126 | # CURSESLIB = -lncurses -ltinfo
|
| 127 | ifdef MAKEFILE_SRC
|
| 128 | comma:=,
|
| 129 | -NCURSES_LFLAGS = $(shell pkg-config ncursesw --libs)
|
| 130 | -NCURSES_CFLAGS = $(shell pkg-config ncursesw --cflags)
|
| 131 | +NCURSES_LFLAGS = $(shell pkg-config $(CURSPKG) --libs)
|
| 132 | +NCURSES_CFLAGS = $(shell pkg-config $(CURSPKG) --cflags)
|
| 133 | ifeq (,$(findstring ncursesw, $(NCURSES_LFLAGS)))
|
| 134 | ifeq (,$(findstring ncurses, $(NCURSES_LFLAGS)))
|
| 135 | #this indicates that pkg-config itself was unavailable
|