git: fb4eb1df56aa - 2024Q1 - dns/powerdns-recursor: Fix build

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Tue, 20 Feb 2024 17:00:14 UTC
The branch 2024Q1 has been updated by fernape:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fb4eb1df56aa7fcb9e55205a303ac1bfe94de80a

commit fb4eb1df56aa7fcb9e55205a303ac1bfe94de80a
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2024-02-20 16:59:05 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2024-02-20 16:59:05 +0000

    dns/powerdns-recursor: Fix build
    
    PR:             277048
    Reported by:    linus.sundqvist@loopia.se
    Fixes:          569307de85501076ff89553a4dc14d58bfda108e
---
 dns/powerdns-recursor/Makefile                     | 21 ++++++++++++---
 dns/powerdns-recursor/Makefile.crates              | 30 ++++++++++++++++++++++
 .../files/patch-m4_pdns__check__libcrypto.m4       |  3 ++-
 dns/powerdns-recursor/files/patch-rec-main.cc      | 18 -------------
 dns/powerdns-recursor/pkg-plist                    |  1 +
 5 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/dns/powerdns-recursor/Makefile b/dns/powerdns-recursor/Makefile
index 2f1f30fd079d..5d58d7937d24 100644
--- a/dns/powerdns-recursor/Makefile
+++ b/dns/powerdns-recursor/Makefile
@@ -1,9 +1,11 @@
 PORTNAME=	recursor
 DISTVERSION=	5.0.2
+PORTREVISION=	1
 CATEGORIES=	dns
 MASTER_SITES=	http://downloads.powerdns.com/releases/
 PKGNAMEPREFIX=	powerdns-
 DISTNAME=	pdns-${PORTNAME}-${DISTVERSION}
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	tremere@cainites.net
 COMMENT=	Advanced DNS recursor
@@ -18,10 +20,11 @@ NOT_FOR_ARCHS=	i386
 NOT_FOR_ARCHS_REASON=	archs with 32-bits time_t are no longer supported by upstream
 
 BUILD_DEPENDS=	${LOCALBASE}/include/boost/shared_ptr.hpp:devel/boost-libs
-LIB_DEPENDS=	libboost_context.so:devel/boost-libs
+LIB_DEPENDS=	libboost_context.so:devel/boost-libs \
+		libcurl.so:ftp/curl
 
-USES=		autoreconf compiler:c++11-lib cpe gmake libtool \
-		localbase:ldflags pkgconfig ssl tar:bzip2
+USES=		autoreconf cargo compiler:c++11-lib cpe gmake libtool \
+		localbase:ldflags pkgconfig python:build ssl tar:bzip2
 
 CPE_VENDOR=	powerdns
 USE_RC_SUBR=	pdns-recursor
@@ -29,10 +32,19 @@ USE_RC_SUBR=	pdns-recursor
 GNU_CONFIGURE=	YES
 CONFIGURE_ARGS=	--sysconfdir=${PREFIX}/etc/pdns \
 		--with-libsodium=no \
+		--with-service-user=pdns \
+		--with-service-group=pdns_recursor \
 		--without-net-snmp \
 		--without-systemd
 
+CARGO_CARGOLOCK=	${WRKSRC}/settings/rust/Cargo.lock
+CARGO_CARGOTOML=	${WRKSRC}/settings/rust/Cargo.toml
+CARGO_BUILD=		no
+CARGO_INSTALL=		no
+CARGO_TEST=		no
+
 SUB_FILES=	pkg-message
+TARGET_ORDER_OVERRIDE=	750:cargo-configure
 
 USERS=		pdns_recursor
 GROUPS=		pdns
@@ -54,6 +66,9 @@ LUAJIT_CONFIGURE_ON=	--with-lua=luajit
 
 LUA_USES=	lua
 
+#pre-configure:
+#	@cd ${WRKSRC}/settings && ${PYTHON_CMD} generate.py
+
 post-install:
 	@${MKDIR} ${STAGEDIR}/var/run/pdns-recursor
 
diff --git a/dns/powerdns-recursor/Makefile.crates b/dns/powerdns-recursor/Makefile.crates
new file mode 100644
index 000000000000..f7f34454f8df
--- /dev/null
+++ b/dns/powerdns-recursor/Makefile.crates
@@ -0,0 +1,30 @@
+CARGO_CRATES=	cc-1.0.84 \
+		codespan-reporting-0.11.1 \
+		cxx-1.0.110 \
+		cxx-build-1.0.110 \
+		cxxbridge-flags-1.0.110 \
+		cxxbridge-macro-1.0.110 \
+		equivalent-1.0.1 \
+		hashbrown-0.14.2 \
+		indexmap-2.1.0 \
+		ipnet-2.9.0 \
+		itoa-1.0.9 \
+		libc-0.2.150 \
+		link-cplusplus-1.0.9 \
+		once_cell-1.18.0 \
+		proc-macro2-1.0.69 \
+		quote-1.0.33 \
+		ryu-1.0.15 \
+		scratch-1.0.7 \
+		serde-1.0.192 \
+		serde_derive-1.0.192 \
+		serde_yaml-0.9.27 \
+		syn-2.0.39 \
+		termcolor-1.4.0 \
+		unicode-ident-1.0.12 \
+		unicode-width-0.1.11 \
+		unsafe-libyaml-0.2.9 \
+		winapi-0.3.9 \
+		winapi-i686-pc-windows-gnu-0.4.0 \
+		winapi-util-0.1.6 \
+		winapi-x86_64-pc-windows-gnu-0.4.0
diff --git a/dns/powerdns-recursor/files/patch-m4_pdns__check__libcrypto.m4 b/dns/powerdns-recursor/files/patch-m4_pdns__check__libcrypto.m4
index 6bd1ed29d7ef..9e16849db50c 100644
--- a/dns/powerdns-recursor/files/patch-m4_pdns__check__libcrypto.m4
+++ b/dns/powerdns-recursor/files/patch-m4_pdns__check__libcrypto.m4
@@ -1,4 +1,4 @@
---- m4/pdns_check_libcrypto.m4.orig	2023-06-01 06:54:16 UTC
+--- m4/pdns_check_libcrypto.m4.orig	2023-09-13 09:07:48 UTC
 +++ m4/pdns_check_libcrypto.m4
 @@ -75,8 +75,10 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [
          for ssldir in $ssldirs; do
@@ -12,3 +12,4 @@
 +                fi
                  LIBCRYPTO_LIBS="-lcrypto"
                  found=true
+                 AC_MSG_RESULT([yes])
diff --git a/dns/powerdns-recursor/files/patch-rec-main.cc b/dns/powerdns-recursor/files/patch-rec-main.cc
deleted file mode 100644
index abec8d2677d4..000000000000
--- a/dns/powerdns-recursor/files/patch-rec-main.cc
+++ /dev/null
@@ -1,18 +0,0 @@
---- rec-main.cc.orig	2023-06-30 06:58:36 UTC
-+++ rec-main.cc
-@@ -2829,13 +2829,13 @@ static void initArgs()
-               SYSTEMD_SETID_MSG
- #endif
-               )
--    = "";
-+    = "pdns";
-   ::arg().set("setuid", "If set, change user id to this uid for more security"
- #ifdef HAVE_SYSTEMD
-               SYSTEMD_SETID_MSG
- #endif
-               )
--    = "";
-+    = "pdns_recursor";
-   ::arg().set("network-timeout", "Wait this number of milliseconds for network i/o") = "1500";
-   ::arg().set("threads", "Launch this number of threads") = "2";
-   ::arg().set("distributor-threads", "Launch this number of distributor threads, distributing queries to other threads") = "0";
diff --git a/dns/powerdns-recursor/pkg-plist b/dns/powerdns-recursor/pkg-plist
index 8a1483f521b5..3a0d8355076d 100644
--- a/dns/powerdns-recursor/pkg-plist
+++ b/dns/powerdns-recursor/pkg-plist
@@ -1,4 +1,5 @@
 @sample etc/pdns/recursor.conf-dist etc/pdns/recursor.conf
+etc/pdns/recursor.yml-dist
 bin/rec_control
 sbin/pdns_recursor
 man/man1/pdns_recursor.1.gz