git: 80d2d91271d9 - main - security/putty: add Git patch to fix X11 inclusion

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Thu, 22 Sep 2022 06:07:10 UTC
The branch main has been updated by mandree:

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

commit 80d2d91271d91dbc2ea0e3199328206c4a983d5f
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-09-19 21:47:18 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-09-22 06:04:28 +0000

    security/putty: add Git patch to fix X11 inclusion
    
    Pull in a fix from upstream's Git to avoid pulling in X11 headers
    in no-GTK builds, so we can remove one more local workaround.
---
 security/putty/Makefile                            |  7 +++--
 ...-to-include-X11-headers-in-non-GTK-builds.patch | 31 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/security/putty/Makefile b/security/putty/Makefile
index 80b4f84f2d28..2e4ae7a5cb5a 100644
--- a/security/putty/Makefile
+++ b/security/putty/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	putty
 PORTVERSION=	0.78~pre20220919
-DISTNAME=	${PORTNAME}-${PORTVERSION}.fda41e1
+DISTVERSIONSUFFIX=	.fda41e1
 PORTREVISION=	0
 CATEGORIES=	security
 #MASTER_SITES=	http://the.earth.li/~sgtatham/putty/${PORTVERSION}/ \
@@ -9,6 +9,7 @@ MASTER_SITES=	https://tartarus.org/~simon/putty-prerel-snapshots/ \
 		LOCAL/mandree/
 EXTRA_PATCHES+=	${FILESDIR}/0001-setpgrp-cmake-check-use-if-not-if-defined.patch
 EXTRA_PATCHES+=	${FILESDIR}/0002-Use-GTK_LDFLAGS-when-testing-for-Pango.patch
+EXTRA_PATCHES+= ${FILESDIR}/0001-Stop-trying-to-include-X11-headers-in-non-GTK-builds.patch
 PATCH_STRIP=	-p1
 
 MAINTAINER=	mandree@FreeBSD.org
@@ -72,9 +73,7 @@ DESKTOP_ENTRIES=	"PuTTY" \
 			"" \
 			false
 .else
-# hack alert: PuTTY, as of 864b4c, masks the definition of NOT_X_WINDOWS
-# under GTK_FOUND; which it defeats. Pass it down explicitly.
-CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=NONE -DNOT_X_WINDOWS:BOOL=TRUE
+CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=NONE
 .endif
 
 .if ${PORT_OPTIONS:MGSSAPI_BASE} # Heimdal-like in base system
diff --git a/security/putty/files/0001-Stop-trying-to-include-X11-headers-in-non-GTK-builds.patch b/security/putty/files/0001-Stop-trying-to-include-X11-headers-in-non-GTK-builds.patch
new file mode 100644
index 000000000000..58ddf65280f4
--- /dev/null
+++ b/security/putty/files/0001-Stop-trying-to-include-X11-headers-in-non-GTK-builds.patch
@@ -0,0 +1,31 @@
+From 9fcfd679b49a015e95f70b3f0380243e0db8b035 Mon Sep 17 00:00:00 2001
+From: Simon Tatham <anakin@pobox.com>
+Date: Mon, 19 Sep 2022 20:21:01 +0100
+Subject: [PATCH] Stop trying to include X11 headers in non-GTK builds.
+
+In commit 732ec31a17a7fea I made the check for libX11 conditional on
+GTK - but I forgot that if we're building without GTK, I should
+_define_ NOT_X_WINDOWS, rather than leaving it undefined. As a result,
+the build would fail on files like unix/utils/x11_ignore_error.c.
+---
+ cmake/platforms/unix.cmake | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/cmake/platforms/unix.cmake b/cmake/platforms/unix.cmake
+index 98474485..4d056d0a 100644
+--- a/cmake/platforms/unix.cmake
++++ b/cmake/platforms/unix.cmake
+@@ -96,6 +96,10 @@ if(GTK_FOUND)
+     endif()
+   endfunction()
+   check_x11()
++else()
++  # If we didn't even have GTK, behave as if X11 is not available.
++  # (There's nothing useful we could do with it even if there was.)
++  set(NOT_X_WINDOWS ON)
+ endif()
+ 
+ include_directories(${CMAKE_SOURCE_DIR}/charset ${GTK_INCLUDE_DIRS} ${X11_INCLUDE_DIR})
+-- 
+2.37.3
+