git: bb2d016afb00 - main - flua: make the ucl module a dynamic module

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Fri, 06 Sep 2024 15:25:01 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=bb2d016afb009920f4bb2400c15a86e557b2d55a

commit bb2d016afb009920f4bb2400c15a86e557b2d55a
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-09-06 15:13:08 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-09-06 15:21:29 +0000

    flua: make the ucl module a dynamic module
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D46569
---
 lib/flua/Makefile         |  1 +
 lib/flua/libucl/Makefile  | 17 +++++++++++++++++
 libexec/flua/Makefile     |  8 +-------
 libexec/flua/linit_flua.c |  2 --
 4 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/lib/flua/Makefile b/lib/flua/Makefile
index 769736039f7e..168d05f54674 100644
--- a/lib/flua/Makefile
+++ b/lib/flua/Makefile
@@ -1,4 +1,5 @@
 SUBDIR+=	libhash
 SUBDIR+=	libjail
+SUBDIR+=	libucl
 
 .include <bsd.subdir.mk>
diff --git a/lib/flua/libucl/Makefile b/lib/flua/libucl/Makefile
new file mode 100644
index 000000000000..7d2681b85fcb
--- /dev/null
+++ b/lib/flua/libucl/Makefile
@@ -0,0 +1,17 @@
+SHLIB_NAME=	ucl.so
+SHLIBDIR=	${LIBDIR}/flua
+
+WARNS=		2
+
+UCLSRC?= 	${SRCTOP}/contrib/libucl
+.PATH: ${UCLSRC}/lua
+SRCS+=		lua_ucl.c
+CFLAGS+=	\
+		-I${SRCTOP}/contrib/lua/src \
+		-I${SRCTOP}/lib/liblua \
+		-I${UCLSRC}/include \
+		-I${UCLSRC}/src \
+		-I${UCLSRC}/uthash
+LIBADD+=	ucl
+
+.include <bsd.lib.mk>
diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile
index e324ca993711..c8206b94769d 100644
--- a/libexec/flua/Makefile
+++ b/libexec/flua/Makefile
@@ -4,7 +4,7 @@ LUASRC?=	${SRCTOP}/contrib/lua/src
 .PATH: ${LUASRC}
 
 PROG=	flua
-WARNS?=	2
+WARNS?=	3
 MAN=	# No manpage; this is internal.
 
 CWARNFLAGS.gcc+=	-Wno-format-nonliteral
@@ -31,10 +31,4 @@ LIBADD+=	edit
 LDFLAGS+=	-Wl,-E
 .endif
 
-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.prog.mk>
diff --git a/libexec/flua/linit_flua.c b/libexec/flua/linit_flua.c
index 1b7d83016cfe..4635970d1fd7 100644
--- a/libexec/flua/linit_flua.c
+++ b/libexec/flua/linit_flua.c
@@ -36,7 +36,6 @@
 #include "lfs.h"
 #include "lposix.h"
 #include "lfbsd.h"
-#include "lua_ucl.h"
 
 /*
 ** these libs are loaded by lua.c and are readily available to any Lua
@@ -61,7 +60,6 @@ static const luaL_Reg loadedlibs[] = {
   {"posix.sys.stat", luaopen_posix_sys_stat},
   {"posix.sys.utsname", luaopen_posix_sys_utsname},
   {"posix.unistd", luaopen_posix_unistd},
-  {"ucl", luaopen_ucl},
   {"fbsd", luaopen_fbsd},
   {NULL, NULL}
 };