From 564b9ff2a7aa62f1094043b12de56ad75aa30394 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 17 Mar 2020 17:28:12 +0000 Subject: [PATCH] Add an internal liblua and use it in flua. The new liblua will be used in a forthcoming import of kyua. Reviewed by: kevans Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24090 --- Makefile.inc1 | 3 ++- lib/Makefile | 1 + lib/liblua/Makefile | 29 ++++++++++++++++++++++++++ {libexec/flua => lib/liblua}/luaconf.h | 0 libexec/flua/Makefile | 15 ++----------- share/mk/src.libnames.mk | 5 +++++ 6 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 lib/liblua/Makefile rename {libexec/flua => lib/liblua}/luaconf.h (100%) diff --git a/Makefile.inc1 b/Makefile.inc1 index 037c562f7cba..08eaa8999c09 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2165,7 +2165,8 @@ ${_bt}-lib/libdwarf: ${_bt_m4_depend} # 13.0-CURRENT cycle, thus needs to be built on -older releases and stable # branches. .if ${BOOTSTRAPPING} < 1300059 -_flua= libexec/flua +${_bt}-libexec/flua: ${_bt}-lib/liblua +_flua= lib/liblua libexec/flua .endif # r245440 mtree -N support added diff --git a/lib/Makefile b/lib/Makefile index 14f9e4715020..ca881d6b0688 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -61,6 +61,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libjail \ libkiconv \ libkvm \ + liblua \ liblzma \ libmemstat \ libmd \ diff --git a/lib/liblua/Makefile b/lib/liblua/Makefile new file mode 100644 index 000000000000..40d9c5c924b0 --- /dev/null +++ b/lib/liblua/Makefile @@ -0,0 +1,29 @@ +#! $FreeBSD$ + +LUASRC?= ${SRCTOP}/contrib/lua/src +.PATH: ${LUASRC} + +LIB= lua +INTERNALLIB= +WARNS?= 2 +MAN= # No manpage; this is internal. + +CWARNFLAGS.gcc+= -Wno-format-nonliteral + +LIBADD= m + +# Core functions +SRCS= lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c \ + llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c \ + ltable.c ltm.c lundump.c lvm.c lzio.c + +# Library functions; any change to these likely needs an accompanying change +# in our custom linit_flua.c. We use our custom linit.c to make it easier to +# support bootstrap flua that may not have supporting local libraries. +SRCS+= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c \ + lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c + +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} +CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" + +.include diff --git a/libexec/flua/luaconf.h b/lib/liblua/luaconf.h similarity index 100% rename from libexec/flua/luaconf.h rename to lib/liblua/luaconf.h diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile index 1d424ed44da6..a3652088b3b5 100644 --- a/libexec/flua/Makefile +++ b/libexec/flua/Makefile @@ -11,18 +11,7 @@ MAN= # No manpage; this is internal. CWARNFLAGS.gcc+= -Wno-format-nonliteral -LIBADD= m - -# Core functions -SRCS= lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c \ - lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c \ - ltm.c lundump.c lvm.c lzio.c - -# Library functions; any change to these likely needs an accompanying change -# in our custom linit_flua.c. We use our custom linit.c to make it easier to -# support bootstrap flua that may not have supporting local libraries. -SRCS+= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c \ - lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c +LIBADD= lua # Entry point SRCS+= lua.c @@ -32,7 +21,7 @@ SRCS+= lua.c SRCS+= linit_flua.c SRCS+= lfs.c lposix.c -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} +CFLAGS+= -I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC} CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" .include diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index ff0e1f5c765d..bc9431f19db9 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -41,6 +41,7 @@ _INTERNALLIBS= \ ifconfig \ ipf \ lpr \ + lua \ netbsd \ ntp \ ntpevent \ @@ -293,6 +294,7 @@ _DP_memstat= kvm _DP_magic= z _DP_mt= sbuf bsdxml _DP_ldns= ssl crypto +_DP_lua= m .if ${MK_OPENSSL} != "no" _DP_fetch= ssl crypto .else @@ -468,6 +470,9 @@ _LIB_OBJTOP?= ${OBJTOP} LIBELFTCDIR= ${_LIB_OBJTOP}/lib/libelftc LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a +LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua +LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a + LIBPEDIR= ${_LIB_OBJTOP}/lib/libpe LIBPE?= ${LIBPEDIR}/libpe${PIE_SUFFIX}.a