dev-qt/qttest: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / eclass / stardict.eclass
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # Author : Alastair Tse <liquidx@gentoo.org>
5 #
6 # Convienence class to do stardict dictionary installations.
7 #
8 # Usage:
9 #   - Variables to set :
10 #      * FROM_LANG     -  From this language
11 #      * TO_LANG       -  To this language
12 #      * DICT_PREFIX   -  SRC_URI prefix, like "dictd_www.mova.org_"
13 #          * DICT_SUFFIX   -  SRC_URI after the prefix.
14
15 RESTRICT="strip"
16
17 [ -z "${DICT_SUFFIX}" ] && DICT_SUFFIX=${PN#stardict-[[:lower:]]*-}
18 [ -z "${DICT_P}" ] && DICT_P=stardict-${DICT_PREFIX}${DICT_SUFFIX}-${PV}
19
20 if [ -n "${FROM_LANG}" -a -n "${TO_LANG}" ]; then
21         DESCRIPTION="Stardict Dictionary ${FROM_LANG} to ${TO_LANG}"
22 elif [ -z "${DESCRIPTION}" ]; then
23         DESCRIPTION="Another Stardict Dictionary"
24 fi
25
26 HOMEPAGE="http://stardict.sourceforge.net/"
27 SRC_URI="mirror://sourceforge/stardict/${DICT_P}.tar.bz2"
28
29 IUSE="gzip"
30 SLOT="0"
31 LICENSE="GPL-2"
32
33 DEPEND="|| ( >=app-text/stardict-2.4.2
34                 app-text/sdcv
35                 app-text/goldendict )
36         gzip? ( app-arch/gzip
37                 app-text/dictd )"
38
39 S=${WORKDIR}/${DICT_P}
40
41 stardict_src_compile() {
42         if use gzip; then
43                 for file in *.idx; do
44                         [[ -f $file ]] && gzip ${file}
45                 done
46                 for file in *.dict; do
47                         [[ -f $file ]] && dictzip ${file}
48                 done
49         fi
50 }
51
52 stardict_src_install() {
53         insinto /usr/share/stardict/dic
54         doins *.dict.dz*
55         doins *.idx*
56         doins *.ifo
57 }
58
59 EXPORT_FUNCTIONS src_compile src_install