git: 5623db0c74b4 - main - textproc/pdjson: Public Domain JSON Parser Library for C

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 29 Aug 2025 18:03:52 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5623db0c74b4d320d7617df7417f89bc91f9b937

commit 5623db0c74b4d320d7617df7417f89bc91f9b937
Author:     Nico Sonack <nsonack@herrhotzenplotz.de>
AuthorDate: 2025-08-27 09:01:51 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-08-29 18:01:55 +0000

    textproc/pdjson: Public Domain JSON Parser Library for C
    
    A public domain JSON parser focused on correctness, ANSI C99
    compliance, full Unicode (UTF-8) support, minimal memory footprint,
    and a simple API. As a streaming API, arbitrary large JSON could
    be processed with a small amount of memory (the size of the largest
    string in the JSON).
---
 textproc/Makefile                    |  1 +
 textproc/pdjson/Makefile             | 27 +++++++++++++++++++++++++++
 textproc/pdjson/distinfo             |  3 +++
 textproc/pdjson/files/patch-Makefile | 21 +++++++++++++++++++++
 textproc/pdjson/files/pdjson.pc.in   | 11 +++++++++++
 textproc/pdjson/pkg-descr            |  5 +++++
 textproc/pdjson/pkg-plist            |  4 ++++
 7 files changed, 72 insertions(+)

diff --git a/textproc/Makefile b/textproc/Makefile
index 9f9508f45f72..8844023e0091 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -1228,6 +1228,7 @@
     SUBDIR += pdfresurrect
     SUBDIR += pdfsandwich
     SUBDIR += pdftohtml
+    SUBDIR += pdjson
     SUBDIR += pear-File_Fortune
     SUBDIR += pear-File_MARC
     SUBDIR += pear-Horde_CssMinify
diff --git a/textproc/pdjson/Makefile b/textproc/pdjson/Makefile
new file mode 100644
index 000000000000..087c1e6d1a8d
--- /dev/null
+++ b/textproc/pdjson/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	pdjson
+DISTVERSION=	g20250825
+CATEGORIES=	textproc
+
+MAINTAINER=	nsonack@herrhotzenplotz.de
+COMMENT=	Public Domain JSON Parser Library for C
+
+LICENSE=	UNLICENSE
+LICENSE_FILE=	${WRKSRC}/UNLICENSE
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	skeeto
+GH_TAGNAME=	78fe04b820dc8817f540bdd87fb22887e0ef3981
+USE_LDCONFIG=	yes
+
+TEST_TARGET=	check
+
+SUB_FILES=	pdjson.pc
+SUB_LIST=	DISTVERSION=${DISTVERSION}
+
+do-install:
+	${INSTALL_LIB} ${WRKSRC}/libpdjson.so ${STAGEDIR}${LOCALBASE}/lib/libpdjson.so.0
+	${RLN} ${STAGEDIR}${LOCALBASE}/lib/libpdjson.so.0  ${STAGEDIR}${LOCALBASE}/lib/libpdjson.so
+	${INSTALL} ${WRKSRC}/pdjson.h ${STAGEDIR}${LOCALBASE}/include
+	${INSTALL_DATA} ${WRKDIR}/pdjson.pc ${STAGEDIR}${LOCALBASE}/libdata/pkgconfig
+
+.include <bsd.port.mk>
diff --git a/textproc/pdjson/distinfo b/textproc/pdjson/distinfo
new file mode 100644
index 000000000000..b457f5012f19
--- /dev/null
+++ b/textproc/pdjson/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1756138081
+SHA256 (skeeto-pdjson-g20250825-78fe04b820dc8817f540bdd87fb22887e0ef3981_GH0.tar.gz) = e6bf6a90e65736faa5cfa6641a1f3278b577504d63f7fd2bf6b1454d94fa223c
+SIZE (skeeto-pdjson-g20250825-78fe04b820dc8817f540bdd87fb22887e0ef3981_GH0.tar.gz) = 11698
diff --git a/textproc/pdjson/files/patch-Makefile b/textproc/pdjson/files/patch-Makefile
new file mode 100644
index 000000000000..bfe7b015e15f
--- /dev/null
+++ b/textproc/pdjson/files/patch-Makefile
@@ -0,0 +1,21 @@
+--- Makefile.orig	2024-02-22 11:12:52 UTC
++++ Makefile
+@@ -1,8 +1,8 @@
+ .POSIX:
+-CC     = cc
+-CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-missing-field-initializers
++CC     ?= cc
++CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-missing-field-initializers -fPIC
+ 
+-all: tests/pretty tests/stream tests/tests
++all: libpdjson.so tests/pretty tests/stream tests/tests
+ 
+ tests/pretty: tests/pretty.o pdjson.o
+ 	$(CC) $(LDFLAGS) -o $@ tests/pretty.o pdjson.o $(LDLIBS)
+@@ -28,3 +28,6 @@ clean:
+ 
+ .c.o:
+ 	$(CC) -c $(CFLAGS) -o $@ $<
++
++libpdjson.so: pdjson.o
++	$(CC) -shared -Wl,-soname=libpdjson.so.0 -o libpdjson.so pdjson.o
diff --git a/textproc/pdjson/files/pdjson.pc.in b/textproc/pdjson/files/pdjson.pc.in
new file mode 100644
index 000000000000..5feb5f556ec3
--- /dev/null
+++ b/textproc/pdjson/files/pdjson.pc.in
@@ -0,0 +1,11 @@
+prefix=%%PREFIX%%
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: pdjson
+Version: %%DISTVERSION%%
+Description: Public Domain JSON parser
+URL: https://github.com/skeeto/pdjson
+Libs: -L${libdir} -lpdjson
+Cflags: -I${includedir}
+
diff --git a/textproc/pdjson/pkg-descr b/textproc/pdjson/pkg-descr
new file mode 100644
index 000000000000..9443bb133061
--- /dev/null
+++ b/textproc/pdjson/pkg-descr
@@ -0,0 +1,5 @@
+A public domain JSON parser focused on correctness, ANSI C99
+compliance, full Unicode (UTF-8) support, minimal memory footprint,
+and a simple API. As a streaming API, arbitrary large JSON could
+be processed with a small amount of memory (the size of the largest
+string in the JSON).
diff --git a/textproc/pdjson/pkg-plist b/textproc/pdjson/pkg-plist
new file mode 100644
index 000000000000..98c00cb58daa
--- /dev/null
+++ b/textproc/pdjson/pkg-plist
@@ -0,0 +1,4 @@
+include/pdjson.h
+lib/libpdjson.so
+lib/libpdjson.so.0
+libdata/pkgconfig/pdjson.pc