From 89677cbc5070f0e5a0178738aa29bc38032c9fe5 Mon Sep 17 00:00:00 2001 From: emaste Date: Wed, 29 Apr 2020 13:41:32 +0000 Subject: [PATCH] liblua: ensure that "require" will fail in bootstrap flua We do not want to support bootstrapping lua modules, so ensure that require will fail by providing a nonexistent path. Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24610 --- lib/liblua/Makefile | 5 +++++ lib/liblua/luaconf.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/liblua/Makefile b/lib/liblua/Makefile index 40d9c5c924b0..28fc05a9aa71 100644 --- a/lib/liblua/Makefile +++ b/lib/liblua/Makefile @@ -26,4 +26,9 @@ SRCS+= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c \ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" +.if defined(BOOTSTRAPPING) +CFLAGS+= -DLUA_PATH_DEFAULT="\"/nonexistent/?.lua\"" +CFLAGS+= -DLUA_CPATH_DEFAULT="\"/nonexistent/?.so\"" +.endif + .include diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index f06cba31741c..b24645b8915f 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -208,12 +208,16 @@ #define LUA_ROOT "/usr/local/" #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ "./?.lua;" "./?/init.lua" +#endif +#if !defined(LUA_CPATH_DEFAULT) #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif #endif /* } */