1 |
%define thunderbird_package thunderbird |
2 |
|
3 |
%define name thunderbird-l10n |
4 |
%define oname thunderbird |
5 |
%define version 10.0.12 |
6 |
%define release %mkrel 1 |
7 |
|
8 |
%define thunderbird_epoch 0 |
9 |
%define thunderbird_version %{version} |
10 |
|
11 |
%define up_ca_name thunderbird |
12 |
%define lib_name %{up_ca_name}-%{version} |
13 |
%define mozillalibdir %{_libdir}/%{lib_name} |
14 |
%define tb_appid \{3550f703-e582-4d05-9a08-453d09bdfdc6\} |
15 |
%define tbextdir %{_datadir}/mozilla/extensions/%{tb_appid} |
16 |
|
17 |
%define xpidir ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/%{thunderbird_version}esr/linux-i686/xpi/ |
18 |
|
19 |
# Supported l10n language lists |
20 |
%define langlist ar ast be bg bn_BD br ca cs da de el en_GB es_AR es_ES et eu fi fr fy ga gd gl he hu id is it ja ko lt nb_NO nl nn_NO pl pa_IN pt_BR pt_PT rm ro ru si sk sl sq sv_SE ta_LK tr uk vi zh_CN zh_TW |
21 |
|
22 |
# Disabled l10n languages, for any reason |
23 |
%define disabled_langlist gu_IN mk rm sr af |
24 |
|
25 |
# Disabled myspell dicts, for any reason |
26 |
%define disabled_dict_langlist ar be br_FR es_AR eu fi fy ga gu_IN he ja ko mk ta_LK tr zh_CN zh_TW |
27 |
|
28 |
%define use_dict 1 |
29 |
|
30 |
# Language descriptions |
31 |
%define language_af af |
32 |
%define langname_af Afrikaans |
33 |
%define language_ar ar |
34 |
%define langname_ar Arabic |
35 |
%define language_ast ast |
36 |
%define langname_ast Asturian |
37 |
%define language_be be |
38 |
%define langname_be Belarusian |
39 |
%define language_bg bg |
40 |
%define langname_bg Bulgarian |
41 |
%define language_bn_BD bn-BD |
42 |
%define langname_bn_BD Bengali (Bangla) |
43 |
%define language_br br |
44 |
%define langname_br Breton |
45 |
%define language_ca ca |
46 |
%define langname_ca Catalan |
47 |
%define language_cs cs |
48 |
%define langname_cs Czech |
49 |
%define language_da da |
50 |
%define langname_da Dansk |
51 |
%define language_de de |
52 |
%define langname_de German |
53 |
%define language_el el |
54 |
%define langname_el Greek |
55 |
%define language_en_GB en-GB |
56 |
%define langname_en_GB British English |
57 |
%define language_es_AR es-AR |
58 |
%define langname_es_AR Spanish (Argentina) |
59 |
%define language_es_ES es-ES |
60 |
%define langname_es_ES Spanish |
61 |
%define language_et_EE et-EE |
62 |
%define langname_et_EE Estonian (Magento) |
63 |
%define language_et et |
64 |
%define langname_et Estonian |
65 |
%define language_eu eu |
66 |
%define langname_eu Basque |
67 |
%define language_fi fi |
68 |
%define langname_fi Finnish |
69 |
%define language_fr fr |
70 |
%define langname_fr French |
71 |
%define language_fy fy-NL |
72 |
%define langname_fy Frisian |
73 |
%define language_ga ga-IE |
74 |
%define langname_ga Irish |
75 |
%define language_gd gd |
76 |
%define langname_gd Scottish Gaelic |
77 |
%define language_gl gl |
78 |
%define langname_gl Galician |
79 |
%define language_gu_IN gu-IN |
80 |
%define langname_gu_IN Gujarati |
81 |
%define language_he he |
82 |
%define langname_he Hebrew |
83 |
%define language_hu hu |
84 |
%define langname_hu Hungarian |
85 |
%define language_id id |
86 |
%define langname_id Indonesian |
87 |
%define language_is is |
88 |
%define langname_is Icelandic |
89 |
%define language_it it |
90 |
%define langname_it Italian |
91 |
%define language_ja ja |
92 |
%define langname_ja Japanese |
93 |
%define language_ka ka |
94 |
%define langname_ka Georgian |
95 |
%define language_ko ko |
96 |
%define langname_ko Korean |
97 |
%define language_lt lt |
98 |
%define langname_lt Lithuanian |
99 |
%define language_mk mk |
100 |
%define langname_mk Macedonian |
101 |
%define language_nb_NO nb-NO |
102 |
%define langname_nb_NO Norwegian Bokmaal |
103 |
%define language_nn_NO nn-NO |
104 |
%define langname_nn_NO Norwegian Nynorsk |
105 |
%define language_nl nl |
106 |
%define langname_nl Dutch |
107 |
%define language_pa_IN pa-IN |
108 |
%define langname_pa_IN Punjabi (gurmukhi) |
109 |
%define language_pl pl |
110 |
%define langname_pl Polish |
111 |
%define language_pt_BR pt-BR |
112 |
%define langname_pt_BR Brazilian portuguese |
113 |
%define language_pt_PT pt-PT |
114 |
%define langname_pt_PT Portuguese |
115 |
%define language_rm rm |
116 |
%define langname_rm Romansh |
117 |
%define language_ro ro |
118 |
%define langname_ro Romanian |
119 |
%define language_ru ru |
120 |
%define langname_ru Russian |
121 |
%define language_si si |
122 |
%define langname_si Sinhala |
123 |
%define language_sk sk |
124 |
%define langname_sk Slovak |
125 |
%define language_sq sq |
126 |
%define langname_sq Albanian |
127 |
%define language_sl sl |
128 |
%define langname_sl Slovenian |
129 |
%define language_sr sr |
130 |
%define langname_sr Serbian |
131 |
%define language_sv_SE sv-SE |
132 |
%define langname_sv_SE Swedish |
133 |
%define language_ta_LK ta-LK |
134 |
%define langname_ta_LK Tamil (Sri-Lanka) |
135 |
%define language_tr tr |
136 |
%define langname_tr Turkish |
137 |
%define language_uk uk |
138 |
%define langname_uk Ukrainian |
139 |
%define language_vi vi |
140 |
%define langname_vi Vietnamese |
141 |
%define language_zh_CN zh-CN |
142 |
%define langname_zh_CN Simplified Chinese |
143 |
%define language_zh_TW zh-TW |
144 |
%define langname_zh_TW Traditional Chinese |
145 |
|
146 |
# --- Danger line --- |
147 |
|
148 |
# Defaults (all languages enabled by default) |
149 |
# l10n |
150 |
%{expand:%(for lang in %langlist; do echo "%%define with_$lang 1"; done)} |
151 |
%{expand:%(for lang in %disabled_langlist; do echo "%%define with_$lang 0"; done)} |
152 |
# dicts |
153 |
%{expand:%(for lang in %langlist; do echo "%%define with_dict_$lang %{use_dict}"; done)} |
154 |
%{expand:%(for lang in %disabled_dict_langlist; do echo "%%define with_dict_$lang 0"; done)} |
155 |
|
156 |
# Locales |
157 |
%{expand:%(for lang in %langlist; do echo "%%define locale_$lang `echo $lang | cut -d _ -f 1` "; done)} |
158 |
|
159 |
%if %use_dict |
160 |
# hunspell dicts, allows setting preferences between several providers. |
161 |
%{expand:%(for lang in %langlist; do echo "%%define hunspell_$lang hunspell-$lang"; done)} |
162 |
%endif |
163 |
|
164 |
Summary: Localizations for Thunderbird (virtual package) |
165 |
Name: %{name} |
166 |
Version: %{version} |
167 |
Release: %{release} |
168 |
License: GPL |
169 |
Group: Networking/WWW |
170 |
Url: http://www.mozilla.org/ |
171 |
BuildArch: noarch |
172 |
BuildRequires: libxml2-utils |
173 |
# Language package template |
174 |
Source0: %{name}-template.in |
175 |
# l10n sources |
176 |
%{expand:%(\ |
177 |
i=1;\ |
178 |
for lang in %langlist; do\ |
179 |
echo "%%{expand:Source$i: %{xpidir}/%%{language_$lang}.xpi}";\ |
180 |
i=$[i+1];\ |
181 |
done\ |
182 |
) |
183 |
} |
184 |
|
185 |
%description |
186 |
Localizations for Thunderbird |
187 |
|
188 |
|
189 |
# Expand all languages packages. |
190 |
%{expand:%(\ |
191 |
for lang in %langlist; do\ |
192 |
echo "%%{expand:%%(sed "s!__LANG__!$lang!g" %{_sourcedir}/%{name}-template.in 2> /dev/null)}";\ |
193 |
done\ |
194 |
) |
195 |
} |
196 |
|
197 |
%prep |
198 |
%setup -q -c -T |
199 |
|
200 |
# Convert rpm macros to bash variables |
201 |
%{expand:%(for lang in %langlist; do echo "language_$lang=%%{language_$lang}"; done)} |
202 |
%{expand:%(for lang in %langlist; do echo "locale_$lang=%%{locale_$lang}"; done)} |
203 |
%{expand:%(for lang in %langlist; do echo "with_$lang=%%{with_$lang}"; done)} |
204 |
%{expand:%(for lang in %langlist; do echo "dict_$lang=%%{with_dict_$lang}"; done)} |
205 |
|
206 |
# Unpack all languages |
207 |
for lang in %langlist; do |
208 |
with="with_$lang" |
209 |
with=${!with} |
210 |
[ $with -eq 0 ] && continue |
211 |
|
212 |
language="language_$lang" |
213 |
language=${!language} |
214 |
|
215 |
locale="locale_$lang" |
216 |
locale=${!locale} |
217 |
|
218 |
# l10n |
219 |
mkdir ${language} |
220 |
cd ${language} |
221 |
unzip -qq %{_sourcedir}/${language}.xpi |
222 |
cd .. |
223 |
|
224 |
# dict |
225 |
dict="dict_$lang" |
226 |
dict=${!dict} |
227 |
[ $dict -eq 0 ] && continue |
228 |
|
229 |
done |
230 |
|
231 |
# Patches |
232 |
|
233 |
%check |
234 |
# All install.rdf files must validate |
235 |
xmllint --noout */install.rdf |
236 |
|
237 |
%install |
238 |
# Convert rpm macros to bash variables |
239 |
%{expand:%(for lang in %langlist; do echo "language_$lang=%%{language_$lang}"; done)} |
240 |
%{expand:%(for lang in %langlist; do echo "with_$lang=%%{with_$lang}"; done)} |
241 |
%{expand:%(for lang in %langlist; do echo "dict_$lang=%%{with_dict_$lang}"; done)} |
242 |
|
243 |
# Create dicts dir |
244 |
%if %use_dict |
245 |
mkdir -p %buildroot%{mozillalibdir}/dictionaries |
246 |
%endif |
247 |
|
248 |
mkdir -p %buildroot%{tbextdir} |
249 |
|
250 |
# Install all languages |
251 |
for lang in %langlist; do |
252 |
with="with_$lang" |
253 |
with=${!with} |
254 |
[ $with -eq 0 ] && continue |
255 |
|
256 |
language="language_$lang" |
257 |
language=${!language} |
258 |
|
259 |
# l10n |
260 |
cp %_sourcedir/${language}.xpi %buildroot%{tbextdir}/langpack-${language}@thunderbird.mozilla.org.xpi |
261 |
|
262 |
done |