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