git: 11605adf4600 - main - security/putty: Pick right Kerberos version

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sun, 18 Sep 2022 12:08:43 UTC
The branch main has been updated by mandree:

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

commit 11605adf4600c1f01617bd98f38a1b30a1ac99fc
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-09-18 12:06:57 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-09-18 12:08:42 +0000

    security/putty: Pick right Kerberos version
    
    Make sure that putty only compiles and links against the configured
    static GSSAPI version, especially against base even if krb5 or heimdal
    are installed.
    
    To that end, hand down the right krb5-config executable,
    and punch out pkg-config from the shipped unix.cmake.
---
 security/putty/Makefile | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/security/putty/Makefile b/security/putty/Makefile
index d6c0e6b3cd44..5824fb9cb04f 100644
--- a/security/putty/Makefile
+++ b/security/putty/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	putty
 DISTVERSION=	0.78~pre20220916.e1b73f0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	security
 #MASTER_SITES=	http://the.earth.li/~sgtatham/putty/${PORTVERSION}/ \
 #		ftp://ftp.chiark.greenend.org.uk/users/sgtatham/putty-latest/
@@ -84,13 +84,13 @@ CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_X11:BOOL=TRUE
 
 .if ${PORT_OPTIONS:MGSSAPI_BASE} # Heimdal-like in base system
 USES+=		gssapi:base,flags
-CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC -DKRB5_CONFIG:PATH=${KRB5CONFIG}
 .elif ${PORT_OPTIONS:MGSSAPI_HEIMDAL}
 USES+=		gssapi:heimdal,flags
-CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC -DKRB5_CONFIG:PATH=${KRB5CONFIG}
 .elif ${PORT_OPTIONS:MGSSAPI_MIT}
 USES+=		gssapi:mit,flags
-CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC -DKRB5_CONFIG:PATH=${KRB5CONFIG}
 .elif ${PORT_OPTIONS:MGSSAPI_DYNAMIC}
 BROKEN=		GSSAPI_DYNAMIC does not work as of putty 0.78~pre20220916.e1b73f0
 CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=DYNAMIC
@@ -106,6 +106,10 @@ post-patch:
 	${REINPLACE_CMD} '/FindGit/d' \
 		${WRKSRC}/cmake/setup.cmake \
 		${WRKSRC}/doc/CMakeLists.txt
+	# nuke pkg-config detection of GSSAPI/Kerberos libs,
+	# it interferes with FreeBSD's krb5-config approach
+	${REINPLACE_CMD} '/pkg_check_modules(KRB5 krb5-gssapi)/d' \
+		${WRKSRC}/cmake/platforms/unix.cmake
 
 post-install:
 .if ${PORT_OPTIONS:MGTK3}