games-misc/typespeed: fix build

Closes: https://bugs.gentoo.org/694840
Closes: https://bugs.gentoo.org/691256
Closes: https://bugs.gentoo.org/706518
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Alexey Sokolov <alexey+gentoo@asokolov.org>
Signed-off-by: David Seifert <soap@gentoo.org>
This commit is contained in:
Alexey Sokolov
2020-11-15 21:02:50 +01:00
committed by David Seifert
parent 1f6ad5398e
commit 0fc2430644
3 changed files with 198 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
diff -r 8cf704f4cffa configure.ac
--- a/configure.ac Thu Oct 15 23:52:32 2020 +0000
+++ b/configure.ac Thu Oct 15 23:52:58 2020 +0000
@@ -16,6 +16,6 @@
# Checks for libraries.
-AC_CHECK_LIB([ncurses], [initscr])
+PKG_CHECK_MODULES([NCURSES], [ncurses], [], [exit 1])
# I18N
AM_GNU_GETTEXT_VERSION([0.14.5])
diff -r e64ba00e0147 src/Makefile.am
--- a/src/Makefile.am Fri Oct 16 00:08:17 2020 +0000
+++ b/src/Makefile.am Fri Oct 16 00:08:39 2020 +0000
@@ -15,7 +15,7 @@
-DCONFIGFILE=\"$(sysconfdir)/typespeedrc\" \
-DHIGHFILE=\"$(highscoredir)/$(HIGHFILE)\" \
-DWORDDIR=\"$(WORDDIR)\" -DRULEDIR=\"$(RULEDIR)\"
-typespeed_LDADD = @LIBINTL@
+typespeed_LDADD = @LIBINTL@ @NCURSES_LIBS@
typespeed_SOURCES = file.c gettext.h menu.c misc.c network.c pathnames.h \
typespeed.c typespeed.h
diff -r 987ceebc438f testsuite/Makefile.am
--- a/testsuite/Makefile.am Fri Oct 16 00:14:34 2020 +0000
+++ b/testsuite/Makefile.am Fri Oct 16 00:15:37 2020 +0000
@@ -2,7 +2,7 @@
localedir = $(datadir)/locale
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DTVERSION=\"v$(VERSION)\" -DTEST
-LDADD = @LIBINTL@
+LDADD = @LIBINTL@ @NCURSES_LIBS@
EXTRA_DIST = t_unescstr.sh t_loadwords_data/3_empty

View File

@@ -0,0 +1,116 @@
Description: Fix FTBFS with gcc-10
Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Bug-Debian: https://bugs.debian.org/957887
---
--- typespeed-0.6.5.orig/src/file.c
+++ typespeed-0.6.5/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];
--- typespeed-0.6.5.orig/src/menu.c
+++ typespeed-0.6.5/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;
--- typespeed-0.6.5.orig/src/misc.c
+++ typespeed-0.6.5/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;
--- typespeed-0.6.5.orig/src/network.c
+++ typespeed-0.6.5/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;
--- typespeed-0.6.5.orig/src/typespeed.c
+++ typespeed-0.6.5/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},
--- typespeed-0.6.5.orig/src/typespeed.h
+++ typespeed-0.6.5/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;
+};
--- typespeed-0.6.5.orig/testsuite/t_loadwords.c
+++ typespeed-0.6.5/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)

View File

@@ -0,0 +1,47 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools
DESCRIPTION="Test your typing speed, and get your fingers CPS"
HOMEPAGE="http://typespeed.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc64 ~x86"
IUSE="nls"
RDEPEND="
sys-libs/ncurses:0=
nls? ( virtual/libintl )"
DEPEND="${RDEPEND}"
BDEPEND="
virtual/pkgconfig
nls? ( sys-devel/gettext )"
PATCHES=(
"${FILESDIR}"/${P}-musl.patch
"${FILESDIR}"/${P}-use-extern.patch
"${FILESDIR}"/${P}-link-tinfo.patch
)
src_prepare() {
default
sed -i -e '/^CC =/d' \
src/Makefile.am \
testsuite/Makefile.am || die
rm -r m4 || die #bug 417265
eautoreconf
}
src_configure() {
econf $(use_enable nls)
}
src_install() {
default
dodoc doc/README
}