stand: consolidate knowledge of lua path
Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. MFC after: 1 week
This commit is contained in:
parent
abc4b11cea
commit
ee74c23624
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354245
@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc;
|
|||||||
#define LDBG(...)
|
#define LDBG(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define LOADER_LUA LUA_PATH "/loader.lua"
|
||||||
|
|
||||||
INTERP_DEFINE("lua");
|
INTERP_DEFINE("lua");
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -120,7 +122,7 @@ interp_init(void)
|
|||||||
lua_pop(luap, 1); /* remove lib */
|
lua_pop(luap, 1); /* remove lib */
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = "/boot/lua/loader.lua";
|
filename = LOADER_LUA;
|
||||||
if (interp_include(filename) != 0) {
|
if (interp_include(filename) != 0) {
|
||||||
const char *errstr = lua_tostring(luap, -1);
|
const char *errstr = lua_tostring(luap, -1);
|
||||||
errstr = errstr == NULL ? "unknown" : errstr;
|
errstr = errstr == NULL ? "unknown" : errstr;
|
||||||
|
@ -40,6 +40,9 @@ BOOTOBJ= ${OBJTOP}/stand
|
|||||||
# BINDIR is where we install
|
# BINDIR is where we install
|
||||||
BINDIR?= /boot
|
BINDIR?= /boot
|
||||||
|
|
||||||
|
# LUAPATH is where we search for and install lua scripts.
|
||||||
|
LUAPATH?= /boot/lua
|
||||||
|
|
||||||
LIBSA= ${BOOTOBJ}/libsa/libsa.a
|
LIBSA= ${BOOTOBJ}/libsa/libsa.a
|
||||||
.if ${MACHINE} == "i386"
|
.if ${MACHINE} == "i386"
|
||||||
LIBSA32= ${LIBSA}
|
LIBSA32= ${LIBSA}
|
||||||
|
@ -27,7 +27,7 @@ SRCS+= lerrno.c lfs.c lstd.c lutils.c
|
|||||||
|
|
||||||
WARNS= 3
|
WARNS= 3
|
||||||
|
|
||||||
CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\"
|
CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\"
|
||||||
CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX
|
CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX
|
||||||
CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE
|
CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE
|
||||||
CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC}
|
CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC}
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
|
|
||||||
#else /* }{ */
|
#else /* }{ */
|
||||||
|
|
||||||
#define LUA_ROOT "/boot/lua/" LUA_VDIR "/"
|
#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/"
|
||||||
#define LUA_LDIR LUA_ROOT "share/"
|
#define LUA_LDIR LUA_ROOT "share/"
|
||||||
#define LUA_CDIR LUA_ROOT "lib/"
|
#define LUA_CDIR LUA_ROOT "lib/"
|
||||||
#ifndef LUA_PATH_DEFAULT
|
#ifndef LUA_PATH_DEFAULT
|
||||||
|
@ -62,6 +62,7 @@ SRCS+= interp_lua.c
|
|||||||
.include "${BOOTSRC}/lua.mk"
|
.include "${BOOTSRC}/lua.mk"
|
||||||
LDR_INTERP= ${LIBLUA}
|
LDR_INTERP= ${LIBLUA}
|
||||||
LDR_INTERP32= ${LIBLUA32}
|
LDR_INTERP32= ${LIBLUA32}
|
||||||
|
CFLAGS+= -DLUA_PATH=\"${LUAPATH}\"
|
||||||
.elif ${LOADER_INTERP} == "4th"
|
.elif ${LOADER_INTERP} == "4th"
|
||||||
SRCS+= interp_forth.c
|
SRCS+= interp_forth.c
|
||||||
.include "${BOOTSRC}/ficl.mk"
|
.include "${BOOTSRC}/ficl.mk"
|
||||||
|
@ -12,7 +12,7 @@ MAN= cli.lua.8 \
|
|||||||
password.lua.8 \
|
password.lua.8 \
|
||||||
screen.lua.8
|
screen.lua.8
|
||||||
|
|
||||||
FILESDIR= /boot/lua
|
FILESDIR= ${LUAPATH}
|
||||||
FILES= cli.lua \
|
FILES= cli.lua \
|
||||||
color.lua \
|
color.lua \
|
||||||
config.lua \
|
config.lua \
|
||||||
|
Loading…
Reference in New Issue
Block a user