dev-python/Babel: Drop old
[gentoo.git] / kde-apps / kdepim-l10n / kdepim-l10n-15.08.0.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 KDE_HANDBOOK="true"
8 inherit kde5
9
10 DESCRIPTION="KDE PIM internationalization package"
11 HOMEPAGE="http://l10n.kde.org"
12
13 DEPEND="
14         sys-devel/gettext
15 "
16 RDEPEND="
17         !<kde-apps/kde-l10n-15.08.0-r1
18         !<kde-apps/kde4-l10n-4.14.3-r1
19         !kde-base/kdepim-l10n
20 "
21
22 KEYWORDS="~amd64 ~x86"
23 IUSE=""
24
25 # /usr/portage/distfiles $ ls -1 kde-l10n-*-${PV}.* |sed -e 's:-${PV}.tar.xz::' -e 's:kde-l10n-::' |tr '\n' ' '
26 MY_LANGS="ar bg bs ca ca@valencia cs da de el en_GB eo es et eu fa fi fr ga gl
27 he hi hr hu ia id is it ja kk km ko lt lv mr nb nds nl nn pa pl pt pt_BR ro ru
28 sk sl sr sv tr ug uk wa zh_CN zh_TW"
29
30 PIM_L10N="kdepim kdepimlibs kdepim-runtime pim"
31
32 URI_BASE="${SRC_URI/-${PV}.tar.xz/}"
33 SRC_URI=""
34
35 for MY_LANG in ${MY_LANGS} ; do
36         IUSE="${IUSE} linguas_${MY_LANG}"
37         SRC_URI="${SRC_URI} linguas_${MY_LANG}? ( ${URI_BASE/kdepim/kde}/kde-l10n-${MY_LANG}-${PV}.tar.xz )"
38 done
39
40 S="${WORKDIR}"
41
42 src_unpack() {
43         if [[ -z ${A} ]]; then
44                 elog
45                 elog "You either have the LINGUAS variable unset, or it only"
46                 elog "contains languages not supported by ${P}."
47                 elog "You won't have any additional language support."
48                 elog
49                 elog "${P} supports these language codes:"
50                 elog "${MY_LANGS}"
51                 elog
52         fi
53
54         [[ -n ${A} ]] && unpack ${A}
55 }
56
57 src_prepare() {
58         local LNG DIR
59         # add all linguas to cmake
60         if [[ -n ${A} ]]; then
61                 for LNG in ${LINGUAS}; do
62                         DIR="kde-l10n-${LNG}-${PV}"
63                         SDIR="${S}/${DIR}/5/${LNG}"
64                         if [[ -d "${DIR}" ]] ; then
65                                 echo "add_subdirectory( ${DIR} )" >> "${S}"/CMakeLists.txt
66
67                                 # Drop KDE4-based part
68                                 sed -e '/add_subdirectory(4)/ s/^/#/'\
69                                         -i "${S}"/${DIR}/CMakeLists.txt || die
70
71                                 # Remove everything except kdepim, kdepimlibs, kdepim-runtime and pim
72                                 for SUBDIR in data docs messages scripts ; do
73                                         if [[ -d "${SDIR}/${SUBDIR}" ]] ; then
74                                                 einfo "   ${SUBDIR} subdirectory"
75                                                 echo > "${SDIR}/${SUBDIR}/CMakeLists.txt"
76                                                 for pim in ${PIM_L10N}; do
77                                                         [[ -d "${SDIR}/${SUBDIR}/${pim}" ]] && \
78                                                                 ( echo "add_subdirectory(${pim})" >> "${SDIR}/${SUBDIR}/CMakeLists.txt" )
79                                                 done
80                                         fi
81                                 done
82
83                                 # In some cases we may have sub-lingua subdirs, e.g. sr :(
84                                 for XSUBDIR in "${SDIR}/${LNG}"@* ; do
85                                         XLNG=$(echo ${XSUBDIR}|sed -e 's:^.*/::')
86                                         if [[ -d "${XSUBDIR}" ]] ; then
87                                                 einfo "   ${XLNG} variant"
88                                                 # remove everything except kdepim and kdepim-runtime
89                                                 for SUBDIR in data docs messages scripts ; do
90                                                         if [[ -d "${XSUBDIR}/${SUBDIR}" ]] ; then
91                                                                 einfo "      ${SUBDIR} subdirectory"
92                                                                 echo > "${XSUBDIR}/${SUBDIR}/CMakeLists.txt"
93                                                                 for pim in ${PIM_L10N}; do
94                                                                         [[ -d "${XSUBDIR}/${SUBDIR}/${pim}" ]] && \
95                                                                                 ( echo "add_subdirectory(${pim})" >> "${XSUBDIR}/${SUBDIR}/CMakeLists.txt" )
96                                                                 done
97                                                         fi
98                                                 done
99                                         fi
100                                 done
101
102                                 # Handbook optional
103                                 sed -e '/KF5DocTools/ s/ REQUIRED//'\
104                                         -i "${SDIR}"/CMakeLists.txt || die
105                                 if ! use handbook ; then
106                                         sed -e '/add_subdirectory(docs)/ s/^/#/'\
107                                                 -i "${SDIR}"/CMakeLists.txt || die
108                                 fi
109
110                                 # Fix broken LINGUAS=sr (KDE4 leftover)
111                                 if [[ ${LNG} = "sr" ]] ; then
112                                         sed -e '/add_subdirectory(lokalize)/ s/^/#/'\
113                                                 -i "${SDIR}"/data/kdesdk/CMakeLists.txt || die
114                                 fi
115                         fi
116                 done
117         fi
118 }
119
120 src_configure() {
121         mycmakeargs=(
122                 $(cmake-utils_use_find_package handbook KF5DocTools)
123         )
124         [[ -n ${A} ]] && kde5_src_configure
125 }
126
127 src_compile() {
128         [[ -n ${A} ]] && kde5_src_compile
129 }
130
131 src_test() {
132         [[ -n ${A} ]] && kde5_src_test
133 }
134
135 src_install() {
136         [[ -n ${A} ]] && kde5_src_install
137 }