commit:     3a80b902ea015f71d6509b891487a48f70570c1a
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Fri Sep 19 10:52:40 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 20 09:15:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a80b902

net-dns/redis-knot: new package, add 3.5.0

add a standalone package for the module loaded by a Redis instance.

Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/43849
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-dns/redis-knot/Manifest                        |  2 +
 .../files/redis-knot-3.5.0-full_redis_opt.patch    | 62 ++++++++++++++++++
 .../files/redis-knot-3.5.0-opt_gnutls.patch        | 65 +++++++++++++++++++
 net-dns/redis-knot/metadata.xml                    | 15 +++++
 net-dns/redis-knot/redis-knot-3.5.0.ebuild         | 73 ++++++++++++++++++++++
 5 files changed, 217 insertions(+)

diff --git a/net-dns/redis-knot/Manifest b/net-dns/redis-knot/Manifest
new file mode 100644
index 000000000000..b4fac8b5a288
--- /dev/null
+++ b/net-dns/redis-knot/Manifest
@@ -0,0 +1,2 @@
+DIST knot-3.5.0.tar.xz 1716348 BLAKE2B 
681de5b8947de9d104e949ac99f15cacea7be36f3c1a03c0328aa2894222c920b37bc1123afd1705fb2430def912287cfe0c760e9e4862d430477a7da4fdf314
 SHA512 
740c8f2d92921e68de3e2e62b7c714bad7ca41884e59236df02e5935889cc4f2102d8693dda2b700e1bfafda71d8760ec4337cc80d42c493d37eef5d0516d1ad
+DIST knot-3.5.0.tar.xz.asc 833 BLAKE2B 
e183ed714215df6e18bdfe839a085e7be5a7a411097a8de6632eed3330a2d4f031bbbdac37345d9ed97f9eefba61dcb7996d6a7eeef6d5dc4260007cd4251903
 SHA512 
44675f89bcb6186bf96f8297ffc898bbb08b7a33470038797abee5b3eadc8e20c321e2bebb43ac7b2cb560beccbbf4dca5446b0964de89670cf63e0c7c910aff

diff --git a/net-dns/redis-knot/files/redis-knot-3.5.0-full_redis_opt.patch 
b/net-dns/redis-knot/files/redis-knot-3.5.0-full_redis_opt.patch
new file mode 100644
index 000000000000..008fd4f1bca3
--- /dev/null
+++ b/net-dns/redis-knot/files/redis-knot-3.5.0-full_redis_opt.patch
@@ -0,0 +1,62 @@
+PR merged
+https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1808.patch
+From bd5df719f331c5aa78fbd1ca1dadfe6dd727b94d Mon Sep 17 00:00:00 2001
+From: Nicolas PARLANT <[email protected]>
+Date: Fri, 19 Sep 2025 10:36:55 +0200
+Subject: [PATCH] Make redis fully optional
+
+Add options :
+*client (only) for a knot package
+*module (only) for a redis-knot package
+--- a/configure.ac
++++ b/configure.ac
+@@ -261,21 +261,23 @@ AS_IF([test "$enable_reuseport" = yes],[
+ 
+ # Redis zone backend support
+ AC_ARG_ENABLE([redis],
+-   AS_HELP_STRING([--enable-redis=auto|yes|no], [enable Redis support 
[default=auto]]),
++   AS_HELP_STRING([--enable-redis=auto|yes|client|module|no], [enable Redis 
support [default=auto]]),
+    [], [enable_redis=auto])
+ 
+ PKG_CHECK_MODULES([hiredis], [hiredis], [have_hiredis=yes], [have_hiredis=no])
+ 
+ AS_CASE([$enable_redis],
+-   [auto], [AS_IF([test "$have_hiredis" = "yes"], [enable_redis=yes], 
[enable_redis=no])],
+-   [yes],  [AS_IF([test "$have_hiredis" = "yes"], [enable_redis=yes], 
[AC_MSG_ERROR([libhiredis not available])])],
++   [auto],   [AS_IF([test "$have_hiredis" = "yes"], [enable_redis=yes], 
[enable_redis=no])],
++   [yes],    [AS_IF([test "$have_hiredis" = "yes"], [enable_redis=yes], 
[AC_MSG_ERROR([libhiredis not available])])],
++   [client], [AS_IF([test "$have_hiredis" = "yes"], [enable_redis=client], 
[AC_MSG_ERROR([libhiredis not available])])],
++   [module], [AS_IF([test "$enable_shared" = "yes"], [enable_redis=module], 
[AC_MSG_ERROR([link mode has to be 'shared'])])],
+    [no], [],
+    [*], [AC_MSG_ERROR([Invalid value of --enable-redis.])]
+ )
+ AM_CONDITIONAL([ENABLE_REDIS], [test "$enable_redis" != "no"])
+-AM_CONDITIONAL([ENABLE_REDIS_MODULE], [test "$enable_redis" != "no" && test 
"$enable_shared" = "yes"])
++AM_CONDITIONAL([ENABLE_REDIS_MODULE], [test "$enable_redis" != "no" && test 
"$enable_redis" != "client" && test "$enable_shared" = "yes"])
+ 
+-AS_IF([test "$enable_redis" = yes],[
++AS_IF([test "$enable_redis" = yes -o "$enable_redis" = client],[
+    AC_DEFINE([ENABLE_REDIS], [1], [Enable Redis support.])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <hiredis/hiredis.h>
+                                      #if (HIREDIS_MAJOR < 1) || 
(HIREDIS_MAJOR == 1 && HIREDIS_MINOR < 1)
+@@ -283,7 +285,7 @@ AS_IF([test "$enable_redis" = yes],[
+                                      #endif]])],
+                   [AC_DEFINE([ENABLE_REDIS_TLS], [1], [Enable Redis TLS 
support.])],
+                   [enable_redis="yes (no TLS)"])
+-   AS_IF([test "$enable_shared" = yes],[
++   AS_IF([test "$enable_redis" = yes && test "$enable_shared" = yes],[
+       enable_redis="${enable_redis} module"
+    ])
+ ])
+@@ -515,7 +517,7 @@ PKG_CHECK_MODULES([lmdb], [lmdb >= 0.9.15], [], [
+   CPPFLAGS="$save_CPPFLAGS"
+   LIBS="$save_LIBS"
+ 
+-  AS_IF([test "$have_lmdb" = "no"], [
++  AS_IF([test "$have_lmdb" = "no" && test "$enable_redis" != "module"], [
+     AC_MSG_ERROR([lmdb library not found])
+   ])
+ ])
+-- 
+GitLab
+

diff --git a/net-dns/redis-knot/files/redis-knot-3.5.0-opt_gnutls.patch 
b/net-dns/redis-knot/files/redis-knot-3.5.0-opt_gnutls.patch
new file mode 100644
index 000000000000..7163f39faf1c
--- /dev/null
+++ b/net-dns/redis-knot/files/redis-knot-3.5.0-opt_gnutls.patch
@@ -0,0 +1,65 @@
+PR pending
+https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1809.patch
+GnuTLS is not needed to build the Redis module alone
+--- a/src/config.h.in
++++ b/src/config.h.in
+@@ -96,6 +96,9 @@
+ /* gnutls_early_cipher_get available */
+ #undef HAVE_GNUTLS_QUIC
+ 
++/* Define to 1 if GnuTLS is not needed, ie. to build the Redis module alone */
++#undef DISABLE_GNUTLS
++
+ /* Define to 1 if you have the 'initgroups' function. */
+ #undef HAVE_INITGROUPS
+ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -170,7 +170,11 @@ PKG_CHECK_MODULES([gnutls], [gnutls >= 3.6.10], [
+ 
+     CFLAGS=$save_CFLAGS
+     LIBS=$save_LIBS
+-])
++],
++    AS_IF([test "$enable_redis" != "module"],
++        [AC_MSG_ERROR([GnuTLS library not found])],
++        [AC_DEFINE([DISABLE_GNUTLS], [1], [Disable GnuTLS support.])])
++)
+ AM_CONDITIONAL([ENABLE_PKCS11], [test "$enable_pkcs11" = "yes"])
+ 
+ AC_ARG_ENABLE([recvmmsg],
+--- a/src/libdnssec/key/keytag.c
++++ b/src/libdnssec/key/keytag.c
+@@ -10,7 +10,9 @@
+ #include "libdnssec/binary.h"
+ #include "libdnssec/error.h"
+ #include "libdnssec/key/dnskey.h"
++#ifndef DISABLE_GNUTLS
+ #include "libdnssec/shared/shared.h"
++#endif
+ 
+ /*!
+  * Compute keytag for RSA/MD5 key.
+--- a/src/libdnssec/key/dnskey.h
++++ b/src/libdnssec/key/dnskey.h
+@@ -5,7 +5,9 @@
+ 
+ #pragma once
+ 
++#ifndef DISABLE_GNUTLS
+ #include <gnutls/abstract.h>
++#endif
+ 
+ #include "libdnssec/binary.h"
+ #include "libdnssec/error.h"
+@@ -28,8 +30,10 @@ enum dnskey_rdata_offsets {
+ int dnskey_rdata_set_pubkey(dnssec_binary_t *rdata,
+                           const dnssec_binary_t *pubkey);
+ 
++#ifndef DISABLE_GNUTLS
+ /*!
+  * Create a GnuTLS public key from DNSKEY RDATA.
+  */
+ int dnskey_rdata_to_crypto_key(const dnssec_binary_t *rdata,
+                              gnutls_pubkey_t *key_ptr);
++#endif

diff --git a/net-dns/redis-knot/metadata.xml b/net-dns/redis-knot/metadata.xml
new file mode 100644
index 000000000000..f5f8d5dba753
--- /dev/null
+++ b/net-dns/redis-knot/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Nicolas PARLANT</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">CZ-NIC/knot</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/net-dns/redis-knot/redis-knot-3.5.0.ebuild 
b/net-dns/redis-knot/redis-knot-3.5.0.ebuild
new file mode 100644
index 000000000000..7e38f54a09dd
--- /dev/null
+++ b/net-dns/redis-knot/redis-knot-3.5.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools edo toolchain-funcs verify-sig
+
+MY_PN="knot"
+MY_P="${MY_PN}-${PV}"
+DESCRIPTION="Redis module for Knot DNS"
+HOMEPAGE="https://www.knot-dns.cz/ https://gitlab.nic.cz/knot/knot-dns";
+SRC_URI="
+       https://knot-dns.nic.cz/release/${MY_P}.tar.xz
+       verify-sig? ( https://knot-dns.nic.cz/release/${MY_P}.tar.xz.asc )
+"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
+
+# no test, it requires a Redis instance and RLTest (not packaged)
+BDEPEND="
+       dev-build/libtool
+       verify-sig? ( sec-keys/openpgp-keys-knot )
+"
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/${MY_PN}.asc
+
+PATCHES=(
+       # PR merged 
https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1808.patch
+       "${FILESDIR}"/${PN}-3.5.0-full_redis_opt.patch
+       # https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1809.patch
+       "${FILESDIR}"/${PN}-3.5.0-opt_gnutls.patch
+)
+
+# Used to check cpuset_t in sched.h with NetBSD.
+# False positive because linux have sched.h too but with cpu_set_t
+QA_CONFIG_IMPL_DECL_SKIP=( cpuset_create cpuset_destroy )
+
+# because configure.ac is patched
+src_prepare() {
+       default
+       eautoconf
+}
+
+src_configure() {
+       econf --disable-daemon --disable-modules --disable-utilities 
--enable-redis=module
+}
+
+src_compile() {
+       pushd src/redis || die
+
+       # mimic src/redis/Makefile.am
+       edo ${LIBTOOL:=libtool} --tag=CC --mode=compile $(tc-getCC) \
+               ${CFLAGS} -fvisibility=hidden \
+               -I../../src -include ../../src/config.h \
+               -c -o knot_la-knot.lo knot.c
+
+       edo ${LIBTOOL:=libtool} --tag=CC --mode=link $(tc-getCC) \
+               -module -shared -avoid-version \
+               ${LDFLAGS} \
+               -o knot.la \
+               -rpath "${EPREFIX}"/usr/$(get_libdir)/knot/redis \
+               knot_la-knot.lo
+
+       popd || die
+}
+
+src_install() {
+       exeinto /usr/$(get_libdir)/knot/redis
+       doexe src/redis/.libs/knot.so
+}

Reply via email to