git: f3d4c381ab17 - main - security/putty: update to 0.77

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Fri, 27 May 2022 23:20:50 UTC
The branch main has been updated by mandree:

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

commit f3d4c381ab172f5266130f329d09f6eb279babfb
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-05-27 23:09:14 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-05-27 23:20:46 +0000

    security/putty: update to 0.77
    
    PuTTY 0.77 changed its build system to cmake, and restructured the
    source code, thus the patches were regenerated and updated.
    
    As a consequence, GSSAPI_BASE no longer works because cmake wants
    pkg-config and hence .pc files.
    
    GSSAPI_HEIMDAL does not compile due to #define (&_foo) xxx.
    Both GSSAPI_BASE and GSSAPI_HEIMDAL were disabled. Assistance solicited.
    
    There is a new experimental GSSAPI_DYNAMIC which permits configuring the
    GSS provider at run-time, which the package maintainer cannot test
    for lack of Kerberized access somewhere. Feedback solicited.
    
    Puttytel was removed upstream, Psusan was added, which is just the inner
    SSH protocol layer. See its man page for details.
    
    GTK2 remnants were removed. GTK is currently inseparable from X11,
    message was sent to upstream maintainer to see if that is intentional.
    
    Manual pages now install into ${PREFIX}/share/man/man1 (previous
    versions of the port installed into ${PREFIX}/man/man1).
    
    Upstream changes: see
    https://www.chiark.greenend.org.uk/~sgtatham/putty/changes.html
    
    No MFH due to intrusive changes and removal of options.
---
 security/putty/Makefile                            | 114 ++++++++++-----------
 security/putty/distinfo                            |   6 +-
 .../files/{patch-sshgssc.c => patch-ssh_gssc.c}    |   4 +-
 security/putty/files/patch-unix_Makefile.gtk       |  61 -----------
 .../{patch-unix_uxnet.c => patch-unix_network.c}   |   4 +-
 .../{patch-unix_uxpgnt.c => patch-unix_pageant.c}  |   6 +-
 security/putty/files/patch-unix_uxpty.c            |  10 --
 7 files changed, 64 insertions(+), 141 deletions(-)

diff --git a/security/putty/Makefile b/security/putty/Makefile
index 01e847854e31..6c45dc6061af 100644
--- a/security/putty/Makefile
+++ b/security/putty/Makefile
@@ -1,70 +1,61 @@
 PORTNAME=	putty
-PORTVERSION=	0.76
+PORTVERSION=	0.77
 CATEGORIES=	security
 MASTER_SITES=	http://the.earth.li/~sgtatham/putty/${PORTVERSION}/ \
 		ftp://ftp.chiark.greenend.org.uk/users/sgtatham/putty-latest/
 
 MAINTAINER=	mandree@FreeBSD.org
-COMMENT=	Secure shell and telnet client
-# test plan: test ALL 4 GSSAPI_* options, ALL 3 GTK options, WITH_DEBUG=yes build.
+COMMENT=	Secure shell and telnet client including xterm emulator
+# test plan: test ALL 4 GSSAPI_* options, GTK3 yes/no, WITH_DEBUG=yes build.
 
 LICENSE=	MIT
 LICENSE_FILE=	${PATCH_WRKSRC}/LICENCE
 
-USES=		cpe gmake pkgconfig
+USES=		cmake cpe perl5 pkgconfig
+USE_PERL5=	build
 
-MAKEFILE=	Makefile.gtk
-MAKE_ARGS+=	"prefix=${PREFIX}"
-
-CONFLICTS_INSTALL?=	pssh putty-gtk2 putty-nogtk
-
-PATCH_WRKSRC=	${WRKDIR}/${DISTNAME}
-WRKSRC=		${WRKDIR}/${DISTNAME}/unix
+CONFLICTS_INSTALL?=	pssh putty-nogtk
 
 PLIST_FILES=	bin/plink \
 		bin/pscp \
 		bin/psftp \
+		bin/psusan \
 		bin/puttygen \
-		man/man1/plink.1.gz \
-		man/man1/pscp.1.gz \
-		man/man1/psftp.1.gz \
-		man/man1/puttygen.1.gz
-
-OPTIONS_DEFAULT=		GSSAPI_BASE GTK3
-OPTIONS_RADIO=			TOOLKIT
-OPTIONS_RADIO_TOOLKIT=		GTK2 GTK3
+		share/man/man1/plink.1.gz \
+		share/man/man1/pscp.1.gz \
+		share/man/man1/psftp.1.gz \
+		share/man/man1/psusan.1.gz \
+		share/man/man1/puttygen.1.gz
+
+OPTIONS_DEFINE=			GTK3
+OPTIONS_DEFAULT=		GSSAPI_NONE GTK3
 OPTIONS_SINGLE=			GSSAPI_SELECT
-OPTIONS_SINGLE_GSSAPI_SELECT=	GSSAPI_BASE GSSAPI_HEIMDAL GSSAPI_MIT \
+OPTIONS_SINGLE_GSSAPI_SELECT=	GSSAPI_MIT \
+				GSSAPI_DYNAMIC \
 				GSSAPI_NONE
+GSSAPI_DYNAMIC_DESC=	EXPERIMENTAL dynamic runtime load of GSS libs
 
 .include <bsd.port.options.mk>
 
-CFLAGS+=	-DBSD_PTYS -DHAVE_FUTIMES -DIPV6 -DOMIT_UTMP
-LDFLAGS+=	-lm -Wl,--as-needed
+LDFLAGS+=	-Wl,--as-needed
 
-.if (${PORT_OPTIONS:MGTK2} || ${PORT_OPTIONS:MGTK3}) && !defined(WITHOUT_X11)
+# XXX FIXME this is simplified on these assumptions:
+# - we only support GTK3 in FreeBSD
+#   (Putty would support EOL GTK2 and GTK1 as well)
+# - Putty 0.77 cannot have X11 without the gdk/gdkx.h header i. e. GTK.
+.if ${PORT_OPTIONS:MGTK3} && !defined(WITHOUT_X11)
 USES+=		xorg
 USE_XORG=	x11
-. if ${PORT_OPTIONS:MGTK3}
 USES+=		gnome
 USE_GNOME=	cairo gdkpixbuf2 gtk30
-MAKE_ARGS+=	GTK_CONFIG="pkg-config gtk+-3.0 x11 --cflags" \
-		PUTTY_WITH_GTK=yes
-. elif ${PORT_OPTIONS:MGTK2}
- USES+=		gnome
-USE_GNOME=	cairo gdkpixbuf2 gtk20
-MAKE_ARGS+=	GTK_CONFIG="pkg-config gtk+-2.0 x11 --cflags" \
-		PUTTY_WITH_GTK=yes
-. endif
+CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=3
 
 PLIST_FILES+=	bin/pageant \
 		bin/pterm \
 		bin/putty \
-		bin/puttytel \
-		man/man1/pageant.1.gz \
-		man/man1/pterm.1.gz \
-		man/man1/putty.1.gz \
-		man/man1/puttytel.1.gz \
+		share/man/man1/pageant.1.gz \
+		share/man/man1/pterm.1.gz \
+		share/man/man1/putty.1.gz \
 		share/pixmaps/putty.ico
 DESKTOP_ENTRIES=	"PuTTY" \
 			"${COMMENT}" \
@@ -73,40 +64,43 @@ DESKTOP_ENTRIES=	"PuTTY" \
 			"" \
 			false
 .else
-MAKE_ARGS+=	GTK_CONFIG=:
+# XXX FIXME HACK ALERT
+# PUTTY_GTK_VERSION=OFF is not a valid choice, but manages to
+# skip all version comparisons for GTK in cmake/gtk.cmake:
+CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=OFF
+# this is standard stuff:
+CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_X11:BOOL=TRUE 
 .endif
 
-.if ${PORT_OPTIONS:MGSSAPI_BASE}
-USES+=		gssapi:base,flags
-MAKE_ARGS+=	KRB5CONFIG=${KRB5CONFIG}
-.elif ${PORT_OPTIONS:MGSSAPI_HEIMDAL}
+.if ${PORT_OPTIONS:MGSSAPI_HEIMDAL}
+# does not compile currently
+BROKEN=		GSSAPI_HEIMDAL does not compile as of putty 0.77
 USES+=		gssapi:heimdal,flags
-MAKE_ARGS+=	KRB5CONFIG=${KRB5CONFIG}
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
 .elif ${PORT_OPTIONS:MGSSAPI_MIT}
 USES+=		gssapi:mit,flags
-MAKE_ARGS+=	KRB5CONFIG=${KRB5CONFIG}
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
+.elif ${PORT_OPTIONS:MGSSAPI_DYNAMIC}
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=DYNAMIC
 .else
-_COMPAT=	-DNO_GSSAPI
-.endif
-
-_COMPAT+=	-DOMIT_UTMP
-
-.if defined(WITH_DEBUG)
-CFLAGS+=	-DDEBUG
-XFLAGS=		-DDEBUG
-_COMPAT+=	-DDEBUG
+# XXX FIXME buglet in putty 0.77: PUTTY_GSSAPI=OFF 
+# does not appear to get NO_GSSAPI into .build/CMakeFiles/cmake.h,
+# so we shove it down explicitly:
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=OFF -DNO_GSSAPI=ON
 .endif
 
-MAKE_ARGS+=	CC="${CC}" \
-		COMPAT="${_COMPAT}" \
-		INSTALL_DATA="${INSTALL_DATA}" \
-		INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
-		XFLAGS="${XFLAGS}"
+post-patch:
+	# we don't want to inherit FreeBSD commits
+	# as PUTTY Git commit revisions,
+	# so pretend we do not have Git:
+	${REINPLACE_CMD} '/FindGit/d' \
+		${WRKSRC}/cmake/setup.cmake \
+		${WRKSRC}/doc/CMakeLists.txt
 
 post-install:
-.if ${PORT_OPTIONS:MGTK2} || ${PORT_OPTIONS:MGTK3}
+.if ${PORT_OPTIONS:MGTK3}
 	@${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
-	${INSTALL_DATA} ${WRKSRC}/../windows/putty.ico \
+	${INSTALL_DATA} ${WRKSRC}/windows/putty.ico \
 		${STAGEDIR}${PREFIX}/share/pixmaps/
 .endif
 
diff --git a/security/putty/distinfo b/security/putty/distinfo
index 7766cc079336..0aa2ce19786d 100644
--- a/security/putty/distinfo
+++ b/security/putty/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1626561798
-SHA256 (putty-0.76.tar.gz) = 547cd97a8daa87ef71037fab0773bceb54a8abccb2f825a49ef8eba5e045713f
-SIZE (putty-0.76.tar.gz) = 2735687
+TIMESTAMP = 1653681200
+SHA256 (putty-0.77.tar.gz) = 419a76f45238fd45f2c76b42438993056e74fa78374f136052aaa843085beae5
+SIZE (putty-0.77.tar.gz) = 2619481
diff --git a/security/putty/files/patch-sshgssc.c b/security/putty/files/patch-ssh_gssc.c
similarity index 88%
rename from security/putty/files/patch-sshgssc.c
rename to security/putty/files/patch-ssh_gssc.c
index 824e547c51ea..91db8b14c57e 100644
--- a/security/putty/files/patch-sshgssc.c
+++ b/security/putty/files/patch-ssh_gssc.c
@@ -1,5 +1,5 @@
---- sshgssc.c.orig	2019-03-16 12:26:36 UTC
-+++ sshgssc.c
+--- ssh/gssc.c.orig	2022-05-24 16:56:27 UTC
++++ ssh/gssc.c
 @@ -75,7 +75,7 @@ static Ssh_gss_stat ssh_gssapi_acquire_cred(struct ssh
          gssctx->maj_stat =
              gss->inquire_cred_by_mech(&gssctx->min_stat, cred,
diff --git a/security/putty/files/patch-unix_Makefile.gtk b/security/putty/files/patch-unix_Makefile.gtk
deleted file mode 100644
index 381b7f6bc899..000000000000
--- a/security/putty/files/patch-unix_Makefile.gtk
+++ /dev/null
@@ -1,61 +0,0 @@
---- unix/Makefile.gtk.orig	2021-05-02 07:21:01 UTC
-+++ unix/Makefile.gtk
-@@ -104,7 +104,7 @@ GTK_CONFIG = sh -c 'pkg-config gtk+-3.0 x11 $$0 2>/dev
- 
- unexport CFLAGS # work around a weird issue with krb5-config
- 
--CFLAGS = -O2 -Wall -std=gnu99 -Wvla -g -I.././ -I../charset/ -I../windows/ \
-+CFLAGS := $(CFLAGS) -Wall -std=gnu11 -Wvla -I.././ -I../charset/ -I../windows/ \
- 		-I../unix/ $(shell $(GTK_CONFIG) --cflags) -D _FILE_OFFSET_BITS=64
- XLDFLAGS = $(LDFLAGS) $(shell $(GTK_CONFIG) --libs)
- ULDFLAGS = $(LDFLAGS)
-@@ -131,9 +131,14 @@ man1dir=$(mandir)/man1
- .SUFFIXES:
- 
- 
-+ifdef PUTTY_WITH_GTK
- all: cgtest fuzzterm osxlaunch pageant plink pscp psftp psocks psusan pterm \
- 		ptermapp putty puttyapp puttygen puttytel testcrypt testsc \
- 		testzlib uppity
-+else
-+all: cgtest fuzzterm osxlaunch plink pscp psftp \
-+		puttygen testcrypt testsc testzlib uppity
-+endif
- 
- cgtest: cgtest.o conf.o console.o ecc.o import.o marshal.o memory.o \
- 		millerrabin.o misc.o mpint.o mpunsafe.o notiming.o pockle.o \
-@@ -1805,10 +1810,12 @@ xpmputty.o: ../unix/xpmputty.c
- 
- install:
- 	mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
--	$(INSTALL_PROGRAM) -m 755 pageant $(DESTDIR)$(bindir)/pageant
- 	$(INSTALL_PROGRAM) -m 755 plink $(DESTDIR)$(bindir)/plink
- 	$(INSTALL_PROGRAM) -m 755 pscp $(DESTDIR)$(bindir)/pscp
- 	$(INSTALL_PROGRAM) -m 755 psftp $(DESTDIR)$(bindir)/psftp
-+	$(INSTALL_PROGRAM) -m 755 puttygen $(DESTDIR)$(bindir)/puttygen
-+ifdef PUTTY_WITH_GTK
-+	$(INSTALL_PROGRAM) -m 755 pageant $(DESTDIR)$(bindir)/pageant
- 	$(INSTALL_PROGRAM) -m 755 pterm $(DESTDIR)$(bindir)/pterm
- 	if test -n "$(UTMP_GROUP)"; then \
- 	  chgrp $(UTMP_GROUP) $(DESTDIR)$(bindir)/pterm && \
-@@ -1818,16 +1825,18 @@ install:
- 	    chmod 4755 $(DESTDIR)$(bindir)/pterm; \
- 	fi
- 	$(INSTALL_PROGRAM) -m 755 putty $(DESTDIR)$(bindir)/putty
--	$(INSTALL_PROGRAM) -m 755 puttygen $(DESTDIR)$(bindir)/puttygen
- 	$(INSTALL_PROGRAM) -m 755 puttytel $(DESTDIR)$(bindir)/puttytel
- 	$(INSTALL_DATA) -m 644 ../doc/pageant.1 $(DESTDIR)$(man1dir)/pageant.1
-+endif
- 	$(INSTALL_DATA) -m 644 ../doc/plink.1 $(DESTDIR)$(man1dir)/plink.1
- 	$(INSTALL_DATA) -m 644 ../doc/pscp.1 $(DESTDIR)$(man1dir)/pscp.1
- 	$(INSTALL_DATA) -m 644 ../doc/psftp.1 $(DESTDIR)$(man1dir)/psftp.1
-+	$(INSTALL_DATA) -m 644 ../doc/puttygen.1 $(DESTDIR)$(man1dir)/puttygen.1
-+ifdef PUTTY_WITH_GTK
- 	$(INSTALL_DATA) -m 644 ../doc/pterm.1 $(DESTDIR)$(man1dir)/pterm.1
- 	$(INSTALL_DATA) -m 644 ../doc/putty.1 $(DESTDIR)$(man1dir)/putty.1
--	$(INSTALL_DATA) -m 644 ../doc/puttygen.1 $(DESTDIR)$(man1dir)/puttygen.1
- 	$(INSTALL_DATA) -m 644 ../doc/puttytel.1 $(DESTDIR)$(man1dir)/puttytel.1
-+endif
- 
- install-strip:
- 	$(MAKE) install INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s"
diff --git a/security/putty/files/patch-unix_uxnet.c b/security/putty/files/patch-unix_network.c
similarity index 81%
rename from security/putty/files/patch-unix_uxnet.c
rename to security/putty/files/patch-unix_network.c
index 5b49ab4de5a1..19e87ca62c99 100644
--- a/security/putty/files/patch-unix_uxnet.c
+++ b/security/putty/files/patch-unix_network.c
@@ -1,5 +1,5 @@
---- unix/uxnet.c.orig	2019-03-16 12:26:37 UTC
-+++ unix/uxnet.c
+--- unix/network.c.orig	2022-05-24 16:56:28 UTC
++++ unix/network.c
 @@ -11,8 +11,13 @@
  #include <sys/types.h>
  #include <sys/socket.h>
diff --git a/security/putty/files/patch-unix_uxpgnt.c b/security/putty/files/patch-unix_pageant.c
similarity index 74%
rename from security/putty/files/patch-unix_uxpgnt.c
rename to security/putty/files/patch-unix_pageant.c
index bd12c993c2e8..acfcf94966be 100644
--- a/security/putty/files/patch-unix_uxpgnt.c
+++ b/security/putty/files/patch-unix_pageant.c
@@ -1,6 +1,6 @@
---- unix/uxpgnt.c.orig	2019-03-16 12:26:38 UTC
-+++ unix/uxpgnt.c
-@@ -241,7 +241,7 @@ void pageant_fork_and_print_env(bool retain_tty)
+--- unix/pageant.c.orig	2022-05-24 16:56:28 UTC
++++ unix/pageant.c
+@@ -330,7 +330,7 @@ void pageant_fork_and_print_env(bool retain_tty)
          /* Get out of our previous process group, to avoid being
           * blasted by passing signals. But keep our controlling tty,
           * so we can keep checking to see if we still have one. */
diff --git a/security/putty/files/patch-unix_uxpty.c b/security/putty/files/patch-unix_uxpty.c
deleted file mode 100644
index bd56447ced52..000000000000
--- a/security/putty/files/patch-unix_uxpty.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- unix/uxpty.c.orig	2019-03-16 12:26:38 UTC
-+++ unix/uxpty.c
-@@ -13,7 +13,6 @@
- #include <fcntl.h>
- #include <termios.h>
- #include <grp.h>
--#include <utmp.h>
- #include <pwd.h>
- #include <time.h>
- #include <sys/types.h>