summaryrefslogtreecommitdiff
path: root/app-dicts/dictd-foldoc/dictd-foldoc-20180405.ebuild
blob: d0e336f882b865a3c1b7a19674a9a289b753e35d (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="The Free On-line Dictionary of Computing for dict"
HOMEPAGE="https://foldoc.org"
SRC_URI="https://web.archive.org/web/${PV}153121/http://foldoc.org/Dictionary -> ${P}.txt"
S="${WORKDIR}"
LICENSE="FDL-1.1+"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND=">=app-text/dictd-1.13.0-r3"
BDEPEND="${RDEPEND}"

src_unpack() {
	cp "${DISTDIR}/${A}" foldoc.txt || die
}

src_prepare() {
	eapply_user
	sed -e '/^$/{N;s/\n\([^\t]\+\)/\1/g;T;h;n;d}' -i foldoc.txt || die
}

src_compile() {
	tail -n +3 foldoc.txt | dictfmt -u "$HOMEPAGE/Dictionary" \
		-s "The Free On-line Dictionary of Computing (version ${PV})" \
		--utf8 \
		-f foldoc || die
	dictzip foldoc.dict || die
}

src_install() {
	insinto /usr/share/dict
	doins foldoc.dict.dz foldoc.index
}

pkg_postrm() {
	elog "You must unregister ${PN} and restart your dictd server before the"
	elog "dictionary is completely removed.  If you are using OpenRC, both tasks may be"
	elog "accomplished by running '/etc/init.d/dictd restart'."
}