summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 64db2256d3e6a51193fa9b63a4f0f5871ea8e1c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
# Contributor: Enrico Morelli <morelli@cerm.unifi.it>
# Contributor: Andrew Engelbrecht <sudoman@ninthfloor.org>
pkgname=dict-wn
pkgver=3.1
_debver=3.0
_debsubver=36
pkgrel=5
pkgdesc="WordNet for dictd et al."
arch=('any')
url="https://wordnet.princeton.edu/"
license=('custom: WordNet License' 'GPL2' 'GPL')
optdepends=('dictd: dict client and server')
makedepends=('dictd' 'python')
provides=('dictd-wn')
conflicts=('dictd-wn')
install="${pkgname}.install"

# The tarballs from debian are required for
#  - `wordnet_structures.py' ("orig"),
#  - patches ("debian").
source=("https://wordnetcode.princeton.edu/wn${pkgver}.dict.tar.gz"
        "https://deb.debian.org/debian/pool/main/w/wordnet/wordnet_${_debver}.orig.tar.gz"
        "https://deb.debian.org/debian/pool/main/w/wordnet/wordnet_${_debver}-${_debsubver}.debian.tar.xz")
sha512sums=('16dca17a87026d8a0b7b4758219cd21a869c3ef3da23ce7875924546f2eacac4c2f376cb271b798b2c458fe8c078fb43d681356e3d9beef40f4bd88d3579394f'
            'f153ea6be57ef57b18e4f0857e2ce0493ee75171f60df4b3aa669f4279c1b2ad91641da166b450d95a89166d50d6dc0d9f199710fa2f1ab934882028760d6917'
            'ca9a445e0f447073f5aa13fdeefe339f8c34d0510d7a9ac5b1bf0167d5d5fa23f796267fb34aec963f47b0611565454b33c798ad4424c9cd84eef5f665fd514b')


prepare()
{
	cd WordNet-${_debver}


	# Apply Debian patches.
	#  - Note: Lots of these affect files that we do not use.
	local _patchdir=../debian/patches
	local _patchfile
	while IFS= read -r _patchfile
	do
		patch -p1 < "${_patchdir}/${_patchfile}"
	done < "${_patchdir}/series"


	# Remove autogenerated autotools and libtool files.
	rm aclocal.m4 compile config.guess config.h.in config.sub configure \
		depcomp install-sh missing ylwrap ltmain.sh
	find . -name Makefile.in -delete


	# Use the new data, but the old Makefiles.
	#  - The new data do not include Makefiles.
	#  - extglob's do not work in PKGBUILDs.
	mv dict/Makefile.am ../dict/
	mv dict/dbfiles/Makefile.am ../dict/dbfiles/
	rm -rf dict
	mv -T ../dict/ dict

	# Both versions have `dict/verb.Framestext' and a copy of it as
	#  - dict/frames.vrb (v3.0) and
	#  - dict/dbfiles/verb.Framestext (v3.1), respectively.
	# The build system is written for v3.0, hence adjust accordingly.
	mv -f dict/dbfiles/verb.Framestext dict/frames.vrb

	# Version 3.1 does not contain a grind logfile.
	sed -Ei '/dict_DATA *=/ s/ \<log.grind.3.0\>//' dict/Makefile.am


	# Tcl and Tk are not needed for our purposes.
	# `configure' fails if they are not installed and the macros not deleted.
	sed -Ei '/^SC_(PATH|LOAD)_T(CL|K)CONFIG/ d' configure.ac


	# Pass the url and the name with the new version.
	#  - Note: The Wordnet license as presented by `dict -i wn' continues to
	#          claim version 3.0 and a copyright date of 2006.
	#    - The separately downloaded dataset does not contain a license.
	#    - The web license also mentions version 3.0.
	#      - https://wordnet.princeton.edu/license-and-commercial-use
	sed -Ei 's`python3? wordnet_structures\.py`& --wn_url="https://wordnet.princeton.edu" --db_desc_short="WordNet (r) '"${pkgver}"' (2011)"`' \
		contrib/wordnet_structures/Makefile.am
}


build() {
	cd "WordNet-${_debver}"

	# See also `./autogen.sh'.
	libtoolize
	aclocal
	autoheader
	automake --add-missing
	autoconf

	./configure


	# The make structure does not facilitate building parts only.
	# This is why several direct calls to `make' seem required.

	# Building fails with -jN where N>1.
	make -j1 -C src/grind/ grind

	make -C dict/dbfiles/
	make -C contrib/wordnet_structures/
}


package() {
	cd "WordNet-${_debver}"

	install -m 0755 -d "${pkgdir}/usr/share/dictd"
	install -m 0644 -t "${pkgdir}/usr/share/dictd/" \
		contrib/wordnet_structures/wn.{dict.dz,index}

	# Note: The documentation is for the old version.
	install -m 0755 -d "${pkgdir}/usr/share/doc/${pkgname}"
	install -m 0644 -t "${pkgdir}/usr/share/doc/${pkgname}/" \
		AUTHORS COPYING NEWS README

	install -m 0755 -d "${pkgdir}/usr/share/licenses/dict-wn"
	ln -s /usr/share/doc/dict-wn/COPYING "${pkgdir}/usr/share/licenses/dict-wn"
}