summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2025-01-13 17:03:51 +0100
committerOlivier Certner <olce@FreeBSD.org>2025-01-13 19:04:23 +0100
commitd761d9fdd64e2e0ea9ce21c474febcf193a8e5da (patch)
tree0aea80b10b677fbd0bf356d7bfb9e59b604b5905
parentwww/kiwix-tools: Fetch from official site; Revise WWW and COMMENT (diff)
archivers/zim-tools: New port: Command-line tools for ZIM files
Sponsored by: The FreeBSD Foundation
-rw-r--r--archivers/zim-tools/Makefile27
-rw-r--r--archivers/zim-tools/distinfo3
-rw-r--r--archivers/zim-tools/files/patch-meson.build16
-rw-r--r--archivers/zim-tools/files/patch-src_zimcheck_meson.build30
-rw-r--r--archivers/zim-tools/pkg-descr14
-rw-r--r--archivers/zim-tools/pkg-plist9
6 files changed, 99 insertions, 0 deletions
diff --git a/archivers/zim-tools/Makefile b/archivers/zim-tools/Makefile
new file mode 100644
index 000000000000..fa4f735ec98c
--- /dev/null
+++ b/archivers/zim-tools/Makefile
@@ -0,0 +1,27 @@
+PORTNAME= zim-tools
+DISTVERSION= 3.5.0
+CATEGORIES= archivers
+MASTER_SITES= https://download.openzim.org/release/zim-tools/
+
+MAINTAINER= olce.freebsd.ports@certner.fr
+COMMENT= Tools for handling ZIM files
+WWW= https://github.com/openzim/zim-tools
+
+LICENSE= GPLv3+
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${LOCALBASE}/include/kainjow/mustache.hpp:devel/mustache \
+ googletest>0:devel/googletest
+LIB_DEPENDS= libdocopt.so:devel/docopt.cpp \
+ libgumbo.so:devel/gumbo \
+ libicui18n.so:devel/icu \
+ libzim.so:devel/libzim
+
+USES= compiler:c++17-lang meson pkgconfig tar:xz
+
+CPPFLAGS+= -I${LOCALBASE}/include/kainjow
+CXXFLAGS+= -I${LOCALBASE}/include/kainjow
+
+PLIST_SUB= DISTVERSION=${DISTVERSION} DISTMAJ=${DISTVERSION:C/\..*//}
+
+.include <bsd.port.mk>
diff --git a/archivers/zim-tools/distinfo b/archivers/zim-tools/distinfo
new file mode 100644
index 000000000000..ed595cf30b04
--- /dev/null
+++ b/archivers/zim-tools/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1736766185
+SHA256 (zim-tools-3.5.0.tar.xz) = cdf5ab5ca0c58150c7f3069462e09d49c1588e985ff1be817ef2a2888cbf83d0
+SIZE (zim-tools-3.5.0.tar.xz) = 230416
diff --git a/archivers/zim-tools/files/patch-meson.build b/archivers/zim-tools/files/patch-meson.build
new file mode 100644
index 000000000000..b913095ecb3b
--- /dev/null
+++ b/archivers/zim-tools/files/patch-meson.build
@@ -0,0 +1,16 @@
+--- meson.build.orig 2024-09-08 18:40:36 UTC
++++ meson.build
+@@ -17,10 +17,10 @@ endif
+ endif
+ endif
+
+-libzim_dep = dependency('libzim', version:'>=9.2.0', static:static_linkage)
+-libzim_dep = dependency('libzim', version:'<10.0.0', static:static_linkage)
++libzim_dep = dependency('libzim', version:['>=9.2.0', '<10.0.0'], static:static_linkage)
+
+-with_xapian_support = compiler.has_header_symbol('zim/zim.h', 'LIBZIM_WITH_XAPIAN')
++with_xapian_support = compiler.has_header_symbol(
++ 'zim/zim.h', 'LIBZIM_WITH_XAPIAN', dependencies: libzim_dep)
+
+ find_library_in_compiler = meson.version().version_compare('>=0.31.0')
+ rt_dep = dependency('rt', required:false)
diff --git a/archivers/zim-tools/files/patch-src_zimcheck_meson.build b/archivers/zim-tools/files/patch-src_zimcheck_meson.build
new file mode 100644
index 000000000000..e458ce1b224f
--- /dev/null
+++ b/archivers/zim-tools/files/patch-src_zimcheck_meson.build
@@ -0,0 +1,30 @@
+--- src/zimcheck/meson.build.orig 2024-09-08 18:40:36 UTC
++++ src/zimcheck/meson.build
+@@ -8,11 +8,13 @@ inc = include_directories(extra_include)
+
+ inc = include_directories(extra_include)
+
+-if compiler.get_id() == 'gcc' and host_machine.system() == 'linux'
+- # C++ std::thread is implemented using pthread on linux by gcc
+- thread_dep = dependency('threads')
+-else
+- thread_dep = dependency('', required:false)
++zimcheck_deps = [libzim_dep, icu_dep, docopt_dep]
++
++# C++ std::thread is implemented using pthread on Linux by GCC, and on FreeBSD
++# for both GCC and LLVM.
++if (host_machine.system() == 'linux' and compiler.get_id() == 'gcc') or \
++ host_machine.system() == 'freebsd'
++ zimcheck_deps += dependency('threads')
+ endif
+
+ executable('zimcheck',
+@@ -23,7 +25,5 @@ executable('zimcheck',
+ '../tools.cpp',
+ '../metadata.cpp',
+ include_directories : inc,
+- dependencies: [libzim_dep, icu_dep, thread_dep, docopt_dep],
++ dependencies: zimcheck_deps,
+ install: true)
+-
+-
diff --git a/archivers/zim-tools/pkg-descr b/archivers/zim-tools/pkg-descr
new file mode 100644
index 000000000000..212253ff31d1
--- /dev/null
+++ b/archivers/zim-tools/pkg-descr
@@ -0,0 +1,14 @@
+Various command line tools for handling ZIM files (see devel/libzim).
+
+Notable tools are:
+- 'zimcheck' verifies that a given ZIM file is not corrupted. It provides many
+ features to secure that ZIM entries are proper and properly linked.
+- 'zimdump' inspects or dumps (part of) a ZIM file.
+- 'zimsplit' splits smartly a ZIM file in smaller chunks.
+- 'zimwriterfs' creates ZIM files from a locally-stored directory containing
+ "self-sufficient" HTML content (with pictures, javascript and stylesheets).
+ The result will contain all the files of the local directory compressed and
+ merged in the ZIM file. The generated file can be opened with a ZIM reader;
+ Kiwix is one example, but there are others.
+
+A few other tools are provided as well.
diff --git a/archivers/zim-tools/pkg-plist b/archivers/zim-tools/pkg-plist
new file mode 100644
index 000000000000..72bed9935d5e
--- /dev/null
+++ b/archivers/zim-tools/pkg-plist
@@ -0,0 +1,9 @@
+bin/zimbench
+bin/zimcheck
+bin/zimdiff
+bin/zimdump
+bin/zimpatch
+bin/zimrecreate
+bin/zimsearch
+bin/zimsplit
+bin/zimwriterfs