summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c6f4e7d86cb7e03dba15a233cdf9b8afedef8054 (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
# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
# Contributor: Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com>
pkgname=dict-gcide
_major_debver=0.48
_debver="${_major_debver}.5+nmu3"
pkgver=0.53
pkgrel=4
pkgdesc="GNU version of the Collaborative International Dictionary of English for dictd et al."
arch=('any')
url="https://gcide.gnu.org.ua/"
license=('GPL3')
optdepends=('dictd: dict client and server')
makedepends=('dictd' 'libmaa')
provides=('dictd-gcide')
conflicts=('dictd-gcide')
install="${pkgname}.install"
source=('fixes.sed'
        'post_webfilter.sed'
        'check.sed'
        "https://deb.debian.org/debian/pool/main/d/${pkgname}/${pkgname}_${_debver}.tar.xz"
        "https://ftp.gnu.org/gnu/gcide/gcide-${pkgver}.tar.xz"{,.sig})
sha512sums=('487dc4dcdc5c7bbd7e75e729c88b2ab9d8e4f2ebe91d54ff806a12606c0fd08adeedb43c31547cbc9bb2875673fefb59072c062562facd70dd0b2904195242c0'
            'e7c6766b51ef92c4d8669394b6a71f8c4d7249ac63a1eb940f0a3017cb5ff6841f0f4bce7a60ffbcf180801d92b068db6ca46afd1dceac06a9c37c59dcddbfb3'
            '1304bdce3776355fcd7827cebbf670ae34377bda78b04bf271ba10a25d92e33f6ec69644e168c30a6ec47808ebacc461de47d9494a5a2a5894d58c21be045973'
            'f5fe730c90c23ac83cc521805bdd31ed09a8eabf7e7f3e7263af36456469c62bf10c399990696bc4017ec2dfa8121d49e38cd653d5b5602a590ee751287c2b15'
            '0eb641cdc8186757bb7e221753c9a42f28ead25b72b18cacebf2326ee239c0e5ab2d41b61928371168ff2c8a298aeaa93d50656d8165ae155699c1d359e4918f'
            'SKIP')
validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732')


prepare()
{
	cd "${pkgname}-${_debver}"

	sed -Ei \
		"s/\"(The Collaborative International Dictionary of English) v.${_major_debver}\"/\"\\1 v.${pkgver}\"/" \
		scan.l

	# Remove autogenerated autotools files.
	rm config.guess config.h.in config.sub configure install-sh
}


build()
{
	cd ${pkgname}-${_debver}

	autoreconf -fis
	./configure
	make -j1

	# Do the conversion explicitly, instead of `make db', to account for all
	# the differences to the original build process.
	# LANG=C is required so that the index file is properly sorted.
	../fixes.sed "../gcide-${pkgver}"/CIDE.? \
		| sed -f debian/sedfile \
		| ./webfilter \
		| ../post_webfilter.sed \
		| tee pre_webfmt.data \
		| LANG=C ./webfmt -c

	# `dictzip -v' neglects to print a final newline.
	dictzip -v gcide.dict
	printf '\n'
}


check()
{
	errors="$(./check.sed < "${pkgname}-${_debver}/pre_webfmt.data")"

	if test -n "$errors"
	then
		printf 'Errors found:\n'
		printf '%s\n' "$errors"
		return 1
	fi
}


package()
{
	install -m 0755 -d "${pkgdir}/usr/share/dictd"
	install -m 0644 -t "${pkgdir}/usr/share/dictd/" \
		"${pkgname}-${_debver}"/gcide.{dict.dz,index}

	install -m 0755 -d "${pkgdir}/usr/share/doc/dict-gcide"
	install -m 0644 -t "${pkgdir}/usr/share/doc/dict-gcide/" \
		"gcide-${pkgver}"/{README,INFO,pronunc.txt}
}