Gentoo Archives: gentoo-commits

From: Johannes Huber <johu@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/kde:master commit in: kde-apps/kde4-l10n/files/, eclass/
Date: Wed, 13 Jul 2016 18:23:38
Message-Id: 1468434112.2735d6b7ff0f201c36ffed7055032cf540dfcf82.johu@gentoo
1 commit: 2735d6b7ff0f201c36ffed7055032cf540dfcf82
2 Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
3 AuthorDate: Sun Jul 10 15:56:43 2016 +0000
4 Commit: Johannes Huber <johu <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 13 18:21:52 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=2735d6b7
7
8 kde5.eclass: Add KDEBASE=kdel10n and helper functions
9
10 Signed-off-by: Johannes Huber <johu <AT> gentoo.org>
11
12 eclass/kde5.eclass | 90 ++++++++++++++++++++++
13 .../kde4-l10n/files/kde4-l10n-16.04.2-remove-dirs | 44 +++++++++++
14 2 files changed, 134 insertions(+)
15
16 diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass
17 index b285f6d..763029c 100644
18 --- a/eclass/kde5.eclass
19 +++ b/eclass/kde5.eclass
20 @@ -99,6 +99,16 @@ else
21 : ${KDE_TEST:=false}
22 fi
23
24 +# @ECLASS-VARIABLE: KDE_L10N
25 +# @DESCRIPTION:
26 +# This is an array of translations this ebuild supports. These translations
27 +# are automatically added to IUSE.
28 +if [[ ${KDEBASE} = kdel10n ]]; then
29 + if [[ -n ${KDE_L10N} ]]; then
30 + IUSE="${IUSE} $(printf 'l10n_%s ' ${KDE_L10N[@]})"
31 + fi
32 +fi
33 +
34 # @ECLASS-VARIABLE: KDE_PIM_KEEP_SUBDIR
35 # @DESCRIPTION:
36 # If building a split package from KMNAME="kdepim", provide a list of
37 @@ -129,6 +139,8 @@ KDE_UNRELEASED=( )
38
39 if [[ ${KDEBASE} = kdevelop ]]; then
40 HOMEPAGE="https://www.kdevelop.org/"
41 +elif [[ ${KDEBASE} = kdel10n ]]; then
42 + HOMEPAGE="http://l10n.kde.org"
43 elif [[ ${KMNAME} = kdepim ]]; then
44 HOMEPAGE="https://www.kde.org/applications/office/kontact/"
45 else
46 @@ -331,6 +343,21 @@ _calculate_src_uri() {
47 esac
48 fi
49
50 + if [[ ${KDEBASE} = kdel10n ]] ; then
51 + local uri_base="${SRC_URI/${PN}-${PV}.tar.xz/}kde-l10n/kde-l10n"
52 + SRC_URI=""
53 + for my_l10n in ${KDE_L10N[@]} ; do
54 + case ${my_l10n} in
55 + sr | sr-ijekavsk | sr-Latn-ijekavsk | sr-Latn)
56 + SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${uri_base}-sr-${PV}.tar.xz )"
57 + ;;
58 + *)
59 + SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${uri_base}-$(kde_l10n2lingua ${my_l10n})-${PV}.tar.xz )"
60 + ;;
61 + esac
62 + done
63 + fi
64 +
65 if _kde_is_unreleased ; then
66 RESTRICT+=" fetch"
67 fi
68 @@ -443,6 +470,14 @@ kde5_src_unpack() {
69 git-r3_src_unpack
70 ;;
71 esac
72 + elif [[ ${KDEBASE} = kdel10n ]]; then
73 + mkdir -p "${S}" || die "Failed to create source dir ${S}"
74 + cd "${S}"
75 + for my_tar in ${A}; do
76 + tar -xpf "${DISTDIR}/${my_tar}" --xz \
77 + "${my_tar/.tar.xz/}/CMakeLists.txt" "${my_tar/.tar.xz/}/5" 2> /dev/null ||
78 + elog "${my_tar}: tar extract command failed at least partially - continuing"
79 + done
80 else
81 default
82 fi
83 @@ -454,6 +489,32 @@ kde5_src_unpack() {
84 kde5_src_prepare() {
85 debug-print-function ${FUNCNAME} "$@"
86
87 + if [[ ${KDEBASE} = kdel10n ]]; then
88 + # move known variant subdirs to root dir, currently sr@*
89 + use_if_iuse l10n_sr-ijekavsk && _l10n_variant_subdir2root sr-ijekavsk sr
90 + use_if_iuse l10n_sr-Latn-ijekavsk && _l10n_variant_subdir2root sr-Latn-ijekavsk sr
91 + use_if_iuse l10n_sr-Latn && _l10n_variant_subdir2root sr-Latn sr
92 + if use_if_iuse l10n_sr; then
93 + rm -rf kde-l10n-sr-${PV}/5/sr/sr@* || die "Failed to cleanup L10N=sr"
94 + _l10n_variant_subdir_buster sr
95 + elif [[ -d kde-l10n-sr-${PV} ]]; then
96 + # having any variant selected means parent lingua will be unpacked as well
97 + rm -r kde-l10n-sr-${PV} || die "Failed to remove sr parent lingua"
98 + fi
99 +
100 + # add all l10n directories to cmake
101 + cat <<-EOF > CMakeLists.txt || die
102 +project(${PN})
103 +cmake_minimum_required(VERSION 2.8.12)
104 +$(printf "add_subdirectory( %s )\n" \
105 + `find . -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"`)
106 +EOF
107 +
108 + # drop KDE4-based part
109 + find -maxdepth 2 -type f -name CMakeLists.txt -exec \
110 + sed -i -e "/add_subdirectory(4)/ s/^/#DONT/" {} + || die
111 + fi
112 +
113 cmake-utils_src_prepare
114
115 # only build examples when required
116 @@ -729,4 +790,33 @@ kde5_pkg_postrm() {
117 xdg_pkg_postrm
118 }
119
120 +_l10n_variant_subdir2root() {
121 + local lingua=$(kde_l10n2lingua ${1})
122 + local src=kde-l10n-${2}-${PV}
123 + local dest=kde-l10n-${lingua}-${PV}/5
124 +
125 + # create variant rootdir structure from parent lingua and adapt it
126 + mkdir -p ${dest} || die "Failed to create ${dest}"
127 + mv ${src}/5/${2}/${lingua} ${dest}/${lingua} || die "Failed to create ${dest}/${lingua}"
128 + cp -f ${src}/CMakeLists.txt kde-l10n-${lingua}-${PV} || die "Failed to prepare L10N=${1} subdir"
129 + echo "add_subdirectory(${lingua})" > ${dest}/CMakeLists.txt ||
130 + die "Failed to prepare ${dest}/CMakeLists.txt"
131 + cp -f ${src}/5/${2}/CMakeLists.txt ${dest}/${lingua} ||
132 + die "Failed to create ${dest}/${lingua}/CMakeLists.txt"
133 + sed -e "s/${2}/${lingua}/" -i ${dest}/${lingua}/CMakeLists.txt ||
134 + die "Failed to prepare ${dest}/${lingua}/CMakeLists.txt"
135 +
136 + _l10n_variant_subdir_buster ${1}
137 +}
138 +
139 +_l10n_variant_subdir_buster() {
140 + local dir=kde-l10n-$(kde_l10n2lingua ${1})-${PV}/5/$(kde_l10n2lingua ${1})
141 +
142 + sed -e "/^add_subdirectory(/d" -i ${dir}/CMakeLists.txt || die "Failed to cleanup ${dir} subdir"
143 +
144 + for subdir in $(find ${dir} -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"); do
145 + echo "add_subdirectory(${subdir##*/})" >> ${dir}/CMakeLists.txt
146 + done
147 +}
148 +
149 fi
150
151 diff --git a/kde-apps/kde4-l10n/files/kde4-l10n-16.04.2-remove-dirs b/kde-apps/kde4-l10n/files/kde4-l10n-16.04.2-remove-dirs
152 new file mode 100644
153 index 0000000..f09bf82
154 --- /dev/null
155 +++ b/kde-apps/kde4-l10n/files/kde4-l10n-16.04.2-remove-dirs
156 @@ -0,0 +1,44 @@
157 +# Disable any subdirectories listed here. Comments are ignored
158 +# First argument: parent directory
159 +# Second argument: which subdirectory to disable in CMakeLists.txt
160 +# kde-l10n 5
161 +data/kdeedu khangman
162 +docs/applications kate
163 +docs/applications konsole
164 +docs/applications kwrite
165 +docs/kde-runtime glossary
166 +docs/kde-runtime khelpcenter
167 +docs/kdeedu kig
168 +docs/kdeedu parley
169 +docs/kdeedu step
170 +docs/kdegames bomber
171 +docs/kdegraphics gwenview
172 +docs/kdegraphics kruler
173 +docs/kdesdk kapptemplate
174 +docs/kdesdk okteta
175 +docs/kdesdk umbrello
176 +docs/kdeutils kwalletmanager
177 +scripts kdeedu
178 +# Plasma 5
179 +docs kde-workspace
180 +docs/kde-runtime fundamentals
181 +docs/kde-runtime kdesu
182 +docs/kde-runtime khelpcenter
183 +docs/kde-runtime knetattach
184 +docs/kde-runtime onlinehelp
185 +docs/kde-runtime/kcontrol bookmarks
186 +docs/kde-runtime/kcontrol cookies
187 +docs/kde-runtime/kcontrol ebrowsing
188 +docs/kde-runtime/kcontrol emoticons
189 +docs/kde-runtime/kcontrol icons
190 +docs/kde-runtime/kcontrol kcmcgi
191 +docs/kde-runtime/kcontrol kcm_ssl
192 +docs/kde-runtime/kcontrol nepomuk
193 +docs/kde-runtime/kcontrol smb
194 +docs/kde-runtime/kcontrol trash
195 +docs/kde-runtime/kcontrol useragent
196 +messages kde-workspace
197 +messages kdeplasma-addons
198 +# kdepim-l10n 5
199 +docs kdepim
200 +docs kdepimlibs