From owner-svn-src-head@freebsd.org Mon Jun 22 03:14:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEAAB33CD93; Mon, 22 Jun 2020 03:14:44 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49qvfD5NFBz43R7; Mon, 22 Jun 2020 03:14:44 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3F6427AAA; Mon, 22 Jun 2020 03:14:44 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05M3Eimk063008; Mon, 22 Jun 2020 03:14:44 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05M3Eic1063005; Mon, 22 Jun 2020 03:14:44 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202006220314.05M3Eic1063005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Mon, 22 Jun 2020 03:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362477 - in head: . libexec/flua tools/build X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: . libexec/flua tools/build X-SVN-Commit-Revision: 362477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2020 03:14:44 -0000 Author: freqlabs Date: Mon Jun 22 03:14:43 2020 New Revision: 362477 URL: https://svnweb.freebsd.org/changeset/base/362477 Log: flua: add ucl library 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 Modified: head/Makefile.inc1 head/libexec/flua/Makefile head/libexec/flua/linit_flua.c head/tools/build/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jun 22 01:31:08 2020 (r362476) +++ head/Makefile.inc1 Mon Jun 22 03:14:43 2020 (r362477) @@ -2112,8 +2112,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 -${_bt}-libexec/flua: ${_bt}-lib/liblua -_flua= lib/liblua libexec/flua +${_bt}-libexec/flua: ${_bt}-lib/liblua ${_bt}-lib/libucl +_flua= lib/liblua lib/libucl libexec/flua .endif # r245440 mtree -N support added Modified: head/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Jun 22 01:31:08 2020 (r362476) +++ head/libexec/flua/Makefile Mon Jun 22 03:14:43 2020 (r362477) @@ -32,4 +32,10 @@ CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/l 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 Modified: head/libexec/flua/linit_flua.c ============================================================================== --- head/libexec/flua/linit_flua.c Mon Jun 22 01:31:08 2020 (r362476) +++ head/libexec/flua/linit_flua.c Mon Jun 22 03:14:43 2020 (r362477) @@ -36,6 +36,7 @@ #include "lauxlib.h" #include "lfs.h" #include "lposix.h" +#include "lua_ucl.h" /* ** these libs are loaded by lua.c and are readily available to any Lua @@ -59,6 +60,7 @@ static const luaL_Reg loadedlibs[] = { {"lfs", luaopen_lfs}, {"posix.sys.stat", luaopen_posix_sys_stat}, {"posix.unistd", luaopen_posix_unistd}, + {"ucl", luaopen_ucl}, {NULL, NULL} }; Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Mon Jun 22 01:31:08 2020 (r362476) +++ head/tools/build/Makefile Mon Jun 22 03:14:43 2020 (r362477) @@ -149,6 +149,7 @@ INSTALLDIR_LIST= \ lib/casper \ lib/geom \ usr/include/casper \ + usr/include/private/ucl \ usr/include/private/zstd \ usr/lib \ usr/libexec