opnsense-src/libexec/flua/libucl
Kyle Evans 2ef21abe89 flua: support our flua modules in the bootstrap flua
This version builds every module into the flua binary itself, since all
of the bootstrap tools are built -DNO_SHARED.  As a result, we also
cannot dlsym(), so we can't really discover the names of our newly
builtin modules.  Instead, just build out a linker set with all of our
luaopen_*() functions to register everything up-front.

Building in all of the modules isn't strictly necessary, but it means
that we have an example of how to add a bootstrap module everywhere you
go and one doesn't need to consider whether bootstrap flua can use a
module when writing scripts.  On my build machine, the consequence on
our binary size is an increase from around 1.6M -> 1.9M, which isn't
really that bad.

.lua modules can install into their usual path below $WORLDTMP/legacy
and we'll pick them up automagically by way of the ctor that sets up
LUA_PATH early on.

This re-lands bootstrap module support with a more sensible subset, and
after having verified that it cross-builds fine on macOS and Linux -- we
cannot do libfreebsd on !FreeBSD because it's more system header
dependant.  We also need to bootstrap libmd to bring in libhash, and
libucl + libyaml.

Reviewed by:	bapt, emaste (both previous version)

(cherry picked from commit 1953a12ee2cde1afacb3e3f7612d89695c96e04f)
(cherry picked from commit 80ada959004c4386880e47b11618f8abfc2d80e1)
(cherry picked from commit 31320402472394af57eb3a36bee7f944117ca0ed)
(cherry picked from commit 981cf36d64c48ebfa22d44ac83b6d448c2974f23)
(cherry picked from commit d4c973fa148544a0b949ceb1efb6c68096f02baf)
(cherry picked from commit bbef1c72b4873b657fdb0466b48b15d1d4f0a731)
(cherry picked from commit 151bd3516b541823b16793460d73916e63d2b9c1)

build: don't create duplicate bootstrap-tools targets

The general problem is that we might have a somewhat complicated
dependency tree depending on bootstrap version requirements.  We could
document when multiple bootstrap tools might have a shared dependency
and be careful to add them only once to the list, but that is a little
more fragile- particularly if we purge some bootstrap tools and need to
re-work the logic a little bit.

Just avoid redefining the build commands as we're iterating over the
list so that we can keep the actual requirements intact.

Reported by:	dhw, others
Reviewed by:	imp

(cherry picked from commit ab492c08fc3cbf4fb5d569663c0751bc2a41cb1f)
2026-04-10 22:18:20 -05:00
..
Makefile
Makefile.inc