git: 14df860062a2 - main - net/wmping: fix the port's build against -fno-common

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Mon, 07 Nov 2022 08:02:41 UTC
The branch main has been updated by danfe:

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

commit 14df860062a2417c117980666da0fd1985baaa63
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-07 08:01:32 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-11-07 08:01:32 +0000

    net/wmping: fix the port's build against -fno-common
    
    Ensure that there is only one variable definition per each object, as
    the C (and C++) standards mandated for years and compilers started to
    enforce as of recently (Clang 11, GCC 10).
    
    While here, define LICENSE, add missing USE_XORG components, and fix
    -Wformat-security warnings, adding newline to printed error messages
    for clarity and better look.
    
    PR:     267587
---
 net/wmping/Makefile                |  8 ++++----
 net/wmping/files/patch-wmgeneral.c | 10 ++++++++++
 net/wmping/files/patch-wmgeneral.h | 11 +++++++++++
 net/wmping/files/patch-wmping.c    | 38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/net/wmping/Makefile b/net/wmping/Makefile
index e6f7b204c582..21f331fde46b 100644
--- a/net/wmping/Makefile
+++ b/net/wmping/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	wmping
 PORTVERSION=	0.2.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net windowmaker
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
 
@@ -8,11 +8,11 @@ MAINTAINER=	serg@cad.kiev.ua
 COMMENT=	Windowmaker dock app to display network hosts status
 WWW=		https://sourceforge.net/projects/wmping/
 
-BROKEN_FreeBSD_13=	ld: error: duplicate symbol: display
-BROKEN_FreeBSD_14=	ld: error: duplicate symbol: display
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/COPYING
 
 USES=		gmake xorg
-USE_XORG=	xpm
+USE_XORG=	x11 xext xpm
 GNU_CONFIGURE=	yes
 
 PORTDOCS=	BUGS CHANGES README TODO
diff --git a/net/wmping/files/patch-wmgeneral.c b/net/wmping/files/patch-wmgeneral.c
new file mode 100644
index 000000000000..a3478c273360
--- /dev/null
+++ b/net/wmping/files/patch-wmgeneral.c
@@ -0,0 +1,10 @@
+--- wmgeneral.c.orig	2003-12-02 16:45:19 UTC
++++ wmgeneral.c
+@@ -55,6 +55,7 @@
+  /* X11 Variables */
+ /*****************/
+ 
++Display		*display;
+ Window		Root;
+ int			screen;
+ int			x_fd;
diff --git a/net/wmping/files/patch-wmgeneral.h b/net/wmping/files/patch-wmgeneral.h
new file mode 100644
index 000000000000..8ef6d6410e1b
--- /dev/null
+++ b/net/wmping/files/patch-wmgeneral.h
@@ -0,0 +1,11 @@
+--- wmgeneral.h.orig	2003-12-02 16:45:19 UTC
++++ wmgeneral.h
+@@ -36,7 +36,7 @@ typedef struct {
+  /* Global variable */
+ /*******************/
+ 
+-Display		*display;
++extern Display		*display;
+ 
+   /***********************/
+  /* Function Prototypes */
diff --git a/net/wmping/files/patch-wmping.c b/net/wmping/files/patch-wmping.c
new file mode 100644
index 000000000000..88b21ef84dd5
--- /dev/null
+++ b/net/wmping/files/patch-wmping.c
@@ -0,0 +1,38 @@
+--- wmping.c.orig	2004-02-09 09:27:38 UTC
++++ wmping.c
+@@ -237,7 +237,7 @@ void readconf()
+ 		    if(strcmp(tokens[1],"="))
+ 		    {
+ 			sprintf(str_err, "Not correct format of configuration file ( %s ): line %u", cfgfile, lineN);
+-			fprintf(stderr, str_err);
++			fprintf(stderr, "%s\n", str_err);
+                         exit(-1);
+ 		    }
+ 
+@@ -288,7 +288,7 @@ void readconf()
+ 		else
+ 		{
+ 		    sprintf(str_err, "Not correct format of configuration file ( %s ): line %u", cfgfile, lineN);
+-		    fprintf(stderr, str_err);
++		    fprintf(stderr, "%s\n", str_err);
+ 		    exit(-1);
+ 
+ 		}
+@@ -297,7 +297,7 @@ void readconf()
+         else
+ 	{
+ 	    sprintf(str_err, "Error open configuration file ( %s ): %s", cfgfile, strerror(errno));
+-	    fprintf(stderr, str_err);
++	    fprintf(stderr, "%s\n", str_err);
+ 	    fprintf(stderr, "\n Create default configuration file\n");
+ 	    createDefaultCfg(cfgfile);
+ 	}
+@@ -305,7 +305,7 @@ void readconf()
+     else
+     {
+ 	sprintf(str_err, "Error open configuration file ( %s ): %s", cfgfile, strerror(errno));
+-	fprintf(stderr, str_err);
++	fprintf(stderr, "%s\n", str_err);
+ 	fprintf(stderr, "\n Create default configuration file\n");
+ 	createDefaultCfg(cfgfile);
+     }