forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kde4-l10n-17.04.3.ebuild
211 lines (183 loc) · 6.16 KB
/
kde4-l10n-17.04.3.ebuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
KDE_HANDBOOK="optional"
KDE_L10N=(
ar ast bg bs ca ca-valencia cs da de el en-GB eo es et eu fa fi fr ga gl 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
sk sl sr sr-ijekavsk sr-Latn sr-Latn-ijekavsk sv tr ug uk wa zh-CN zh-TW
)
inherit kde4-base
DESCRIPTION="KDE legacy internationalization package"
HOMEPAGE="https://l10n.kde.org"
kde_l10n2lingua() {
local l
for l; do
case ${l} in
ca-valencia) echo ca@valencia;;
sr-ijekavsk) echo sr@ijekavian;;
sr-Latn-ijekavsk) echo sr@ijekavianlatin;;
sr-Latn) echo sr@latin;;
uz-Cyrl) echo uz@cyrillic;;
*) echo "${l/-/_}";;
esac
done
}
URI_BASE="${SRC_URI/kde4-l10n-${PV}.tar.xz/}kde-l10n/kde-l10n"
SRC_URI=""
for my_l10n in ${KDE_L10N[@]} ; do
case ${my_l10n} in
sr | sr-ijekavsk | sr-Latn-ijekavsk | sr-Latn)
SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${URI_BASE}-sr-${PV}.tar.xz )"
;;
*)
SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${URI_BASE}-$(kde_l10n2lingua ${my_l10n})-${PV}.tar.xz )"
;;
esac
done
unset URI_BASE
KEYWORDS="amd64 ~arm x86"
DEPEND="
sys-devel/gettext
"
RDEPEND="
!<kde-apps/akonadi-search-17.04.1:5
!kde-apps/kde-l10n:5
!<kde-apps/khelpcenter-17.04.1:5
!<kde-apps/kio-extras-17.04.1:5
!<kde-frameworks/baloo-5.34.0:5
!<kde-frameworks/baloo-widgets-5.34.0:5
!<kde-frameworks/kfilemetadata-5.34.0:5
!<kde-plasma/plasma-workspace-5.9.5.1-r1:5
"
REMOVE_DIRS="${FILESDIR}/${PN}-16.12.3-remove-dirs"
REMOVE_MSGS="${FILESDIR}/${P}-remove-messages"
IUSE="test $(printf 'l10n_%s ' ${KDE_L10N[@]})"
S="${WORKDIR}"
pkg_setup() {
if [[ -z ${A} ]]; then
elog
elog "None of the requested L10N are supported by ${P}."
elog
elog "${P} supports these language codes:"
elog "${KDE_L10N[@]}"
elog
fi
[[ -n ${A} ]] && kde4-base_pkg_setup
}
src_unpack() {
for my_tar in ${A}; do
tar -xpf "${DISTDIR}/${my_tar}" --xz \
"${my_tar/.tar.xz/}/CMakeLists.txt" "${my_tar/.tar.xz/}/4" 2> /dev/null ||
elog "${my_tar}: tar extract command failed at least partially - continuing"
done
}
src_prepare() {
# move known variant subdirs to root dir, currently sr@*
use_if_iuse l10n_sr-ijekavsk && l10n_variant_subdir2root sr-ijekavsk sr
use_if_iuse l10n_sr-Latn-ijekavsk && l10n_variant_subdir2root sr-Latn-ijekavsk sr
use_if_iuse l10n_sr-Latn && l10n_variant_subdir2root sr-Latn sr
if use_if_iuse l10n_sr; then
rm -rf kde-l10n-sr-${PV}/4/sr/sr@* || die "Failed to cleanup L10N=sr"
l10n_variant_subdir_buster sr
elif [[ -d kde-l10n-sr-${PV} ]]; then
# having any variant selected means parent lingua will be unpacked as well
rm -r kde-l10n-sr-${PV} || die "Failed to remove sr parent lingua"
fi
cat <<-EOF > CMakeLists.txt || die
project(${PN})
cmake_minimum_required(VERSION 2.8.12)
EOF
# add all l10n directories to cmake
if [[ -n ${A} ]]; then
cat <<-EOF >> CMakeLists.txt || die
$(printf "add_subdirectory( %s )\n" \
`find . -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"`)
EOF
fi
kde4-base_src_prepare
[[ -n ${A} ]] || return
einfo "Removing file collisions with Plasma 5 and Applications"
[[ -f ${REMOVE_DIRS} ]] || die "Error: ${REMOVE_DIRS} not found!"
[[ -f ${REMOVE_MSGS} ]] || die "Error: ${REMOVE_MSGS} not found!"
use test && einfo "Tests enabled: Listing LINGUAS causing file collisions"
einfo "Directories..."
while read path; do
if use test ; then # build a report w/ L10N="*" to submit @upstream
local lngs
for lng in $(kde_l10n2lingua ${KDE_L10N[@]}); do
SDIR="${S}/${KMNAME}-${lng}-${PV}/4/${lng}"
if [[ -d "${SDIR}"/${path%\ *}/${path#*\ } ]] ; then
lngs+=" ${lng}"
fi
done
[[ -n "${lngs}" ]] && einfo "${path%\ *}/${path#*\ }${lngs}"
unset lngs
fi
if ls -U ./*/4/*/${path%\ *}/${path#*\ } > /dev/null 2>&1; then
sed -e "\:add_subdirectory(\s*${path#*\ }\s*): s:^:#:" \
-i ./*/4/*/${path%\ *}/CMakeLists.txt || \
die "Failed to comment out ${path}"
else
einfo "F: ${path}" # run with L10N="*" to cut down list
fi
done < <(grep -ve "^$\|^\s*\#" "${REMOVE_DIRS}")
einfo
einfo "Messages..."
while read path; do
if use test ; then # build a report w/ L10N="*" to submit @upstream
local lngs
for lng in $(kde_l10n2lingua ${KDE_L10N[@]}); do
SDIR="${S}/${KMNAME}-${lng}-${PV}/4/${lng}"
if [[ -e "${SDIR}"/messages/${path} ]] ; then
lngs+=" ${lng}"
fi
done
[[ -n "${lngs}" ]] && einfo "${path}${lngs}"
unset lngs
fi
if ls -U ./*/4/*/messages/${path} > /dev/null 2>&1; then
rm ./*/4/*/messages/${path} || die "Failed to remove ${path}"
else
einfo "F: ${path}" # run with L10N="*" to cut down list
fi
done < <(grep -ve "^$\|^\s*\#" "${REMOVE_MSGS}")
}
src_configure() {
local mycmakeargs=(
-DBUILD_docs=$(usex handbook)
)
[[ -n ${A} ]] && kde4-base_src_configure
}
src_compile() {
[[ -n ${A} ]] && kde4-base_src_compile
}
src_test() { :; }
src_install() {
[[ -n ${A} ]] && kde4-base_src_install
}
l10n_variant_subdir2root() {
local lingua=$(kde_l10n2lingua ${1})
local src=kde-l10n-${2}-${PV}
local dest=kde-l10n-${lingua}-${PV}/4
# create variant rootdir structure from parent lingua and adapt it
mkdir -p ${dest} || die "Failed to create ${dest}"
mv ${src}/4/${2}/${lingua} ${dest}/${lingua} || die "Failed to create ${dest}/${lingua}"
cp -f ${src}/CMakeLists.txt kde-l10n-${lingua}-${PV} || die "Failed to prepare L10N=${1} subdir"
echo "add_subdirectory(${lingua})" > ${dest}/CMakeLists.txt ||
die "Failed to prepare ${dest}/CMakeLists.txt"
cp -f ${src}/4/${2}/CMakeLists.txt ${dest}/${lingua} ||
die "Failed to create ${dest}/${lingua}/CMakeLists.txt"
sed -e "s/${2}/${lingua}/" -i ${dest}/${lingua}/CMakeLists.txt ||
die "Failed to prepare ${dest}/${lingua}/CMakeLists.txt"
l10n_variant_subdir_buster ${1}
}
l10n_variant_subdir_buster() {
local dir=kde-l10n-$(kde_l10n2lingua ${1})-${PV}/4/$(kde_l10n2lingua ${1})
sed -e "/^macro.*subdirectory(/d" -i ${dir}/CMakeLists.txt || die "Failed to cleanup ${dir} subdir"
for subdir in $(find ${dir} -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"); do
if [[ ${subdir##*/} != "cmake_modules" ]] ; then
echo "add_subdirectory(${subdir##*/})" >> ${dir}/CMakeLists.txt || die
fi
done
}