Date: Sat, 4 Oct 2025 00:53:38 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bbef1c72b487 - main - Revert "flua: support our flua modules in the bootstrap flua" Message-ID: <202510040053.5940rcXi066768@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bbef1c72b4873b657fdb0466b48b15d1d4f0a731 commit bbef1c72b4873b657fdb0466b48b15d1d4f0a731 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-10-04 00:52:36 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2025-10-04 00:53:28 +0000 Revert "flua: support our flua modules in the bootstrap flua" This reverts commit 1953a12ee2cde1afacb3e3f7612d89695c96e04f, because it cannot work at all on macOS without more work, at a minimum. We use linker sets for module discovery, but we don't have a version of this that works for mach-o at the moment. --- contrib/libucl/lua/lua_ucl.c | 4 --- contrib/lyaml/ext/yaml/yaml.c | 4 --- libexec/flua/Makefile | 37 ++++--------------------- libexec/flua/Makefile.inc | 7 +---- libexec/flua/bootstrap.h | 30 -------------------- libexec/flua/libfreebsd/kenv/Makefile | 2 +- libexec/flua/libfreebsd/kenv/Makefile.inc | 2 -- libexec/flua/libfreebsd/kenv/kenv.c | 4 --- libexec/flua/libfreebsd/sys/linker/Makefile | 3 +- libexec/flua/libfreebsd/sys/linker/Makefile.inc | 2 -- libexec/flua/libfreebsd/sys/linker/linker.c | 4 --- libexec/flua/libhash/Makefile | 5 +++- libexec/flua/libhash/Makefile.inc | 3 -- libexec/flua/libhash/lhash.c | 4 --- libexec/flua/libjail/Makefile | 5 +++- libexec/flua/libjail/Makefile.inc | 3 -- libexec/flua/libjail/lua_jail.c | 4 --- libexec/flua/liblyaml/Makefile | 20 ++++++++++++- libexec/flua/liblyaml/Makefile.inc | 20 ------------- libexec/flua/libucl/Makefile | 12 +++++++- libexec/flua/libucl/Makefile.inc | 12 -------- libexec/flua/linit_flua.c | 29 +------------------ tools/build/Makefile | 1 - 23 files changed, 49 insertions(+), 168 deletions(-) diff --git a/contrib/libucl/lua/lua_ucl.c b/contrib/libucl/lua/lua_ucl.c index 1b3f9dfd111c..d6be69e42a71 100644 --- a/contrib/libucl/lua/lua_ucl.c +++ b/contrib/libucl/lua/lua_ucl.c @@ -30,8 +30,6 @@ #include "lua_ucl.h" #include <strings.h> -#include "bootstrap.h" - /*** * @module ucl * This lua module allows to parse objects from strings and to store data into @@ -1573,5 +1571,3 @@ ucl_object_toclosure (const ucl_object_t *obj) return (struct ucl_lua_funcdata*)obj->value.ud; } - -FLUA_MODULE(ucl); diff --git a/contrib/lyaml/ext/yaml/yaml.c b/contrib/lyaml/ext/yaml/yaml.c index 6a5ddc605e0f..54478610134f 100644 --- a/contrib/lyaml/ext/yaml/yaml.c +++ b/contrib/lyaml/ext/yaml/yaml.c @@ -35,8 +35,6 @@ #include "lyaml.h" -#include "bootstrap.h" - #define MYNAME "yaml" #define MYVERSION MYNAME " library for " LUA_VERSION " / " VERSION @@ -66,5 +64,3 @@ luaopen_yaml (lua_State *L) return 1; } - -FLUA_MODULE(yaml); diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile index 231abe5dafa2..86d27c0653d4 100644 --- a/libexec/flua/Makefile +++ b/libexec/flua/Makefile @@ -1,35 +1,10 @@ .include <src.lua.mk> -# New flua modules should be added here rather than to SUBDIR so that we can do -# the right thing for both bootstrap flua and target flua. The former does not -# do any shared libs, so we just build them all straight into flua itself rather -# than mucking about with the infrastructure to make them linkable -- thus, why -# these are all structured to have a Makefile that describes what we want -# *installed*, and a Makefile.inc that describes what we need to *build*. -FLUA_MODULES+= libhash -FLUA_MODULES+= libjail -FLUA_MODULES+= libucl -FLUA_MODULES+= liblyaml - -.ifdef BOOTSTRAPPING -FLUA_MODULES+= libfreebsd/sys/linker -FLUA_MODULES+= libfreebsd/kenv -CFLAGS+= -I${.CURDIR} -DBOOTSTRAPPING - -SHAREDIR= ${WORLDTMP}/legacy/usr/share/flua -FLUA_PATH= ${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua -CFLAGS+= -DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\" - -.for mod in ${FLUA_MODULES} -.include "${mod}/Makefile.inc" -.endfor - -.else - -FLUA_MODULES+= libfreebsd -SUBDIR+= ${FLUA_MODULES} - -.endif +SUBDIR+= libfreebsd +SUBDIR+= libhash +SUBDIR+= libjail +SUBDIR+= libucl +SUBDIR+= liblyaml LUASRC?= ${SRCTOP}/contrib/lua/src .PATH: ${LUASRC} @@ -39,7 +14,7 @@ WARNS?= 3 CWARNFLAGS.gcc+= -Wno-format-nonliteral -LIBADD+= lua +LIBADD= lua # Entry point SRCS+= lua.c diff --git a/libexec/flua/Makefile.inc b/libexec/flua/Makefile.inc index 37a49e258ecb..34505d54d7df 100644 --- a/libexec/flua/Makefile.inc +++ b/libexec/flua/Makefile.inc @@ -2,9 +2,4 @@ SHLIBDIR?= ${LIBDIR}/flua CFLAGS+= \ -I${SRCTOP}/contrib/lua/src \ - -I${SRCTOP}/lib/liblua \ - -I${SRCTOP}/libexec/flua - -.ifdef BOOTSTRAPPING -CFLAGS+= -DBOOTSTRAPPING -.endif + -I${SRCTOP}/lib/liblua diff --git a/libexec/flua/bootstrap.h b/libexec/flua/bootstrap.h deleted file mode 100644 index 74356d8677b3..000000000000 --- a/libexec/flua/bootstrap.h +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * Copyright (c) 2025 Kyle Evans <kevans@FreeBSD.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#ifndef FLUA_BOOTSTRAP_H -#define FLUA_BOOTSTRAP_H - -#ifdef BOOTSTRAPPING -#include <sys/linker_set.h> - -#include <lauxlib.h> - -SET_DECLARE(flua_module_set, const luaL_Reg); -#define FLUA_MODULE_DEF(ident, modname, openfn) \ - static const luaL_Reg ident = { modname, openfn }; \ - DATA_SET(flua_module_set, ident) - -#define FLUA_MODULE_NAMED(mod, name) \ - FLUA_MODULE_DEF(module_ ## mod, name, luaopen_ ## mod) -#define FLUA_MODULE(mod) \ - FLUA_MODULE_DEF(module_ ## mod, #mod, luaopen_ ## mod) -#else /* !BOOTSTRAPPING */ -#define FLUA_MODULE_DEF(ident, modname, openfn) -#define FLUA_MODULE_NAMED(mod, name) -#define FLUA_MODULE(modname) -#endif /* BOOTSTRAPPING */ - -#endif /* FLUA_BOOTSTRAP_H */ diff --git a/libexec/flua/libfreebsd/kenv/Makefile b/libexec/flua/libfreebsd/kenv/Makefile index a1b388bb3612..1726c892c515 100644 --- a/libexec/flua/libfreebsd/kenv/Makefile +++ b/libexec/flua/libfreebsd/kenv/Makefile @@ -1,5 +1,5 @@ SHLIB_NAME= kenv.so +SRCS+= kenv.c MAN= freebsd.kenv.3lua -.include "Makefile.inc" .include <bsd.lib.mk> diff --git a/libexec/flua/libfreebsd/kenv/Makefile.inc b/libexec/flua/libfreebsd/kenv/Makefile.inc deleted file mode 100644 index 05819c5280d9..000000000000 --- a/libexec/flua/libfreebsd/kenv/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ -.PATH: ${.PARSEDIR} -SRCS+= kenv.c diff --git a/libexec/flua/libfreebsd/kenv/kenv.c b/libexec/flua/libfreebsd/kenv/kenv.c index 56b24c72904a..954baa00facb 100644 --- a/libexec/flua/libfreebsd/kenv/kenv.c +++ b/libexec/flua/libfreebsd/kenv/kenv.c @@ -14,8 +14,6 @@ #include <lualib.h> #include <lauxlib.h> -#include "bootstrap.h" - int luaopen_freebsd_kenv(lua_State *L); static int @@ -96,5 +94,3 @@ luaopen_freebsd_kenv(lua_State *L) return (1); } - -FLUA_MODULE_NAMED(freebsd_kenv, "freebsd.kenv"); diff --git a/libexec/flua/libfreebsd/sys/linker/Makefile b/libexec/flua/libfreebsd/sys/linker/Makefile index f1f65ad5f6c1..1adf547b503c 100644 --- a/libexec/flua/libfreebsd/sys/linker/Makefile +++ b/libexec/flua/libfreebsd/sys/linker/Makefile @@ -1,6 +1,7 @@ SHLIB_NAME= linker.so +SRCS+= linker.c + MAN= freebsd.sys.linker.3lua -.include "Makefile.inc" .include <bsd.lib.mk> diff --git a/libexec/flua/libfreebsd/sys/linker/Makefile.inc b/libexec/flua/libfreebsd/sys/linker/Makefile.inc deleted file mode 100644 index da65c0070170..000000000000 --- a/libexec/flua/libfreebsd/sys/linker/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ -.PATH: ${.PARSEDIR} -SRCS+= linker.c diff --git a/libexec/flua/libfreebsd/sys/linker/linker.c b/libexec/flua/libfreebsd/sys/linker/linker.c index c78fbb2b39d2..87eccfb651f0 100644 --- a/libexec/flua/libfreebsd/sys/linker/linker.c +++ b/libexec/flua/libfreebsd/sys/linker/linker.c @@ -15,8 +15,6 @@ #include <lualib.h> #include <lauxlib.h> -#include "bootstrap.h" - int luaopen_freebsd_sys_linker(lua_State *L); static int @@ -82,5 +80,3 @@ luaopen_freebsd_sys_linker(lua_State *L) return (1); } - -FLUA_MODULE_NAMED(freebsd_sys_linker, "freebsd.sys.linker"); diff --git a/libexec/flua/libhash/Makefile b/libexec/flua/libhash/Makefile index 9cbd6f15acae..b7c8d7ee9948 100644 --- a/libexec/flua/libhash/Makefile +++ b/libexec/flua/libhash/Makefile @@ -1,6 +1,9 @@ SHLIB_NAME= hash.so +SRCS+= lhash.c + +LIBADD+= md + MAN= hash.3lua -.include "Makefile.inc" .include <bsd.lib.mk> diff --git a/libexec/flua/libhash/Makefile.inc b/libexec/flua/libhash/Makefile.inc deleted file mode 100644 index d112dfe7df33..000000000000 --- a/libexec/flua/libhash/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -.PATH: ${.PARSEDIR} -SRCS+= lhash.c -LIBADD+= md diff --git a/libexec/flua/libhash/lhash.c b/libexec/flua/libhash/lhash.c index 7127ddc1d530..4587961fe8a0 100644 --- a/libexec/flua/libhash/lhash.c +++ b/libexec/flua/libhash/lhash.c @@ -11,8 +11,6 @@ #include <sha256.h> #include <string.h> -#include "bootstrap.h" - #define SHA256_META "SHA256 meta table" #define SHA256_DIGEST_LEN 32 @@ -177,5 +175,3 @@ luaopen_hash(lua_State *L) return 1; } - -FLUA_MODULE(hash); diff --git a/libexec/flua/libjail/Makefile b/libexec/flua/libjail/Makefile index b9c8bdc39095..20cd9f5f1429 100644 --- a/libexec/flua/libjail/Makefile +++ b/libexec/flua/libjail/Makefile @@ -1,6 +1,9 @@ SHLIB_NAME= jail.so +SRCS+= lua_jail.c + +LIBADD+= jail + MAN= jail.3lua -.include "Makefile.inc" .include <bsd.lib.mk> diff --git a/libexec/flua/libjail/Makefile.inc b/libexec/flua/libjail/Makefile.inc deleted file mode 100644 index a896bf38c65b..000000000000 --- a/libexec/flua/libjail/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -.PATH: ${.PARSEDIR} -SRCS+= lua_jail.c -LIBADD+= jail diff --git a/libexec/flua/libjail/lua_jail.c b/libexec/flua/libjail/lua_jail.c index 8c3ec6c1d500..9632db795775 100644 --- a/libexec/flua/libjail/lua_jail.c +++ b/libexec/flua/libjail/lua_jail.c @@ -38,8 +38,6 @@ #include <lauxlib.h> #include <lualib.h> -#include "bootstrap.h" - #define JAIL_METATABLE "jail iterator metatable" /* @@ -718,5 +716,3 @@ luaopen_jail(lua_State *L) return (1); } - -FLUA_MODULE(jail); diff --git a/libexec/flua/liblyaml/Makefile b/libexec/flua/liblyaml/Makefile index 8d1432acd325..e7a89d09bb9e 100644 --- a/libexec/flua/liblyaml/Makefile +++ b/libexec/flua/liblyaml/Makefile @@ -1,4 +1,22 @@ SHLIB_NAME= yaml.so -.include "Makefile.inc" +WARNS= 1 +LYAMLSRC?= ${SRCTOP}/contrib/lyaml +.PATH: ${LYAMLSRC}/ext/yaml ${LYAMLSRC}/lib/lyaml +SRCS= emitter.c \ + parser.c \ + scanner.c \ + yaml.c +CFLAGS+= \ + -I${LYAMLSRC}/ext/yaml \ + -I${SRCTOP}/contrib/libyaml/include \ + -DVERSION=\"6.2.8\" +LIBADD+= yaml + +FILES= explicit.lua \ + functional.lua \ + implicit.lua \ + init.lua +FILESDIR= ${SHAREDIR}/flua/lyaml + .include <bsd.lib.mk> diff --git a/libexec/flua/liblyaml/Makefile.inc b/libexec/flua/liblyaml/Makefile.inc deleted file mode 100644 index caa1f37b57eb..000000000000 --- a/libexec/flua/liblyaml/Makefile.inc +++ /dev/null @@ -1,20 +0,0 @@ -WARNS= 1 - -LYAMLSRC?= ${SRCTOP}/contrib/lyaml -.PATH: ${LYAMLSRC}/ext/yaml ${LYAMLSRC}/lib/lyaml -SRCS+= emitter.c \ - parser.c \ - scanner.c \ - yaml.c -CFLAGS+= \ - -I${LYAMLSRC}/ext/yaml \ - -I${SRCTOP}/contrib/libyaml/include \ - -DVERSION=\"6.2.8\" -LIBADD+= yaml - -FILESGROUPS+= YAML -YAML= explicit.lua \ - functional.lua \ - implicit.lua \ - init.lua -YAMLDIR= ${SHAREDIR}/flua/lyaml diff --git a/libexec/flua/libucl/Makefile b/libexec/flua/libucl/Makefile index 32d76d1ea1ad..a88c8bda6bfc 100644 --- a/libexec/flua/libucl/Makefile +++ b/libexec/flua/libucl/Makefile @@ -1,4 +1,14 @@ SHLIB_NAME= ucl.so -.include "Makefile.inc" +WARNS= 2 + +UCLSRC?= ${SRCTOP}/contrib/libucl +.PATH: ${UCLSRC}/lua +SRCS+= lua_ucl.c +CFLAGS+= \ + -I${UCLSRC}/include \ + -I${UCLSRC}/src \ + -I${UCLSRC}/uthash +LIBADD+= ucl + .include <bsd.lib.mk> diff --git a/libexec/flua/libucl/Makefile.inc b/libexec/flua/libucl/Makefile.inc deleted file mode 100644 index 70fb0f265635..000000000000 --- a/libexec/flua/libucl/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -.if ${WARNS:U6} > 2 -WARNS= 2 -.endif - -UCLSRC?= ${SRCTOP}/contrib/libucl -.PATH: ${UCLSRC}/lua -SRCS+= lua_ucl.c -CFLAGS+= \ - -I${UCLSRC}/include \ - -I${UCLSRC}/src \ - -I${UCLSRC}/uthash -LIBADD+= ucl diff --git a/libexec/flua/linit_flua.c b/libexec/flua/linit_flua.c index 027f1b305d09..b466b7872158 100644 --- a/libexec/flua/linit_flua.c +++ b/libexec/flua/linit_flua.c @@ -26,8 +26,8 @@ #include "lprefix.h" + #include <stddef.h> -#include <stdlib.h> #include "lua.h" @@ -37,8 +37,6 @@ #include "lposix.h" #include "lfbsd.h" -#include "bootstrap.h" - /* ** these libs are loaded by lua.c and are readily available to any Lua ** program @@ -64,28 +62,6 @@ static const luaL_Reg loadedlibs[] = { {NULL, NULL} }; -#ifdef BOOTSTRAPPING -static void __attribute__((constructor)) flua_init_env(void) { - /* - * This happens in the middle of luaopen_package(). We could move it into - * flua_setup_mods(), but it seems better to avoid its timing being so - * important that it would break some of our bootstrap modules if someone - * were to reorder things. - */ - if (getenv("LUA_PATH") == NULL) - setenv("LUA_PATH", BOOTSTRAP_FLUA_PATH, 1); -} - -static void flua_setup_mods (lua_State *L) { - const luaL_Reg **flib; - - SET_FOREACH(flib, flua_module_set) { - luaL_requiref(L, (*flib)->name, (*flib)->func, 1); - lua_pop(L, 1); /* remove lib */ - } -}; -#endif - LUALIB_API void luaL_openlibs (lua_State *L) { const luaL_Reg *lib; /* "require" functions from 'loadedlibs' and set results to global table */ @@ -93,7 +69,4 @@ LUALIB_API void luaL_openlibs (lua_State *L) { luaL_requiref(L, lib->name, lib->func, 1); lua_pop(L, 1); /* remove lib */ } -#ifdef BOOTSTRAPPING - flua_setup_mods(L); -#endif } diff --git a/tools/build/Makefile b/tools/build/Makefile index 09351900599a..3c4e07e3cfc2 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -497,7 +497,6 @@ INSTALLDIR_LIST= \ usr/include/casper \ usr/include/openssl \ usr/include/private/ucl \ - usr/include/private/yaml \ usr/include/private/zstd \ usr/lib \ usr/libdata/pkgconfig \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510040053.5940rcXi066768>