Saturday, January 30, 2021

games/typespeed: fix with -fno-common

Hi,

This fix is taken from Gentoo [0]. Built and tested on amd64.

OK?

Charlène.


[0]
https://gitweb.gentoo.org/repo/gentoo.git/tree/games-misc/typespeed/files/typespeed-0.6.5-use-extern.patch


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/typespeed/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile 12 Jul 2019 20:46:26 -0000 1.6
+++ Makefile 30 Jan 2021 16:16:29 -0000
@@ -3,7 +3,7 @@ COMMENT = Test your typing speed and ge

DISTNAME = typespeed-0.6.5
CATEGORIES = games
-REVISION = 3
+REVISION = 4

HOMEPAGE = http://typespeed.sourceforge.net/

Index: patches/patch-src_file_c
===================================================================
RCS file: /cvs/ports/games/typespeed/patches/patch-src_file_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_file_c
--- patches/patch-src_file_c 22 Jan 2016 15:24:30 -0000 1.1.1.1
+++ patches/patch-src_file_c 30 Jan 2021 16:16:29 -0000
@@ -1,10 +1,22 @@
$OpenBSD: patch-src_file_c,v 1.1.1.1 2016/01/22 15:24:30 landry Exp $

-Don't check if the userconf exists, inconditionally create
-the userdir in ~/.typespeed and the user scorefile.
+Hunk #1: Fix -fno-common build failure.
+Hunk #2: Don't check if the userconf exists, inconditionally create
+ the userdir in ~/.typespeed and the user scorefile.

---- src/file.c.orig Wed Aug 13 17:08:09 2008
-+++ src/file.c Fri Jan 22 15:21:45 2016
+Index: src/file.c
+--- src/file.c.orig
++++ src/file.c
+@@ -142,6 +142,9 @@ extern int hfd;
+ extern char *rankki[11];
+ extern char *typorank[12];
+ extern char *usedwordfile;
++extern struct rules rules;
++struct rawdata words;
++struct opt opt;
+
+ char ruledir[MAXPATHLEN];
+ char worddir[MAXPATHLEN];
@@ -1125,7 +1125,7 @@ void
readconfig(void)
{
Index: patches/patch-src_menu_c
===================================================================
RCS file: patches/patch-src_menu_c
diff -N patches/patch-src_menu_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_menu_c 30 Jan 2021 16:16:29 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix -fno-common build failure.
+
+Index: src/menu.c
+--- src/menu.c.orig
++++ src/menu.c
+@@ -76,6 +76,9 @@ void tellstory(void);
+
+ extern int misses;
+ extern char *rankki[11];
++extern struct stats now;
++extern struct rules rules;
++extern struct opt opt;
+
+ struct positions {
+ int rank;
Index: patches/patch-src_misc_c
===================================================================
RCS file: /cvs/ports/games/typespeed/patches/patch-src_misc_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_misc_c
--- patches/patch-src_misc_c 22 Jan 2016 15:24:30 -0000 1.1.1.1
+++ patches/patch-src_misc_c 30 Jan 2021 16:16:29 -0000
@@ -1,9 +1,19 @@
$OpenBSD: patch-src_misc_c,v 1.1.1.1 2016/01/22 15:24:30 landry Exp $

-use arc4random()
+Hunk #1: Fix -fno-common build failure.
+Hunk #2: Use arc4random()

---- src/misc.c.orig Fri Jan 22 14:58:04 2016
-+++ src/misc.c Fri Jan 22 14:58:24 2016
+Index: src/misc.c
+--- src/misc.c.orig
++++ src/misc.c
+@@ -75,6 +75,7 @@ char *xstrdup(char *);
+ void xstrncpy(char *, char *, size_t);
+
+ extern char *progname;
++extern struct opt opt;
+
+ static int graph = 0;
+
@@ -224,7 +224,7 @@ r(int range)
#ifdef WIN32
return (int)(rand() % range);
Index: patches/patch-src_network_c
===================================================================
RCS file: patches/patch-src_network_c
diff -N patches/patch-src_network_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_network_c 30 Jan 2021 16:16:29 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix -fno-common build failure.
+
+Index: src/network.c
+--- src/network.c.orig
++++ src/network.c
+@@ -116,6 +116,7 @@ void setnoblock(void);
+ void writenum(char *, uint32_t);
+
+ extern FILE *netlogfile;
++extern struct opt opt;
+
+ static int ds = -1;
+ static int ss = -1;
Index: patches/patch-src_typespeed_c
===================================================================
RCS file: /cvs/ports/games/typespeed/patches/patch-src_typespeed_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_typespeed_c
--- patches/patch-src_typespeed_c 22 Jan 2016 15:24:30 -0000 1.1.1.1
+++ patches/patch-src_typespeed_c 30 Jan 2021 16:16:29 -0000
@@ -1,10 +1,30 @@
$OpenBSD: patch-src_typespeed_c,v 1.1.1.1 2016/01/22 15:24:30 landry Exp $

-Disable the code opening the systemwide highscore file
-and dropping privileges, since we're removing the setgid bit
+Hunk #1: Fix -fno-common build failure
+Hunk #2: Disable the code opening the systemwide highscore file
+ and dropping privileges, since we're removing the setgid bit

---- src/typespeed.c.orig Fri Jan 22 14:38:01 2016
-+++ src/typespeed.c Fri Jan 22 14:39:59 2016
+Index: src/typespeed.c
+--- src/typespeed.c.orig
++++ src/typespeed.c
+@@ -146,6 +146,7 @@ char *typorank[12] =
+
+ FILE *netlogfile;
+ struct stats best;
++struct stats now;
+ int hfd;
+ int misses;
+ struct stats other;
+@@ -155,6 +156,9 @@ char *usedwordfile;
+ int wordcount = 0;
+ int wordpos[22];
+ char wordstring[22][20];
++struct rules rules;
++extern struct rawdata words;
++extern struct opt opt;
+
+ struct option options[] = {
+ {"cheat", no_argument, &opt.cheat, 1},
@@ -318,6 +318,7 @@ main(int argc, char **argv)
else
progname++;
Index: patches/patch-src_typespeed_h
===================================================================
RCS file: patches/patch-src_typespeed_h
diff -N patches/patch-src_typespeed_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_typespeed_h 30 Jan 2021 16:16:29 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+
+Fix -fno-common build failure.
+
+Index: src/typespeed.h
+--- src/typespeed.h.orig
++++ src/typespeed.h
+@@ -56,7 +56,7 @@ struct stats {
+ clock_t duration;
+ unsigned int sinit;
+ char name[21];
+-} now;
++};
+
+ struct opt {
+ int cheat;
+@@ -66,7 +66,7 @@ struct opt {
+ int usecolors;
+ char name[21];
+ char order[3];
+-} opt;
++};
+
+ struct rules {
+ int misses;
+@@ -85,12 +85,12 @@ struct rules {
+ int maxtime;
+ char name[31];
+ char fname[FILENAME_MAX + 1];
+-} rules;
++};
+
+ struct rawdata {
+ char *bulk;
+ char **word;
+ size_t n;
+ size_t max;
+-} words;
++};
+
Index: patches/patch-testsuite_t_loadwords_c
===================================================================
RCS file: patches/patch-testsuite_t_loadwords_c
diff -N patches/patch-testsuite_t_loadwords_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-testsuite_t_loadwords_c 30 Jan 2021 16:16:29 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix -fno-common build failure.
+
+Index: testsuite/t_loadwords.c
+--- testsuite/t_loadwords.c.orig
++++ testsuite/t_loadwords.c
+@@ -52,6 +52,7 @@ extern void freewords(void);
+ extern int loadwords(char *);
+
+ extern char worddir[MAXPATHLEN];
++extern struct rawdata words;
+
+ int
+ main(void)

No comments:

Post a Comment