summaryrefslogtreecommitdiff
blob: 786566fca433f388fc53f3c30ada17020afd70c1 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

UNI_PV="10.0.0"
DESCRIPTION="Miscellaneous files"
HOMEPAGE="https://savannah.gnu.org/projects/miscfiles/"
# https://www.unicode.org/Public/${UNI_PV}/ucd/UnicodeData.txt
SRC_URI="mirror://gnu/miscfiles/${P}.tar.gz
	https://dev.gentoo.org/~whissi/dist/${PN}/UnicodeData-${UNI_PV}.txt.xz"

LICENSE="GPL-2 unicode"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x86-solaris"
IUSE="minimal"

# Collides with older versions/revisions
RDEPEND="!<sys-freebsd/freebsd-share-7.2-r1"
DEPEND=""

src_prepare() {
	default

	mv "${WORKDIR}"/UnicodeData-${UNI_PV}.txt unicode || die
}

src_configure() {
	econf --datadir="${EPREFIX}"/usr/share/misc
}

src_install() {
	emake install DESTDIR="${D}"
	dodoc NEWS ORIGIN README dict-README

	# not sure if this is still needed ...
	dodir /usr/share/dict
	cd "${ED%/}"/usr/share/misc || die
	mv $(awk '$1=="dictfiles"{$1="";$2="";print}' "${S}"/Makefile) ../dict/ || die
	cd ../dict || die
	ln -s web2 words || die
	ln -s web2a extra.words || die

	if use minimal ; then
		pushd "${ED%/}"/usr/share/dict || die
		rm -f words extra.words || die
		gzip -9 * || die
		ln -s web2.gz words || die
		ln -s web2a.gz extra.words || die
		ln -s connectives{.gz,} || die
		ln -s propernames{.gz,} || die
		popd || die
		rm -r "${ED%/}"/usr/share/misc || die
	fi
}

pkg_postinst() {
	if [[ ${ROOT} == "/" ]] && type -P create-cracklib-dict >/dev/null ; then
		ebegin "Regenerating cracklib dictionary"
		create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
		eend $?
	fi

	# pkg_postinst isn't supposed to fail
	return 0
}