summaryrefslogtreecommitdiff
path: root/eclass/aspell-dict-r1.eclass
blob: a779bf96e82b00a72cadac92970e45456401ecd4 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: aspell-dict-r1.eclass
# @MAINTAINER:
# Conrad Kostecki <conikost@gentoo.org>
# @AUTHOR:
# Seemant Kulleen <seemant@gentoo.org> (original author)
# David Seifert <soap@gentoo.org> (-r1 author)
# @SUPPORTED_EAPIS: 7 8
# @BLURB: An eclass to streamline the construction of ebuilds for new Aspell dictionaries.
# @DESCRIPTION:
# The aspell-dict-r1 eclass is designed to streamline the construction of ebuilds for
# the new Aspell dictionaries (from gnu.org) which support aspell-0.60.
# Support for aspell-0.60 has been added by Sergey Ulanov.

# @ECLASS-VARIABLE: ASPELL_LANG
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# Pure cleartext string that is included into DESCRIPTION.
# This is the name of the language, for instance "Hungarian".
# Needs to be defined before inheriting the eclass.

# @ECLASS-VARIABLE: ASPELL_SPELLANG
# @DESCRIPTION:
# Short (readonly) form of the language code, generated from ${PN}
# For instance, 'aspell-hu' yields the value 'hu'.
readonly ASPELL_SPELLANG=${PN/aspell-/}

# @ECLASS-VARIABLE: ASPELL_VERSION
# @PRE_INHERIT
# @DEFAULT_UNSET
# @DESCRIPTION:
# What major version of Aspell is this dictionary for? Valid values are 5, 6 or undefined.
# This value is used to construct SRC_URI strings.
# If the value needs to be overridden, it needs to be overridden before inheriting the eclass.

case ${EAPI:-0} in
	[7-8])
		;;
	*)
		die "${ECLASS}: EAPI ${EAPI:-0} not supported"
		;;
esac

EXPORT_FUNCTIONS src_configure src_install

if [[ ! ${_ASPELL_DICT_R1} ]]; then
_ASPELL_DICT_R1=1

# Most of those aspell packages have an idiosyncratic versioning scheme,
# where the last separating version separator is replaced by a '-'.
_ASPELL_P=aspell${ASPELL_VERSION}-${ASPELL_SPELLANG}-${PV%.*}-${PV##*.}

DESCRIPTION="Aspell (${ASPELL_LANG}) language dictionary"
HOMEPAGE="http://aspell.net"
SRC_URI="mirror://gnu/aspell/dict/${ASPELL_SPELLANG}/${_ASPELL_P}.tar.bz2"
S="${WORKDIR}/${_ASPELL_P}"
unset _ASPELL_P

SLOT="0"

RDEPEND="app-text/aspell"
DEPEND="${RDEPEND}"

_ASPELL_MAJOR_VERSION=${ASPELL_VERSION:-6}
[[ ${_ASPELL_MAJOR_VERSION} != [56] ]] && die "Unsupported ASPELL_VERSION=${ASPELL_VERSION}"
unset _ASPELL_MAJOR_VERSION

# @FUNCTION: aspell-dict-r1_src_configure
# @DESCRIPTION:
# The aspell-dict-r1 src_configure function which is exported.
aspell-dict-r1_src_configure() {
	# Since it's a non-autoconf based script, 'econf' cannot be used.
	./configure || die
}

# @FUNCTION: aspell-dict-r1_src_install
# @DESCRIPTION:
# The aspell-dict-r1 src_install function which is exported.
aspell-dict-r1_src_install() {
	default
	[[ -s info ]] && dodoc info
}

fi