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

EAPI=8

DESCRIPTION="The Devil's Dictionary for dict"
HOMEPAGE="https://www.dict.org/"
SRC_URI="https://www.gutenberg.org/files/972/972.zip -> ${P}.zip"
S="$WORKDIR"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64"

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

PATCHES=( "${FILESDIR}/format.patch" )

src_prepare() {
	default

	sed \
		-e 's/\r//g' \
		-e "/^ *THE DEVIL'S DICTIONARY/,/^End of Project Gutenberg's The Devil's Dictionary/!{w COPYING.gutenberg" -e 'd}' \
		-e '/^\S/{: l;N;s/\n *\(.\)/ \1/g;t l}' \
		-e "s/^\\([A-Zor .'?-]*[^,A-Zor .'?-]\\)/ \1/" \
		-e '/^ /y/,/\a/' \
		-i 972.txt || die
}

src_compile() {
	head -n -6 972.txt | dictfmt -u "${SRC_URI% ->*}" \
		-s "The Devil's Dictionary (2015-08-22 Project Gutenberg version)" \
		--headword-separator " or " \
		--columns 80 \
		-h devils || die
	sed -e 'y/\a/,/' -i devils.dict || die
	dictzip devils.dict || die
}

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