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