git: 36bded72682c - main - dns/knot-resolver6: Add new port
Date: Wed, 24 Dec 2025 06:00:23 UTC
The branch main has been updated by meta:
URL: https://cgit.FreeBSD.org/ports/commit/?id=36bded72682c1b86da9c74c170c3cd0725ce4cf5
commit 36bded72682c1b86da9c74c170c3cd0725ce4cf5
Author: Koichiro Iwao <meta@FreeBSD.org>
AuthorDate: 2025-12-24 05:58:38 +0000
Commit: Koichiro Iwao <meta@FreeBSD.org>
CommitDate: 2025-12-24 05:59:42 +0000
dns/knot-resolver6: Add new port
This port is meant to replace dns/knot-resolver in the future, and
intends to allow a seamless migration to it's users.
PR: 291892
---
dns/knot-resolver6/Makefile | 118 +++++++++++++++++++++++++
dns/knot-resolver6/distinfo | 3 +
dns/knot-resolver6/files/krescachegc.in | 75 ++++++++++++++++
dns/knot-resolver6/files/kresd.in | 78 ++++++++++++++++
dns/knot-resolver6/files/patch-etc_meson.build | 14 +++
dns/knot-resolver6/files/patch-meson.build | 11 +++
dns/knot-resolver6/files/pkg-message.in | 13 +++
dns/knot-resolver6/pkg-descr | 8 ++
dns/knot-resolver6/pkg-plist | 107 ++++++++++++++++++++++
9 files changed, 427 insertions(+)
diff --git a/dns/knot-resolver6/Makefile b/dns/knot-resolver6/Makefile
new file mode 100644
index 000000000000..a319a547ea9a
--- /dev/null
+++ b/dns/knot-resolver6/Makefile
@@ -0,0 +1,118 @@
+PORTNAME= knot-resolver
+DISTVERSION= 6.0.17
+CATEGORIES= dns
+MASTER_SITES= https://knot-resolver.nic.cz/release/ \
+ https://dns.company/downloads/knot-resolver/
+PKGNAMESUFFIX?= 6
+
+MAINTAINER= freebsd@dns.company
+COMMENT= Caching full resolver implementation
+WWW= https://www.knot-resolver.cz/
+
+LICENSE= GPLv3+
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+BUILD_DEPENDS= bash:shells/bash \
+ flake8:devel/py-flake8@${PY_FLAVOR} \
+ lua51-cqueues>=20200726_1:devel/lua-cqueues@lua51 \
+ luacheck:devel/lua-luacheck
+LIB_DEPENDS= libdnssec.so:dns/knot3 \
+ libgnutls.so:security/gnutls \
+ libknot.so:dns/knot3 \
+ liblmdb.so:databases/lmdb \
+ libnghttp2.so:www/libnghttp2 \
+ libuv.so:devel/libuv \
+ libzscanner.so:dns/knot3
+RUN_DEPENDS= lua51-cqueues>=20200726_1:devel/lua-cqueues@lua51
+
+USES= cmake:indirect compiler:c11 luajit meson ncurses ninja \
+ pkgconfig python:build tar:xz
+USE_CXXSTD= c++11
+USE_RC_SUBR= krescachegc kresd
+
+CMAKE_ARGS+= -DCLANG_TIDY=${LOCALBASE}/bin/clang-tidy${COMPILER_VERSION:C/.$//} \
+ -DRUN_CLANG_TIDY=${LOCALBASE}/llvm${COMPILER_VERSION:C/.$//}/bin/run-clang-tidy
+
+MESON_ARGS= --buildtype=release \
+ --default-library=static \
+ --libdir=${PREFIX}/lib \
+ --pkg-config-path=${PREFIX}/libdata/pkgconfig \
+ --prefix=${LOCALBASE} \
+ -Dgroup=${GROUPS} \
+ -Dinstall_kresd_conf=enabled \
+ -Dkeyfile_default=${ETCDIR}/root.keys \
+ -Dmalloc=auto \
+ -Droot_hints=${ETCDIR}/root.hints \
+ -Duser=${USERS} \
+ -Dutils=enabled
+
+LDFLAGS+= -L${LOCALBASE}/lib
+
+CONFLICTS= knot-resolver-[0-5].*
+
+SUB_FILES= pkg-message
+
+KRESD_USER= kresd
+KRESD_GROUP= kresd
+KRESD_RUNDIR= /var/run/kresd
+
+SUB_LIST= GROUPS=${GROUPS} \
+ RUNDIR=${RUNDIR} \
+ USERS=${USERS}
+
+USERS= ${KRESD_USER}
+GROUPS= ${KRESD_GROUP}
+RUNDIR= ${KRESD_RUNDIR}
+
+PLIST_SUB= GROUPS=${GROUPS} \
+ RUNDIR=${RUNDIR} \
+ USERS=${USERS}
+
+PORTDOCS= AUTHORS COPYING CodingStyle NEWS README.md
+PORTEXAMPLES= config.cluster config.docker config.internal config.isp \
+ config.personal config.privacy config.splitview
+
+OPTIONS_DEFINE= DOCS EXAMPLES DNSTAP TESTUNIT
+
+DNSTAP_DESC= dnstap support
+TESTUNIT_DESC= Build unit tests
+
+DNSTAP_LIB_DEPENDS= libfstrm.so:devel/fstrm \
+ libprotobuf-c.so:devel/protobuf-c \
+ libprotobuf.so:devel/protobuf
+DNSTAP_MESON_ON= -Ddnstap=enabled
+DNSTAP_MESON_OFF= -Ddnstap=disabled
+DNSTAP_PLIST_FILES= lib/knot-resolver/kres_modules/dnstap.so
+
+TESTUNIT_BUILD_DEPENDS= cmocka>=1.1.1:sysutils/cmocka
+TESTUNIT_MESON_ON= -Dunit_tests=enabled
+TESTUNIT_MESON_OFF= -Dunit_tests=disabled
+
+STRIP_TARGETS= sbin/kres-cache-gc \
+ sbin/kresc \
+ sbin/kresd \
+ lib/knot-resolver/ahocorasick.so \
+ lib/knot-resolver/debug_opensslkeylog.so \
+ lib/knot-resolver/kres_modules/bogus_log.so \
+ lib/knot-resolver/kres_modules/dnstap.so \
+ lib/knot-resolver/kres_modules/edns_keepalive.so \
+ lib/knot-resolver/kres_modules/extended_error.so \
+ lib/knot-resolver/kres_modules/hints.so \
+ lib/knot-resolver/kres_modules/nsid.so \
+ lib/knot-resolver/kres_modules/refuse_nord.so \
+ lib/knot-resolver/kres_modules/stats.so
+
+pre-install:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${MKDIR} ${STAGEDIR}${RUNDIR}
+
+post-install:
+ ${MV} ${STAGEDIR}${ETCDIR}/kresd.conf ${STAGEDIR}${ETCDIR}/kresd.conf.sample
+ ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/
+.for STRIP_TGT in ${STRIP_TARGETS}
+ if [ -f ${STAGEDIR}${PREFIX}/${STRIP_TGT} ]; then \
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/${STRIP_TGT}; \
+ fi
+.endfor
+
+.include <bsd.port.mk>
diff --git a/dns/knot-resolver6/distinfo b/dns/knot-resolver6/distinfo
new file mode 100644
index 000000000000..4a2301a2c432
--- /dev/null
+++ b/dns/knot-resolver6/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1765271763
+SHA256 (knot-resolver-6.0.17.tar.xz) = 13d4496ef87aeb2fbd3b0057e2211d4585205241e509a0cd4341dbe5e8cb5c1c
+SIZE (knot-resolver-6.0.17.tar.xz) = 2157140
diff --git a/dns/knot-resolver6/files/krescachegc.in b/dns/knot-resolver6/files/krescachegc.in
new file mode 100644
index 000000000000..8b04fc0686e4
--- /dev/null
+++ b/dns/knot-resolver6/files/krescachegc.in
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# PROVIDE: krescachegc
+# REQUIRE: SERVERS cleanvar
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable knot-resolver:
+#
+# krescachegc_enable="YES": Set to YES to enable krescachegc.
+# Set to NO by default.
+# krescachegc_millis="1000": Set to garbage collect interval in milliseconds
+# Set to 1000 by default.
+#
+
+. /etc/rc.subr
+
+name=krescachegc
+rcvar=krescachegc_enable
+
+load_rc_config ${name}
+load_rc_config_var kresd rundir
+load_rc_config_var kresd user
+
+: ${krescachegc_enable:="NO"}
+: ${krescachegc_svcj_options:="net_basic"}
+: ${krescachegc_millis:="1000"}
+: ${kresd_rundir:="/var/run/kresd"}
+: ${kresd_user:="%%USERS%%"}
+
+procname="%%PREFIX%%/sbin/kres-cache-gc"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+status_cmd="${name}_status"
+
+command=/usr/sbin/daemon
+command_args="-c -f -r -S -u ${kresd_user} -T ${name} -- ${procname} -c ${kresd_rundir} -d ${krescachegc_millis}"
+
+krescachegc_start() {
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "${name} already seems to be running."
+ else
+ echo "starting ${name}..." && \
+ ${command} ${command_args}
+ echo -e "\e[1A\e[K${name} started."
+ fi
+ }
+
+krescachegc_status() {
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "${name} is running:"
+ echo
+ /bin/ps -p $(/bin/pgrep -f ${procname})
+ else
+ echo "${name} is not running"
+ fi
+ return ${status}
+ }
+
+krescachegc_stop() {
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "stopping ${name}..." && \
+ /bin/pkill -TERM -f ${procname}
+ echo -e "\e[1A\e[K${name} stopped."
+
+ else
+ echo "${name} is not running"
+ fi
+ return ${status}
+ }
+
+run_rc_command "$1"
diff --git a/dns/knot-resolver6/files/kresd.in b/dns/knot-resolver6/files/kresd.in
new file mode 100644
index 000000000000..c322d5e85470
--- /dev/null
+++ b/dns/knot-resolver6/files/kresd.in
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+# PROVIDE: kresd
+# REQUIRE: NETWORKING
+# BEFORE: SERVERS
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable knot-resolver:
+#
+# kresd_enable="YES": Set to YES to enable kresd.
+# Set to NO by default.
+# kresd_config="": Set to %%ETCDIR%%/kresd.conf
+# by default.
+#
+
+. /etc/rc.subr
+
+name=kresd
+rcvar=kresd_enable
+
+load_rc_config ${name}
+
+: ${kresd_enable:="NO"}
+: ${kresd_svcj_options:="net_basic"}
+: ${kresd_config:="%%ETCDIR%%/${name}.conf"}
+: ${kresd_user:="%%USERS%%"}
+: ${kresd_group:="%%GROUPS%%"}
+: ${kresd_rundir:="%%RUNDIR%%"}
+
+procname="%%PREFIX%%/sbin/${name}"
+required_files="${kresd_config}"
+
+start_cmd="${name}_start"
+status_cmd="${name}_status"
+stop_cmd="${name}_stop"
+
+command="/usr/sbin/daemon"
+command_args="-c -f -r -S -T ${name} -- ${procname} -c ${kresd_config} -n -q ${kresd_rundir}"
+
+kresd_start() {
+ if [ ! -d /var/run/${name} ]; then
+ install -d -o ${kresd_user} -g ${kresd_group} -m 700 ${kresd_rundir}
+ fi
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "${name} already seems to be running."
+ else
+ echo "starting ${name}..." && \
+ ${command} ${command_args}
+ echo -e "\e[1A\e[K${name} started."
+ fi
+ }
+
+kresd_status() {
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "${name} is running:"
+ echo
+ /bin/ps -p $(/bin/pgrep -f ${procname})
+ else
+ echo "${name} is not running"
+ fi
+ return ${status}
+ }
+
+kresd_stop() {
+ /bin/pgrep -f ${procname} > /dev/null && status="$?" || status="$?"
+ if [ "${status}" -eq 0 ]; then
+ echo "stopping ${name}..." && \
+ /bin/pkill -TERM -f ${procname}
+ echo -e "\e[1A\e[K${name} stopped."
+ else
+ echo "${name} is not running"
+ fi
+ return ${status}
+ }
+
+run_rc_command "$1"
diff --git a/dns/knot-resolver6/files/patch-etc_meson.build b/dns/knot-resolver6/files/patch-etc_meson.build
new file mode 100644
index 000000000000..f918c3e4f8ab
--- /dev/null
+++ b/dns/knot-resolver6/files/patch-etc_meson.build
@@ -0,0 +1,14 @@
+--- etc/meson.build.orig 2020-07-01 12:27:52 UTC
++++ etc/meson.build
+@@ -7,9 +7,9 @@ if install_root_hints
+ etc_files += 'root.hints'
+ endif
+
+-if managed_ta
++#if managed_ta
+ etc_files += 'icann-ca.pem'
+-endif
++#endif
+
+ if install_root_keys
+ root_keys_path = keyfile_default.split('/')
diff --git a/dns/knot-resolver6/files/patch-meson.build b/dns/knot-resolver6/files/patch-meson.build
new file mode 100644
index 000000000000..fca26b528625
--- /dev/null
+++ b/dns/knot-resolver6/files/patch-meson.build
@@ -0,0 +1,11 @@
+--- meson.build.orig 2021-03-02 13:30:46 UTC
++++ meson.build
+@@ -48,7 +48,7 @@ prefix = get_option('prefix')
+ data_dir = prefix / get_option('datadir') / 'knot-resolver'
+ doc_dir = prefix / get_option('datadir') / 'doc' / 'knot-resolver'
+ info_dir = prefix / get_option('datadir') / 'info'
+-examples_dir = doc_dir / 'examples'
++examples_dir = join_paths(prefix, 'share', 'examples', 'knot-resolver')
+ etc_dir = prefix / get_option('sysconfdir') / 'knot-resolver'
+ lib_dir = prefix / get_option('libdir') / 'knot-resolver'
+ modules_dir = lib_dir / 'kres_modules'
diff --git a/dns/knot-resolver6/files/pkg-message.in b/dns/knot-resolver6/files/pkg-message.in
new file mode 100644
index 000000000000..57a03bdd6e96
--- /dev/null
+++ b/dns/knot-resolver6/files/pkg-message.in
@@ -0,0 +1,13 @@
+[
+{ type: install
+ message: <<EOM
+
+ Please consult the documentation:
+ - man kresd
+ - https://knot-resolver.readthedocs.io/
+
+ If upgrading:
+ - https://knot-resolver.readthedocs.io/en/latest/upgrading.html
+EOM
+}
+]
diff --git a/dns/knot-resolver6/pkg-descr b/dns/knot-resolver6/pkg-descr
new file mode 100644
index 000000000000..a9e66597ab92
--- /dev/null
+++ b/dns/knot-resolver6/pkg-descr
@@ -0,0 +1,8 @@
+Knot Resolver is a caching DNS resolver scalable from huge resolver
+farms down to home network routers.
+Knot Resolver is a modern resolver implementation designed for
+scalability, resiliency, and flexibility. Its design is
+different from other resolvers: The core architecture is tiny and
+efficient, and most of the rich features are implemented as
+optional modules, which limits attack surface and improves
+performance.
diff --git a/dns/knot-resolver6/pkg-plist b/dns/knot-resolver6/pkg-plist
new file mode 100644
index 000000000000..36f9a747af8d
--- /dev/null
+++ b/dns/knot-resolver6/pkg-plist
@@ -0,0 +1,107 @@
+@dir(%%USERS%%,%%GROUPS%%,0755) %%ETCDIR%%
+@dir(%%USERS%%,%%GROUPS%%,0700) %%RUNDIR%%
+@sample %%ETCDIR%%/kresd.conf.sample
+%%ETCDIR%%/root.hints
+%%ETCDIR%%/root.keys
+%%ETCDIR%%/icann-ca.pem
+include/libkres/api.h
+include/libkres/array.h
+include/libkres/cdb_api.h
+include/libkres/cdb_lmdb.h
+include/libkres/defines.h
+include/libkres/dnssec.h
+include/libkres/impl.h
+include/libkres/iterate.h
+include/libkres/kru.h
+include/libkres/layer.h
+include/libkres/log.h
+include/libkres/lru.h
+include/libkres/mmapped.h
+include/libkres/module.h
+include/libkres/nsec.h
+include/libkres/nsec3.h
+include/libkres/pack.h
+include/libkres/proto.h
+include/libkres/queue.h
+include/libkres/resolve-impl.h
+include/libkres/resolve.h
+include/libkres/rplan.h
+include/libkres/selection.h
+include/libkres/selection_forward.h
+include/libkres/selection_iter.h
+include/libkres/signature.h
+include/libkres/ta.h
+include/libkres/top.h
+include/libkres/trie.h
+include/libkres/utils.h
+include/libkres/zonecut.h
+lib/knot-resolver/ahocorasick.so
+lib/knot-resolver/debug_opensslkeylog.so
+lib/knot-resolver/distro-preconfig.lua
+lib/knot-resolver/kluautil.lua
+lib/knot-resolver/kres-gen.lua
+lib/knot-resolver/kres.lua
+lib/knot-resolver/kres_modules/bogus_log.so
+lib/knot-resolver/kres_modules/daf.lua
+lib/knot-resolver/kres_modules/daf/daf.js
+lib/knot-resolver/kres_modules/detect_time_jump.lua
+lib/knot-resolver/kres_modules/detect_time_skew.lua
+lib/knot-resolver/kres_modules/dns64.lua
+lib/knot-resolver/kres_modules/edns_keepalive.so
+lib/knot-resolver/kres_modules/etcd.lua
+lib/knot-resolver/kres_modules/experimental_dot_auth.lua
+lib/knot-resolver/kres_modules/extended_error.so
+lib/knot-resolver/kres_modules/fallback.lua
+lib/knot-resolver/kres_modules/graphite.lua
+lib/knot-resolver/kres_modules/hints.so
+lib/knot-resolver/kres_modules/http.lua
+lib/knot-resolver/kres_modules/http/bootstrap-theme.min.css
+lib/knot-resolver/kres_modules/http/bootstrap.min.css
+lib/knot-resolver/kres_modules/http/bootstrap.min.js
+lib/knot-resolver/kres_modules/http/d3.js
+lib/knot-resolver/kres_modules/http/datamaps.world.min.js
+lib/knot-resolver/kres_modules/http/dygraph.min.js
+lib/knot-resolver/kres_modules/http/epoch.css
+lib/knot-resolver/kres_modules/http/epoch.js
+lib/knot-resolver/kres_modules/http/favicon.ico
+lib/knot-resolver/kres_modules/http/glyphicons-halflings-regular.woff2
+lib/knot-resolver/kres_modules/http/jquery.js
+lib/knot-resolver/kres_modules/http/kresd.css
+lib/knot-resolver/kres_modules/http/kresd.js
+lib/knot-resolver/kres_modules/http/main.tpl
+lib/knot-resolver/kres_modules/http/selectize.bootstrap3.css
+lib/knot-resolver/kres_modules/http/selectize.min.js
+lib/knot-resolver/kres_modules/http/topojson.js
+lib/knot-resolver/kres_modules/http_doh.lua
+lib/knot-resolver/kres_modules/http_tls_cert.lua
+lib/knot-resolver/kres_modules/http_trace.lua
+lib/knot-resolver/kres_modules/nsid.so
+lib/knot-resolver/kres_modules/policy.lua
+lib/knot-resolver/kres_modules/predict.lua
+lib/knot-resolver/kres_modules/prefetch.lua
+lib/knot-resolver/kres_modules/prefill.lua
+lib/knot-resolver/kres_modules/priming.lua
+lib/knot-resolver/kres_modules/prometheus.lua
+lib/knot-resolver/kres_modules/rebinding.lua
+lib/knot-resolver/kres_modules/refuse_nord.so
+lib/knot-resolver/kres_modules/renumber.lua
+lib/knot-resolver/kres_modules/serve_stale.lua
+lib/knot-resolver/kres_modules/stats.so
+lib/knot-resolver/kres_modules/ta_sentinel.lua
+lib/knot-resolver/kres_modules/ta_signal_query.lua
+lib/knot-resolver/kres_modules/ta_update.lua
+lib/knot-resolver/kres_modules/view.lua
+lib/knot-resolver/kres_modules/watchdog.lua
+lib/knot-resolver/kres_modules/workarounds.lua
+lib/knot-resolver/krprint.lua
+lib/knot-resolver/postconfig.lua
+lib/knot-resolver/sandbox.lua
+lib/knot-resolver/trust_anchors.lua
+lib/knot-resolver/zonefile.lua
+lib/libkres.a
+libdata/pkgconfig/libkres.pc
+sbin/kres-cache-gc
+sbin/kresd
+share/bash-completion/completions/kresctl
+share/man/man8/kresctl.8.gz
+share/man/man8/kresd.8.gz