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 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: <