app-dicts/wordnet: port to EAPI 8

* merge build system patches
* use only libtool
* unconditionally install docs

Closes: https://bugs.gentoo.org/726502
Signed-off-by: David Seifert <soap@gentoo.org>
This commit is contained in:
David Seifert
2021-10-16 15:58:31 +02:00
parent ce13fd747d
commit 1946f9b3ad
7 changed files with 74 additions and 308 deletions

View File

@@ -1,3 +1,3 @@
DIST WordNet-3.0.tar.gz 11537227 BLAKE2B 358bdc3178f35f4f269ad9d0a5245396811f8678a020ab1ddf9978eef733bb91450f331d03734f585121b1532bb67ca97e765b13cb3f37018cd29df558201c5d SHA512 d39c008cec41de8f1b2aeacb4ad818f9997a13b30a992fda100b6dcc9c11c253530b00a1909b55ff7b564bafc33f7763c1ce9b0a6ae3e591695db2083e9ead7a
DIST wn3.1.dict.tar.gz 16358468 BLAKE2B f3df09f39ea29fce3378122f1a93d713acb8be39e6798695b8cc412a3ae6e644cfcf906426d4091d9849be60620367d3de541ec6dd0d8016b8f0cf39a7bad346 SHA512 16dca17a87026d8a0b7b4758219cd21a869c3ef3da23ce7875924546f2eacac4c2f376cb271b798b2c458fe8c078fb43d681356e3d9beef40f4bd88d3579394f
DIST wordnet-3.0-patchset-1.tar.bz2 8076 BLAKE2B 20684bd96814db6e0bf2d9aeb455def682fc38566d6abd3832bf0f7eae3b65b63e8b16aa21656bb81c1696bec0d179028ea8bb4687e5566a6d679bc55e300b9c SHA512 17668d736dd6dfe83e4d5d328729cbcdfb4dbca9a9707651534169bd2ce6fc2238d5c820d63330c51c20ab9b2964b56a609f58242b05dabbcfdfc0da61c048cb
DIST wordnet-3.0-patchset-2.tar.xz 8788 BLAKE2B 3e34b7f5f1011556fb9b53fc987fb3a0fd6818d68d8e71a35ee8d955071251648386c4a361bb902340c5ca899c993363721ee9acbea2eea1386e22502789be2d SHA512 2b72f12134cb60a1db98384650f13cd57012162908c0a37aa232ad0a04a249ce25cce76332dab08c5280d6f29fd58d5c874d5e8d6e00ef55523012d7faa09fcf

View File

@@ -1,20 +0,0 @@
diff -p -u -r WordNet-3.0/lib/morph.c WordNet-3.0-mine/lib/morph.c
--- a/lib/morph.c 2010-04-12 13:53:04.000000000 +0200
+++ b/lib/morph.c 2010-04-12 13:54:53.000000000 +0200
@@ -375,14 +375,14 @@ static char *exc_lookup(char *word, int
static char line[WORDBUF], *beglp, *endlp;
char *excline;
- if (exc_fps[pos] == NULL)
+ if (exc_fps[pos-1] == NULL)
return(NULL);
/* first time through load line from exception file */
if(word != NULL){
if (strlen(word) > WORDBUF - 1)
return(NULL);
- if ((excline = bin_search(word, exc_fps[pos])) != NULL) {
+ if ((excline = bin_search(word, exc_fps[pos-1])) != NULL) {
strcpy(line, excline);
endlp = strchr(line,' ');
} else

View File

@@ -1,48 +0,0 @@
lib/binsrch.c | 4 ++--
src/wn.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/binsrch.c b/lib/binsrch.c
index 8b71216..9ac51a7 100644
--- a/lib/binsrch.c
+++ b/lib/binsrch.c
@@ -193,7 +193,7 @@ char *replace_line(char *new_line, char *searchkey, FILE *fp)
copyfile(fp, tfp);
if (fseek(fp, offset, 0) == -1)
return(NULL); /* could not seek to offset */
- fprintf(fp, new_line); /* write line */
+ fprintf(fp, "%s", new_line); /* write line */
rewind(tfp);
copyfile(tfp, fp);
@@ -220,7 +220,7 @@ char *insert_line(char *new_line, char *searchkey, FILE *fp)
copyfile(fp, tfp);
if (fseek(fp, offset, 0) == -1)
return(NULL); /* could not seek to offset */
- fprintf(fp, new_line); /* write line */
+ fprintf(fp, "%s", new_line); /* write line */
rewind(tfp);
copyfile(tfp, fp);
diff --git a/src/wn.c b/src/wn.c
index 004e1e6..398632f 100644
--- a/src/wn.c
+++ b/src/wn.c
@@ -284,7 +284,7 @@ static void printsearches(char *word, int dbase, unsigned long search)
printf("\t");
printf(searchstr[j].template,
partchars[dbase], partchars[dbase]);
- printf(searchstr[j].helpstr);
+ printf("%s", searchstr[j].helpstr);
printf("\n");
}
}
@@ -345,7 +345,7 @@ static int getoptidx(char *searchtype)
static int error_message(char *msg)
{
- fprintf(stderr, msg);
+ fprintf(stderr, "%s", msg);
return(0);
}

View File

@@ -1,12 +0,0 @@
diff -urNad wordnet-3.0/src/stubs.c.orig wordnet-3.0/src/stubs.c
--- wordnet-3.0/src/stubs.c.orig 2007-01-04 18:47:55.000000000 +0100
+++ wordnet-3.0/src/stubs.c 2007-01-20 19:01:19.000000000 +0100
@@ -14,7 +14,7 @@
#include <tk.h>
#include <wn.h>
-static char *Id = "$Id: stubs.c,v 1.7 2005/04/29 19:01:57 wn Exp $";
+static const char Id[] = "$Id: stubs.c,v 1.7 2005/04/29 19:01:57 wn Exp $";
static char resultbuf[SEARCHBUF];

View File

@@ -1,133 +0,0 @@
src/stubs.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/stubs.c b/src/stubs.c
index 794485c..cec2c04 100644
--- a/src/stubs.c
+++ b/src/stubs.c
@@ -40,8 +40,8 @@ int wn_findvalidsearches (ClientData clientData, Tcl_Interp *interp,
char *morph;
int pos;
if (argc != 3) {
- interp -> result =
- "usage: findvalidsearches searchword partofspeechnum";
+ Tcl_SetResult(interp,
+ "usage: findvalidsearches searchword partofspeechnum", TCL_STATIC);
return TCL_ERROR;
}
pos = atoi (argv[2]);
@@ -52,7 +52,7 @@ int wn_findvalidsearches (ClientData clientData, Tcl_Interp *interp,
} while ((morph = morphstr (NULL, pos)) != NULL);
}
sprintf (bitfieldstr, "%u", bitfield);
- interp -> result = bitfieldstr;
+ Tcl_SetResult(interp, bitfieldstr, TCL_STATIC);
return TCL_OK;
}
@@ -69,13 +69,13 @@ int wn_bit (ClientData clientData, Tcl_Interp *interp,
static char bitfieldstr[32];
int whichbit;
if (argc != 2) {
- interp -> result = "usage: bit bitnum";
+ Tcl_SetResult(interp, "usage: bit bitnum", TCL_STATIC);
return TCL_ERROR;
}
whichbit = atoi (argv[1]);
bitfield = bit (whichbit);
sprintf (bitfieldstr, "%u", bitfield);
- interp -> result = bitfieldstr;
+ Tcl_SetResult(interp, bitfieldstr, TCL_STATIC);
return TCL_OK;
}
@@ -89,8 +89,8 @@ int wn_search (ClientData clientData, Tcl_Interp *interp,
int pos, searchtype, sense;
char *morph;
if (argc != 5) {
- interp -> result =
- "usage: search searchword partofspeechnum searchtypenum sensenum";
+ Tcl_SetResult(interp,
+ "usage: search searchword partofspeechnum searchtypenum sensenum", TCL_STATIC);
return TCL_ERROR;
}
pos = atoi (argv[2]);
@@ -102,7 +102,7 @@ int wn_search (ClientData clientData, Tcl_Interp *interp,
strcat (resultbuf, findtheinfo (morph, pos, searchtype, sense));
} while ((morph = morphstr (NULL, pos)) != NULL);
}
- interp -> result = resultbuf;
+ Tcl_SetResult(interp, resultbuf, TCL_STATIC);
return TCL_OK;
}
@@ -114,7 +114,7 @@ int wn_search (ClientData clientData, Tcl_Interp *interp,
int wn_glosses (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: glosses [1 | 0]";
+ Tcl_SetResult(interp, "usage: glosses [1 | 0]", TCL_STATIC);
return TCL_ERROR;
}
dflag = atoi (argv[1]);
@@ -129,7 +129,7 @@ int wn_glosses (ClientData clientData, Tcl_Interp *interp,
int wn_fileinfo (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: fileinfo [1 | 0]";
+ Tcl_SetResult(interp, "usage: fileinfo [1 | 0]", TCL_STATIC);
return TCL_ERROR;
}
fileinfoflag = atoi (argv[1]);
@@ -144,7 +144,7 @@ int wn_fileinfo (ClientData clientData, Tcl_Interp *interp,
int wn_byteoffset (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: byteoffset [1 | 0]";
+ Tcl_SetResult(interp, "usage: byteoffset [1 | 0]", TCL_STATIC);
return TCL_ERROR;
}
offsetflag = atoi (argv[1]);
@@ -159,7 +159,7 @@ int wn_byteoffset (ClientData clientData, Tcl_Interp *interp,
int wn_senseflag (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: senseflag [1 | 0]";
+ Tcl_SetResult(interp, "usage: senseflag [1 | 0]", TCL_STATIC);
return TCL_ERROR;
}
wnsnsflag = atoi (argv[1]);
@@ -175,12 +175,13 @@ int wn_contextualhelp (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
int pos, searchtype;
if (argc != 3) {
- interp -> result = "usage: contextualhelp partofspeechnum searchtypenum";
+ Tcl_SetResult(interp,
+ "usage: contextualhelp partofspeechnum searchtypenum", TCL_STATIC);
return TCL_ERROR;
}
pos = atoi (argv[1]);
searchtype = atoi (argv[2]);
- interp -> result = helptext[pos][searchtype];
+ Tcl_SetResult(interp, helptext[pos][searchtype], TCL_STATIC);
return TCL_OK;
}
@@ -190,7 +191,7 @@ int wn_contextualhelp (ClientData clientData, Tcl_Interp *interp,
int wn_reopendb (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 1) {
- interp -> result = "usage: reopendb";
+ Tcl_SetResult(interp, "usage: reopendb", TCL_STATIC);
return TCL_ERROR;
}
re_wninit ();
@@ -204,7 +205,7 @@ int wn_reopendb (ClientData clientData, Tcl_Interp *interp,
int wn_abortsearch (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 1) {
- interp -> result = "usage: abortsearch";
+ Tcl_SetResult(interp, "usage: abortsearch", TCL_STATIC);
return TCL_ERROR;
}
abortsearch = 1;

View File

@@ -0,0 +1,73 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools flag-o-matic
DESCRIPTION="A lexical database for the English language"
HOMEPAGE="https://wordnet.princeton.edu/"
SRC_URI="
http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz
http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz
https://dev.gentoo.org/~soap/distfiles/${PN}-3.0-patchset-2.tar.xz"
S="${WORKDIR}/WordNet-3.0"
LICENSE="Princeton"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~riscv ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
# In contrast to what the configure script seems to imply, Tcl/Tk is NOT
# optional. cf. bug 163478 for details. (Yes, it's about 2.1 but it's
# still the same here.)
DEPEND="
dev-lang/tcl:0=
dev-lang/tk:0="
RDEPEND="${DEPEND}"
PATCHES=(
"${WORKDIR}"/patches/${PN}-3.0-build-system.patch
"${WORKDIR}"/patches/${PN}-3.0-CVE-2008-3908.patch #211491
"${WORKDIR}"/patches/${PN}-3.0-tcl8.6.patch
"${WORKDIR}"/patches/${PN}-3.0-format-security.patch
"${WORKDIR}"/patches/${PN}-3.0-src_stubs_c.patch
"${WORKDIR}"/patches/${PN}-3.0-fix-indexing-bug-314799.patch
"${WORKDIR}"/patches/${PN}-3.0-CVE-2008-2149.patch #211491
)
src_prepare() {
default
eautoreconf
}
src_configure() {
append-cppflags -DUNIX -I"${T}"/usr/include
PLATFORM=linux \
WN_ROOT="${T}"/usr \
WN_DICTDIR="${T}"/usr/share/wordnet/dict \
WN_MANDIR="${T}"/usr/share/man \
WN_DOCDIR="${T}"/usr/share/doc/wordnet-3.0 \
WNHOME="${EPREFIX}"/usr/share/wordnet \
econf \
--with-tcl="${EPREFIX}"/usr/$(get_libdir) \
--with-tk="${EPREFIX}"/usr/$(get_libdir)
}
src_install() {
default
# For clarification: WN is still on version 3.0. Only the database files
# have been updated to 3.1 as a package for 3.1 does not currently exist.
rm -r "${ED}"/usr/share/wordnet/dict || die
insinto /usr/share/wordnet
doins -r "${WORKDIR}"/dict
find "${ED}" -name '*.la' -delete || die
}
pkg_postinst() {
elog "The WordNet 3.1 ebuild has installed WordNet v3.0 with v3.1 database files instead."
elog "See https://wordnet.princeton.edu/download/current-version/ for more."
}

View File

@@ -1,94 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit autotools flag-o-matic
DESCRIPTION="A lexical database for the English language"
HOMEPAGE="https://wordnet.princeton.edu/"
SRC_URI="
http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz
mirror://gentoo/${PN}-3.0-patchset-1.tar.bz2
http://wordnetcode.princeton.edu/wn3.1.dict.tar.gz"
LICENSE="Princeton"
SLOT="0"
KEYWORDS="amd64 ppc ~riscv x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
IUSE="doc"
# In contrast to what the configure script seems to imply, Tcl/Tk is NOT
# optional. cf. bug 163478 for details. (Yes, it's about 2.1 but it's
# still the same here.)
DEPEND="
dev-lang/tcl:0=
dev-lang/tk:0="
RDEPEND="${DEPEND}"
S="${WORKDIR}/WordNet-3.0"
PATCHES1=(
# Don't install into PREFIX/dict but PREFIX/share/wordnet/dict
"${WORKDIR}/"${PN}-3.0"-dict-location.patch"
# Fixes bug 130024, make an additional shared lib
"${WORKDIR}/"${PN}-3.0"-shared-lib.patch"
# Don't install the docs directly into PREFIX/doc but PREFIX/doc/PN
"${WORKDIR}/"${PN}-3.0"-docs-path.patch"
"${WORKDIR}"/"${PN}-3.0"-CVE-2008-3908.patch #211491
"${FILESDIR}"/"${PN}-3.0"-tcl8.6.patch
"${FILESDIR}"/"${PN}-3.0"-format-security.patch
"${FILESDIR}"/"${PN}-3.0"-src_stubs_c.patch
"${FILESDIR}"/"${PN}-3.0"-fix-indexing-bug-314799.patch
)
PATCHES0=(
"${WORKDIR}"/"${PN}-3.0"-CVE-2008-2149.patch #211491
)
src_prepare() {
eapply -p1 "${PATCHES1[@]}"
eapply -p0 "${PATCHES0[@]}"
eapply_user
# Don't install all the extra docs (html, pdf, ps) without doc USE flag.
if ! use doc; then
sed -i -e "s:SUBDIRS =.*:SUBDIRS = man:" doc/Makefile.am || die
fi
# Drop installation of OLD tk.h headers #255590
sed '/^SUBDIRS/d' -i include/Makefile.am || die
sed 's: include/tk/Makefile::' -i configure.ac || die
eautoreconf
}
src_configure() {
append-cppflags -DUNIX -I"${T}"/usr/include
PLATFORM=linux WN_ROOT="${T}/usr" \
WN_DICTDIR="${T}/usr/share/wordnet/dict" \
WN_MANDIR="${T}/usr/share/man" \
WN_DOCDIR="${T}/usr/share/doc/wordnet-3.0" \
WNHOME="${EPREFIX}/usr/share/wordnet" \
econf \
--with-tcl="${EPREFIX}"/usr/$(get_libdir) \
--with-tk="${EPREFIX}"/usr/$(get_libdir)
}
src_compile() {
emake -e
}
src_install() {
# For clarification, WN is still on version 3.0. Only the database files
# have been updated to 3.1 as a package for 3.1 does not currently exist.
emake -e DESTDIR="${D}" install
einstalldocs
rm -r "${D}/usr/share/wordnet/dict" || die
mv "${WORKDIR}/dict" "${D}/usr/share/wordnet" || die
}
pkg_postinst() {
elog "The WordNet 3.1 ebuild has installed WordNet v3.0 with v3.1 database files instead."
elog "See https://wordnet.princeton.edu/download/current-version/ for more."
}