d959f368aa
libucl comes with a Lua library binding. Build it into flua. This lets us parse/generate config files in the various formats supported by libucl with flua. For example, the following script will detect the format of an object written to stdin as one of UCL config, JSON, or YAML and write it to stdout as pretty-printed JSON: local ucl = require('ucl') local parser = ucl.parser() parser:parse_string(io.read('*a')) local obj = parser:get_object() print(ucl.to_format(obj, 'json')) Reviewed by: kevans, pstef Approved by: mmacy (mentor) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25009
42 lines
863 B
Makefile
42 lines
863 B
Makefile
#! $FreeBSD$
|
|
|
|
.include <src.lua.mk>
|
|
|
|
LUASRC?= ${SRCTOP}/contrib/lua/src
|
|
.PATH: ${LUASRC}
|
|
|
|
PROG= flua
|
|
WARNS?= 2
|
|
MAN= # No manpage; this is internal.
|
|
|
|
CWARNFLAGS.gcc+= -Wno-format-nonliteral
|
|
|
|
LIBADD= lua
|
|
|
|
# Entry point
|
|
SRCS+= lua.c
|
|
|
|
# FreeBSD Extensions
|
|
.PATH: ${.CURDIR}/modules
|
|
SRCS+= linit_flua.c
|
|
SRCS+= lfs.c lposix.c
|
|
|
|
CFLAGS+= -I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
|
|
CFLAGS+= -DLUA_PROGNAME="\"${PROG}\""
|
|
|
|
# readline bits; these aren't needed if we're building a bootstrap flua, as we
|
|
# don't expect that one to see any REPL usage.
|
|
.if !defined(BOOTSTRAPPING)
|
|
CFLAGS+= -DLUA_USE_READLINE
|
|
CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit
|
|
LIBADD+= edit
|
|
.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>
|