git: 6989abb60371 - main - devel/lua-cjson/openresty: [NEW PORT]

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Sat, 28 Feb 2026 09:19:25 UTC
The branch main has been updated by mm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6989abb603714c58174ad7e1bec05b9724d470ca

commit 6989abb603714c58174ad7e1bec05b9724d470ca
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2026-02-28 09:13:39 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2026-02-28 09:19:19 +0000

    devel/lua-cjson/openresty: [NEW PORT]
    
    Fast JSON encoding/parsing for Lua with OpenResty enhancements
    
    This fork of mpx/lua-cjson is included in the OpenResty bundle and includes
    a few bugfixes and improvements, especially to facilitate the encoding of
    empty tables as JSON Arrays.
    
    Please refer to the lua-cjson documentation for standard usage.
    
    WWW:    https://github.com/openresty/lua-cjson
---
 devel/Makefile                      |  1 +
 devel/lua-cjson-openresty/Makefile  | 43 +++++++++++++++++++++++++++++++++++++
 devel/lua-cjson-openresty/distinfo  |  3 +++
 devel/lua-cjson-openresty/pkg-descr |  5 +++++
 4 files changed, 52 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index cae02f39dd8e..4d673fce5ae6 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1619,6 +1619,7 @@
     SUBDIR += lua-bitlib
     SUBDIR += lua-bitop
     SUBDIR += lua-cjson
+    SUBDIR += lua-cjson-openresty
     SUBDIR += lua-cqueues
     SUBDIR += lua-gettext
     SUBDIR += lua-language-server
diff --git a/devel/lua-cjson-openresty/Makefile b/devel/lua-cjson-openresty/Makefile
new file mode 100644
index 000000000000..1dc9e4b3a245
--- /dev/null
+++ b/devel/lua-cjson-openresty/Makefile
@@ -0,0 +1,43 @@
+PORTNAME=	cjson
+PORTVERSION=	2.1.0.16
+CATEGORIES=	devel
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
+PKGNAMESUFFIX=	-openresty
+DISTNAME=	lua-cjson-${PORTVERSION}
+
+MAINTAINER=	mm@FreeBSD.org
+COMMENT=	Fast JSON encoding/parsing for Lua with OpenResty enhancements
+WWW=		https://github.com/openresty/lua-cjson
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		lua:module
+
+CONFLICTS_INSTALL=	lua[0-9][0-9]-cjson
+
+MAKE_ARGS=	LUA_VERSION=${LUA_VER}
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	openresty
+GH_PROJECT=	lua-cjson
+
+OPTIONS_DEFINE=	DOCS
+OPTIONS_DEFAULT=DOCS
+
+DOCSDIR=	${PREFIX}/share/doc/${LUA_PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
+
+PLIST_FILES=	${LUA_MODLIBDIR}/cjson.so
+DOC_FILES=      README.md
+DOCS_PLIST_FILES=       ${DOC_FILES:S|^|${DOCSDIR_REL}/|}
+
+post-patch:
+	@${REINPLACE_CMD} '16,18d; \
+		21s|^\(LUA_INCLUDE.*\)\(PREFIX\)\(.*\)|\1LOCALBASE\3/lua${LUA_VER_STR}|' \
+		${WRKSRC}/Makefile
+
+post-install-DOCS-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${DOC_FILES:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/devel/lua-cjson-openresty/distinfo b/devel/lua-cjson-openresty/distinfo
new file mode 100644
index 000000000000..5de7e758a327
--- /dev/null
+++ b/devel/lua-cjson-openresty/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1772268900
+SHA256 (openresty-lua-cjson-2.1.0.16_GH0.tar.gz) = 4b7e96801ee9596216d52d09cc4d21657cfd575971b6bbe9e317a698ae376a8a
+SIZE (openresty-lua-cjson-2.1.0.16_GH0.tar.gz) = 103112
diff --git a/devel/lua-cjson-openresty/pkg-descr b/devel/lua-cjson-openresty/pkg-descr
new file mode 100644
index 000000000000..4455e1bced05
--- /dev/null
+++ b/devel/lua-cjson-openresty/pkg-descr
@@ -0,0 +1,5 @@
+This fork of mpx/lua-cjson is included in the OpenResty bundle and includes
+a few bugfixes and improvements, especially to facilitate the encoding of
+empty tables as JSON Arrays.
+
+Please refer to the lua-cjson documentation for standard usage.