textproc/libxmlb: import libxmlb-0.3.14

XML is slow to parse and strings inside the document cannot be memory mapped as
they do not have a trailing NUL char. The libxmlb library takes XML source, and
converts it to a structured binary representation with a deduplicated string
table -- where the strings have the NULs included.

This allows an application to mmap the binary XML file, do an XPath query and
return some strings without actually parsing the entire document. This is all
done using (almost) zero allocations and no actual copying of the binary data.

As each node in the binary XML file encodes the 'next' node at the same level
it makes skipping whole subtrees trivial. A 10Mb binary XML file can be loaded
from disk *and* queried in less than a few milliseconds.
This commit is contained in:
wiz 2023-10-15 07:50:09 +00:00
parent a658f777a5
commit ef74863d98
5 changed files with 127 additions and 0 deletions

12
textproc/libxmlb/DESCR Normal file
View File

@ -0,0 +1,12 @@
XML is slow to parse and strings inside the document cannot be memory mapped as
they do not have a trailing NUL char. The libxmlb library takes XML source, and
converts it to a structured binary representation with a deduplicated string
table -- where the strings have the NULs included.
This allows an application to mmap the binary XML file, do an XPath query and
return some strings without actually parsing the entire document. This is all
done using (almost) zero allocations and no actual copying of the binary data.
As each node in the binary XML file encodes the 'next' node at the same level
it makes skipping whole subtrees trivial. A 10Mb binary XML file can be loaded
from disk *and* queried in less than a few milliseconds.

25
textproc/libxmlb/Makefile Normal file
View File

@ -0,0 +1,25 @@
# $NetBSD: Makefile,v 1.1 2023/10/15 07:50:09 wiz Exp $
DISTNAME= libxmlb-0.3.14
CATEGORIES= textproc
MASTER_SITES= ${MASTER_SITE_GITHUB:=hughsie/libxmlb/releases/download/${PKGREVISION_NOREV}/}
EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://github.com/hughsie/libxmlb
COMMENT= Library to help create and query binary XML blobs
LICENSE= gnu-lgpl-v2.1
TOOL_DEPENDS+= gtk-doc-[0-9]*:../../textproc/gtk-doc
USE_TOOLS+= pkg-config
PKGCONFIG_OVERRIDE+= output/meson-private/xmlb.pc
PKGCONFIG_OVERRIDE_STAGE= post-configure
.include "../../archivers/xz/buildlink3.mk"
.include "../../archivers/zstd/buildlink3.mk"
.include "../../devel/glib2/buildlink3.mk"
.include "../../devel/gobject-introspection/buildlink3.mk"
.include "../../devel/meson/build.mk"
.include "../../mk/bsd.pkg.mk"

69
textproc/libxmlb/PLIST Normal file
View File

@ -0,0 +1,69 @@
@comment $NetBSD: PLIST,v 1.1 2023/10/15 07:50:09 wiz Exp $
bin/xb-tool
include/libxmlb-2/libxmlb/xb-builder-fixup.h
include/libxmlb-2/libxmlb/xb-builder-node.h
include/libxmlb-2/libxmlb/xb-builder-source-ctx.h
include/libxmlb-2/libxmlb/xb-builder-source.h
include/libxmlb-2/libxmlb/xb-builder.h
include/libxmlb-2/libxmlb/xb-machine.h
include/libxmlb-2/libxmlb/xb-node-query.h
include/libxmlb-2/libxmlb/xb-node-silo.h
include/libxmlb-2/libxmlb/xb-node.h
include/libxmlb-2/libxmlb/xb-opcode.h
include/libxmlb-2/libxmlb/xb-query-context.h
include/libxmlb-2/libxmlb/xb-query.h
include/libxmlb-2/libxmlb/xb-silo-export.h
include/libxmlb-2/libxmlb/xb-silo-query.h
include/libxmlb-2/libxmlb/xb-silo.h
include/libxmlb-2/libxmlb/xb-stack.h
include/libxmlb-2/libxmlb/xb-string.h
include/libxmlb-2/libxmlb/xb-value-bindings.h
include/libxmlb-2/libxmlb/xb-version.h
include/libxmlb-2/xmlb.h
lib/girepository-1.0/Xmlb-2.0.typelib
lib/libxmlb.so
lib/libxmlb.so.2
lib/libxmlb.so.2.0.0
lib/pkgconfig/xmlb.pc
libexec/installed-tests/libxmlb/test.desktop
libexec/installed-tests/libxmlb/test.quirk
libexec/installed-tests/libxmlb/test.xml
libexec/installed-tests/libxmlb/test.xml.gz.gz.gz
libexec/installed-tests/libxmlb/test.xml.xz
libexec/installed-tests/libxmlb/test.xml.zstd
libexec/installed-tests/libxmlb/xb-self-test
man/man1/xb-tool.1
share/gir-1.0/Xmlb-2.0.gir
share/gtk-doc/html/libxmlb/annotation-glossary.html
share/gtk-doc/html/libxmlb/api-index-full.html
share/gtk-doc/html/libxmlb/deprecated-api-index.html
share/gtk-doc/html/libxmlb/home.png
share/gtk-doc/html/libxmlb/index.html
share/gtk-doc/html/libxmlb/intro.html
share/gtk-doc/html/libxmlb/left-insensitive.png
share/gtk-doc/html/libxmlb/left.png
share/gtk-doc/html/libxmlb/libxmlb-XbBuilder.html
share/gtk-doc/html/libxmlb/libxmlb-XbBuilderFixup.html
share/gtk-doc/html/libxmlb/libxmlb-XbBuilderNode.html
share/gtk-doc/html/libxmlb/libxmlb-XbBuilderSource.html
share/gtk-doc/html/libxmlb/libxmlb-XbBuilderSourceCtx.html
share/gtk-doc/html/libxmlb/libxmlb-XbMachine.html
share/gtk-doc/html/libxmlb/libxmlb-XbNode.html
share/gtk-doc/html/libxmlb/libxmlb-XbQuery.html
share/gtk-doc/html/libxmlb/libxmlb-XbSilo.html
share/gtk-doc/html/libxmlb/libxmlb-xb-node-query.html
share/gtk-doc/html/libxmlb/libxmlb-xb-opcode.html
share/gtk-doc/html/libxmlb/libxmlb-xb-query-context.html
share/gtk-doc/html/libxmlb/libxmlb-xb-silo-export.html
share/gtk-doc/html/libxmlb/libxmlb-xb-silo-query.html
share/gtk-doc/html/libxmlb/libxmlb-xb-stack.html
share/gtk-doc/html/libxmlb/libxmlb-xb-string.html
share/gtk-doc/html/libxmlb/libxmlb-xb-value-bindings.html
share/gtk-doc/html/libxmlb/libxmlb.devhelp2
share/gtk-doc/html/libxmlb/libxmlb.html
share/gtk-doc/html/libxmlb/right-insensitive.png
share/gtk-doc/html/libxmlb/right.png
share/gtk-doc/html/libxmlb/style.css
share/gtk-doc/html/libxmlb/up-insensitive.png
share/gtk-doc/html/libxmlb/up.png
share/installed-tests/libxmlb/libxmlb.test

View File

@ -0,0 +1,16 @@
# $NetBSD: buildlink3.mk,v 1.1 2023/10/15 07:50:09 wiz Exp $
BUILDLINK_TREE+= libxmlb
.if !defined(LIBXMLB_BUILDLINK3_MK)
LIBXMLB_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.libxmlb+= libxmlb>=0.3.14
BUILDLINK_PKGSRCDIR.libxmlb?= ../../textproc/libxmlb
.include "../../devel/glib2/buildlink3.mk"
.include "../../archivers/xz/buildlink3.mk"
.include "../../archivers/zstd/buildlink3.mk"
.endif # LIBXMLB_BUILDLINK3_MK
BUILDLINK_TREE+= -libxmlb

View File

@ -0,0 +1,5 @@
$NetBSD: distinfo,v 1.1 2023/10/15 07:50:09 wiz Exp $
BLAKE2s (libxmlb-0.3.14.tar.xz) = 32c3314cd0c104ed95c2003953a599f1a2d9c6252c9569c0542c1825bb3c5ef7
SHA512 (libxmlb-0.3.14.tar.xz) = d046b8e626d7ec74eeb816f49e8b8a857f51b30808fc85b69aa55c5cf401c716ef846c4e6c03e6806b379110a0d6197599b4b73e100c8589b74e1e1b68940b57
Size (libxmlb-0.3.14.tar.xz) = 100288 bytes