git: 679cfe51e8b2 - main - games/typespeed: Fix link error on FreeBSD 13 or later (-fno-common)

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Wed, 17 Nov 2021 01:29:43 UTC
The branch main has been updated by yasu:

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

commit 679cfe51e8b2e8a2c10e0e589bc9d53cdee8f6d8
Author:     Martin Birgmeier <d8zNeCFG@aon.at>
AuthorDate: 2021-10-28 11:37:15 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2021-11-17 01:29:25 +0000

    games/typespeed: Fix link error on FreeBSD 13 or later (-fno-common)
    
    PR:             259501
    MFH:            2021Q4
---
 games/typespeed/Makefile                    |  5 +--
 games/typespeed/files/patch-src-typespeed.c | 15 +++++++++
 games/typespeed/files/patch-src-typespeed.h | 47 +++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/games/typespeed/Makefile b/games/typespeed/Makefile
index c92c2ba8c828..549dadd906bb 100644
--- a/games/typespeed/Makefile
+++ b/games/typespeed/Makefile
@@ -12,9 +12,6 @@ COMMENT=	Test your typing speed and get your fingers' CPS
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BROKEN_FreeBSD_13=	ld: error: duplicate symbol: now
-BROKEN_FreeBSD_14=	ld: error: duplicate symbol: now
-
 USES=		ncurses
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-highscoredir="${SCOREDIR}"
@@ -22,7 +19,7 @@ CONFIGURE_ARGS=	--with-highscoredir="${SCOREDIR}"
 SCOREDIR=	/var/games/typespeed
 SCOREFILE=	typespeed.score
 
-OPTIONS_DEFINE=	NLS DOCS
+OPTIONS_DEFINE=	DOCS NLS
 OPTIONS_SUB=	yes
 
 NLS_USES=		gettext
diff --git a/games/typespeed/files/patch-src-typespeed.c b/games/typespeed/files/patch-src-typespeed.c
new file mode 100644
index 000000000000..bfb9f8b6c26e
--- /dev/null
+++ b/games/typespeed/files/patch-src-typespeed.c
@@ -0,0 +1,15 @@
+--- src/typespeed.c.orig	2008-08-13 14:36:51 UTC
++++ src/typespeed.c
+@@ -136,6 +136,12 @@ static void		usage(void);
+ #endif /* TEST */
+ 
+ /* globals */
++struct finfo finfo;
++struct stats now;
++struct opt opt;
++struct rules rules;
++struct rawdata words;
++
+ char *rankki[11] =
+ {"None", "Beginner", "Learner", "NoGood", "Average",
+  "Good", "VeryGood", "Pro", "3l33t", "*(GOD)*", "Computer"};
diff --git a/games/typespeed/files/patch-src-typespeed.h b/games/typespeed/files/patch-src-typespeed.h
new file mode 100644
index 000000000000..fc37322e5981
--- /dev/null
+++ b/games/typespeed/files/patch-src-typespeed.h
@@ -0,0 +1,47 @@
+--- src/typespeed.h.orig	2008-08-13 14:36:51 UTC
++++ src/typespeed.h
+@@ -44,6 +44,7 @@ struct finfo {
+ 	char descr[61];
+ 	char name[MAXPATHLEN];
+ };
++extern struct finfo finfo;
+ 
+ struct stats {
+ 	uint8_t level;
+@@ -56,7 +57,8 @@ struct stats {
+ 	clock_t duration;
+ 	unsigned int sinit;
+ 	char name[21];
+-} now;
++};
++extern struct stats now;
+ 
+ struct opt {
+ 	int cheat;
+@@ -66,7 +68,8 @@ struct opt {
+ 	int usecolors;
+ 	char name[21];
+ 	char order[3];
+-} opt;
++};
++extern struct opt opt;
+ 
+ struct rules {
+ 	int misses;
+@@ -85,12 +88,13 @@ struct rules {
+ 	int maxtime;
+ 	char name[31];
+ 	char fname[FILENAME_MAX + 1];
+-} rules;
++};
++extern struct rules rules;
+ 
+ struct rawdata {
+ 	char *bulk;
+ 	char **word;
+ 	size_t n;
+ 	size_t max;
+-} words;
+-
++};
++extern struct rawdata words;