aboutsummaryrefslogtreecommitdiff
blob: d648d0d9568ef2d48db1d14cbed524a02fff50e1 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="Jay Kominek's database of the elements for dict"
HOMEPAGE="http://www.dict.org"
SRC_URI="https://web.archive.org/web/20121223051336/http://www.miranda.org:80/~jkominek/elements/elements.db -> ${P}.db"
S="$WORKDIR"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64"

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

src_unpack() {
	cp "${DISTDIR}/${A}" elements.db || die
}

src_prepare() {
	eapply_user
	sed -e '/^%h/{h;n;n;s/Symbol: //;T;x;G;s/\n/ /}' -i elements.db || die
	sed -e '/^%h/{N;N;s/%h.*\n%d\n\(%h.*\)/\1\n%d/}' -i elements.db || die
}

src_compile() {
	dictfmt -u "${SRC_URI% ->*}" \
		-s "Jay Kominek's Elements database (version $PV)" \
		--headword-separator " " \
		--columns 80 \
		-p elements \
		< elements.db || die
	dictzip elements.dict || die
}

src_install() {
	insinto /usr/share/dict
	doins elements.dict.dz elements.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'."
}