git: 1d569d80bfee - 2022Q4 - mail/wmmaiload: fix build on recent FreeBSD.

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Wed, 09 Nov 2022 13:14:54 UTC
The branch 2022Q4 has been updated by fernape:

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

commit 1d569d80bfeee56db310bc296fdca58737503fac
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-07 18:55:17 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-11-09 13:11:11 +0000

    mail/wmmaiload: fix build on recent FreeBSD.
    
    Also fix some obvious things (missing deps, etc).
    
    PR:             267613
    Reported by:    fuz@fuz.su (maintainer)
    MFH:            2022Q4 (build fix)
    
    (cherry picked from commit a5f1cca72a5b84fe783e600eb468cf140b5e3a31)
---
 mail/wmmaiload/Makefile                            | 31 ++++----------
 .../files/patch-wmmaiload-config_mainwindow.c      | 47 ++++++++++++++++++++++
 mail/wmmaiload/files/patch-wmmaiload_Init.make     | 18 +++++++++
 mail/wmmaiload/files/patch-wmmaiload_checkthread.c | 47 ++++++++++++++++++++++
 mail/wmmaiload/files/patch-wmmaiload_dockapp.c     | 10 +++++
 mail/wmmaiload/files/patch-wmmaiload_main.h        | 11 +++++
 mail/wmmaiload/files/patch-wmmaiload_ssl.c         | 20 +++++++++
 7 files changed, 160 insertions(+), 24 deletions(-)

diff --git a/mail/wmmaiload/Makefile b/mail/wmmaiload/Makefile
index 22348e59dbd1..48cbb6ebb5b0 100644
--- a/mail/wmmaiload/Makefile
+++ b/mail/wmmaiload/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wmmaiload
 PORTVERSION=	2.3.0
+PORTREVISION=	1
 CATEGORIES=	mail windowmaker
 MASTER_SITES=	http://tnemeth.free.fr/projets/programmes/
 
@@ -10,14 +11,16 @@ WWW=		http://tnemeth.free.fr/projets/dockapps.html
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BROKEN_FreeBSD_13=	ld: error: duplicate symbol: application
-BROKEN_FreeBSD_14=	ld: error: duplicate symbol: application
+LIB_DEPENDS=	libharfbuzz.so:print/harfbuzz \
+		libfontconfig.so:x11-fonts/fontconfig \
+		libfreetype.so:print/freetype2
 
 USES=		gmake gnome localbase:ldflags pkgconfig ssl tar:bzip2 xorg
-USE_XORG=	xpm
-USE_GNOME=	gtk20
+USE_XORG=	x11 xext xpm
+USE_GNOME=	cairo gdkpixbuf2 gtk20
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--prefix=${PREFIX}
+CFLAGS+=	-fcommon
 CPPFLAGS+=	-I${OPENSSLINC} -D_GNU_SOURCE
 LDFLAGS+=	-L${OPENSSLLIB}
 MAKE_ENV=	DEBUG_CFLAGS="" DEBUG_LDFLAGS=""
@@ -28,26 +31,6 @@ PLIST_FILES=	bin/wmmaiload bin/wmmaiload-config \
 post-patch:
 	@${FIND} ${WRKSRC} -name "Makefile" | ${XARGS} ${REINPLACE_CMD} -e \
 		's| =| ?=|'
-.for i in wmmaiload/Init.make
-	@${REINPLACE_CMD} -e "s|'-lssl'|'-lssl -lcrypto'| ; \
-		s|-L/usr/X11R6/lib||" ${WRKSRC}/${i}
-.endfor
-.for i in wmmaiload/checkthread.c
-	@${REINPLACE_CMD} -e 's|isnumber(|isnum(|g' ${WRKSRC}/${i}
-.endfor
-.for i in wmmaiload/main.h
-	@${REINPLACE_CMD} -e '/time\.h>/d' ${WRKSRC}/${i}
-.endfor
-.for i in wmmaiload/ssl.c
-	@${REINPLACE_CMD} -e 's|SSLv2_client_method|SSLv23_client_method|' \
-		${WRKSRC}/${i}
-.endfor
-.for i in wmmaiload-config/mainwindow.c
-	@${REINPLACE_CMD} -e 's|remove;|rm;|g ; \
-		 s|remove,|rm,|g ; \
-		 s|remove =|rm =|g ; \
-		 s|PACKAGE"-config"|PACKAGE|g' ${WRKSRC}/${i}
-.endfor
 
 do-install:
 .for i in wmmaiload wmmaiload-config
diff --git a/mail/wmmaiload/files/patch-wmmaiload-config_mainwindow.c b/mail/wmmaiload/files/patch-wmmaiload-config_mainwindow.c
new file mode 100644
index 000000000000..10678baec26e
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload-config_mainwindow.c
@@ -0,0 +1,47 @@
+--- wmmaiload-config/mainwindow.c.orig	2009-02-23 02:58:00 UTC
++++ wmmaiload-config/mainwindow.c
+@@ -12,7 +12,7 @@
+ 
+ static GtkWidget *b_edit;
+ static GtkWidget *b_set;
+-static GtkWidget *b_remove;
++static GtkWidget *b_rm;
+ 
+ static gint list_sel_cb (GtkCList *clist,
+                          gint row,
+@@ -23,7 +23,7 @@ static gint list_sel_cb (GtkCList *clist,
+         selected_row = row;
+         gtk_widget_set_sensitive(b_edit, TRUE);
+         gtk_widget_set_sensitive(b_set, TRUE);
+-        gtk_widget_set_sensitive(b_remove, TRUE);
++        gtk_widget_set_sensitive(b_rm, TRUE);
+         return TRUE;
+ }
+ 
+@@ -37,7 +37,7 @@ gint list_unsel_cb (GtkCList *clist,
+         selected_row = -1;
+         gtk_widget_set_sensitive(b_edit, FALSE);
+         gtk_widget_set_sensitive(b_set, FALSE);
+-        gtk_widget_set_sensitive(b_remove, FALSE);
++        gtk_widget_set_sensitive(b_rm, FALSE);
+         return TRUE;
+ }
+ 
+@@ -66,7 +66,7 @@ void create_mainwindow()
+ 
+         /*** FENTRE PRINCIPALE ***/
+         application = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+-        gtk_window_set_title(GTK_WINDOW(application), PACKAGE"-config");
++        gtk_window_set_title(GTK_WINDOW(application), PACKAGE);
+         /*-- Connexion aux signaux --*/
+         gtk_signal_connect(GTK_OBJECT(application), "delete_event",
+                            GTK_SIGNAL_FUNC(quit_app), NULL);
+@@ -246,7 +246,7 @@ void create_mainwindow()
+         gtk_table_attach_defaults(GTK_TABLE(table), bouton, 2, 3, 0, 1);
+         gtk_widget_set_sensitive(bouton, FALSE);
+         gtk_widget_show(bouton);
+-        b_remove = bouton;
++        b_rm = bouton;
+ 
+         /*--- Frame 5 ---*/
+         frame = gtk_frame_new(NULL);
diff --git a/mail/wmmaiload/files/patch-wmmaiload_Init.make b/mail/wmmaiload/files/patch-wmmaiload_Init.make
new file mode 100644
index 000000000000..93cd2c1435b8
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload_Init.make
@@ -0,0 +1,18 @@
+--- wmmaiload/Init.make.orig	2005-08-28 19:14:57 UTC
++++ wmmaiload/Init.make
+@@ -45,13 +45,13 @@ endif
+ # SPECIFIC INFORMATIONS :
+ #
+ 
+-LIB_SSL = $(shell grep -q '^OPTIONS.*HAVE_SSL' ../Config.make && echo '-lssl')
++LIB_SSL = $(shell grep -q '^OPTIONS.*HAVE_SSL' ../Config.make && echo '-lssl -lcrypto')
+ LIB_THREADS = $(shell grep -q '^OPTIONS.*HAVE_THREADS' ../Config.make && echo '-lpthread')
+ 
+ CROSS_COMPILE =
+ USER_CPPFLAGS = $(OPTIONS)
+ USER_CFLAGS   =
+-USER_LDFLAGS  = -L/usr/X11R6/lib -lX11 -lXext -lXpm $(LIB_THREADS) $(LIB_SSL)
++USER_LDFLAGS  =  -lX11 -lXext -lXpm $(LIB_THREADS) $(LIB_SSL)
+ 
+ 
+ #*****************************************************************
diff --git a/mail/wmmaiload/files/patch-wmmaiload_checkthread.c b/mail/wmmaiload/files/patch-wmmaiload_checkthread.c
new file mode 100644
index 000000000000..eee126b8dcf8
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload_checkthread.c
@@ -0,0 +1,47 @@
+--- wmmaiload/checkthread.c.orig	2009-02-23 02:59:20 UTC
++++ wmmaiload/checkthread.c
+@@ -85,7 +85,7 @@ static Bool check_imap(MailBox *box, time_t now);
+ #endif /* HAVE_IMAP */
+ #ifdef HAVE_MH
+ static Bool check_mh(MailBox *box, time_t now);
+-static Bool isnumber(const char*);
++static Bool isnum(const char*);
+ static Bool isdir(const char*);
+ static Bool isfile(const char *);
+ static char *absname(const char*, int);
+@@ -304,7 +304,7 @@ static Bool check_imap(MailBox *box, time_t now)
+ 
+ 
+ #ifdef HAVE_MH
+-static Bool isnumber(const char *s)
++static Bool isnum(const char *s)
+ {
+         while (*s != '\0')
+         {
+@@ -420,7 +420,7 @@ static char *mh_get_profile(void)
+ 
+         if ((cp = getenv("MH")))
+         {
+-                if (*cp |= '/')
++                if (*cp != '/')
+                         profile = absname(cp, CWD);
+                 else
+                         profile = xstrdup(cp);
+@@ -488,7 +488,7 @@ static int mh_getseqcnt(const char *word)
+ {
+         int retval = 0;
+ 
+-        if (isnumber(word))
++        if (isnum(word))
+                 retval = 1;
+         else
+         {
+@@ -607,7 +607,7 @@ static int mh_getmails(const char *mh_box)
+ 
+         while ((d_entry = readdir(dir)))
+         {
+-                if (isnumber(d_entry->d_name))
++                if (isnum(d_entry->d_name))
+                 {
+                         char * tmp = NULL;
+ 
diff --git a/mail/wmmaiload/files/patch-wmmaiload_dockapp.c b/mail/wmmaiload/files/patch-wmmaiload_dockapp.c
new file mode 100644
index 000000000000..52f88ec43ad9
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload_dockapp.c
@@ -0,0 +1,10 @@
+--- wmmaiload/dockapp.c.orig	2022-11-07 08:58:34 UTC
++++ wmmaiload/dockapp.c
+@@ -26,6 +26,7 @@
+ #include "dockapp.h"
+ #include <sys/time.h>
+ #include <sys/types.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ 
+ #define WINDOWED_SIZE_W 64
diff --git a/mail/wmmaiload/files/patch-wmmaiload_main.h b/mail/wmmaiload/files/patch-wmmaiload_main.h
new file mode 100644
index 000000000000..cf70edc2c584
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload_main.h
@@ -0,0 +1,11 @@
+--- wmmaiload/main.h.orig	2005-08-28 11:54:03 UTC
++++ wmmaiload/main.h
+@@ -27,8 +27,6 @@
+ #ifndef MAIN_H
+ #define MAIN_H
+ 
+-#include <utime.h>
+-#include <time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "dockapp.h"
diff --git a/mail/wmmaiload/files/patch-wmmaiload_ssl.c b/mail/wmmaiload/files/patch-wmmaiload_ssl.c
new file mode 100644
index 000000000000..a422839eec16
--- /dev/null
+++ b/mail/wmmaiload/files/patch-wmmaiload_ssl.c
@@ -0,0 +1,20 @@
+--- wmmaiload/ssl.c.orig	2005-07-30 13:52:55 UTC
++++ wmmaiload/ssl.c
+@@ -23,6 +23,8 @@
+  *
+  */
+ 
++#include <string.h>
++
+ #include "config.h"
+ 
+ #ifdef HAVE_SSL
+@@ -39,7 +41,7 @@ static SSL_CTX *init_CTX(void)
+ 
+         OpenSSL_add_all_algorithms();
+ 
+-        method = SSLv2_client_method();
++        method = SSLv23_client_method();
+         ctx = SSL_CTX_new(method);
+         return ctx;
+ }