| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.55 2008/04/13 16:26:05 zzam Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.58 2008/04/22 11:04:05 zzam Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: |
5 | # Author: |
| 6 | # Matthias Schwarzott <zzam@gentoo.org> |
6 | # Matthias Schwarzott <zzam@gentoo.org> |
| 7 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
7 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
| 8 | |
8 | |
| … | |
… | |
| 213 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
213 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
| 214 | done |
214 | done |
| 215 | fi |
215 | fi |
| 216 | } |
216 | } |
| 217 | |
217 | |
|
|
218 | vdr_has_gettext() { |
|
|
219 | has_version ">=media-video/vdr-1.5.7" |
|
|
220 | } |
|
|
221 | |
|
|
222 | plugin_has_gettext() { |
|
|
223 | [[ -d po ]] |
|
|
224 | } |
|
|
225 | |
|
|
226 | vdr_i18n_convert_to_gettext() { |
|
|
227 | local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
|
|
228 | |
|
|
229 | if [[ ${NO_GETTEXT_HACK} == "1" ]]; then |
|
|
230 | ewarn "Conversion to gettext disabled in ebuild" |
|
|
231 | return 1 |
|
|
232 | fi |
|
|
233 | |
|
|
234 | if [[ ! -x ${i18n_tool} ]]; then |
|
|
235 | eerror "Missing ${i18n_tool}" |
|
|
236 | eerror "Please re-emerge vdr" |
|
|
237 | die "Missing ${i18n_tool}" |
|
|
238 | fi |
|
|
239 | |
|
|
240 | ebegin "Auto converting translations to gettext" |
|
|
241 | # call i18n-to-gettext tool |
|
|
242 | # take all texts missing tr call into special file |
|
|
243 | "${i18n_tool}" 2>/dev/null \ |
|
|
244 | |sed -e '/^"/!d' \ |
|
|
245 | -e '/^""$/d' \ |
|
|
246 | -e 's/\(.*\)/trNOOP(\1)/' \ |
|
|
247 | > dummy-translations-trNOOP.c |
|
|
248 | |
|
|
249 | # if there were untranslated texts just run it again |
|
|
250 | # now the missing calls are listed in |
|
|
251 | # dummy-translations-trNOOP.c |
|
|
252 | if [[ -s dummy-translations-trNOOP.c ]]; then |
|
|
253 | "${i18n_tool}" &>/dev/null |
|
|
254 | fi |
|
|
255 | |
|
|
256 | # now use the modified Makefile |
|
|
257 | if [[ -f Makefile.new ]]; then |
|
|
258 | mv Makefile.new Makefile |
|
|
259 | eend 0 "" |
|
|
260 | else |
|
|
261 | eend 1 "Conversion to gettext failed. Plugin needs fixing." |
|
|
262 | return 1 |
|
|
263 | fi |
|
|
264 | } |
|
|
265 | |
|
|
266 | vdr_i18n_disable_gettext() { |
|
|
267 | ebegin "Disabling gettext support in plugin" |
|
|
268 | # Remove i18n Target if using older vdr |
|
|
269 | sed -i Makefile \ |
|
|
270 | -e '/^all:/s/ i18n//' |
|
|
271 | eend 0 |
|
|
272 | } |
|
|
273 | |
| 218 | vdr_i18n() { |
274 | vdr_i18n() { |
| 219 | if [[ ${USE_GETTEXT} = 0 ]]; then |
275 | if vdr_has_gettext; then |
| 220 | # Remove i18n Target if using older vdr |
276 | einfo "VDR has gettext support" |
| 221 | sed -i Makefile \ |
277 | if plugin_has_gettext; then |
| 222 | -e '/^all:/s/ i18n//' |
278 | einfo "Plugin has gettext support, fine" |
| 223 | elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then |
279 | else |
| 224 | einfo "Plugin is not yet changed for new translation system." |
280 | vdr_i18n_convert_to_gettext |
| 225 | einfo "Auto converting translations to gettext" |
281 | if [[ $? != 0 ]]; then |
| 226 | |
282 | eerror "" |
| 227 | local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
283 | eerror "Plugin will have only english OSD texts" |
| 228 | if [[ ! -x ${i18n_tool} ]]; then |
284 | eerror "it needs manual fixing." |
| 229 | eerror "Missing ${i18n_tool}" |
285 | fi |
| 230 | eerror "Please re-emerge vdr" |
|
|
| 231 | die "Missing ${i18n_tool}" |
|
|
| 232 | fi |
286 | fi |
| 233 | |
|
|
| 234 | # call i18n-to-gettext tool |
|
|
| 235 | # take all texts missing tr call into special file |
|
|
| 236 | "${i18n_tool}" 2>/dev/null \ |
|
|
| 237 | |sed -e '/^"/!d' \ |
|
|
| 238 | -e '/^""$/d' \ |
|
|
| 239 | -e 's/\(.*\)/trNOOP(\1)/' \ |
|
|
| 240 | > dummy-translations-trNOOP.c |
|
|
| 241 | |
|
|
| 242 | # if there were untranslated texts just run it again |
|
|
| 243 | # now the missing calls are listed in |
|
|
| 244 | # dummy-translations-trNOOP.c |
|
|
| 245 | if [[ -s dummy-translations-trNOOP.c ]]; then |
|
|
| 246 | "${i18n_tool}" &>/dev/null |
|
|
| 247 | fi |
|
|
| 248 | |
|
|
| 249 | # now use the modified Makefile |
|
|
| 250 | if [[ -f Makefile.new ]]; then |
|
|
| 251 | mv Makefile.new Makefile |
|
|
| 252 | else |
287 | else |
| 253 | ewarn "Conversion to gettext failed. Plugin needs fixing." |
288 | einfo "VDR has no gettext support" |
|
|
289 | if plugin_has_gettext; then |
|
|
290 | vdr_i18n_disable_gettext |
| 254 | fi |
291 | fi |
| 255 | fi |
292 | fi |
| 256 | } |
293 | } |
| 257 | |
294 | |
| 258 | vdr-plugin_copy_source_tree() { |
295 | vdr-plugin_copy_source_tree() { |
| … | |
… | |
| 304 | DVB_INCLUDE_DIR="/usr/include" |
341 | DVB_INCLUDE_DIR="/usr/include" |
| 305 | |
342 | |
| 306 | |
343 | |
| 307 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
344 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
| 308 | LOCDIR="/usr/share/vdr/locale" |
345 | LOCDIR="/usr/share/vdr/locale" |
| 309 | if has_version ">=media-video/vdr-1.5.7"; then |
|
|
| 310 | USE_GETTEXT=1 |
|
|
| 311 | else |
|
|
| 312 | USE_GETTEXT=0 |
|
|
| 313 | fi |
|
|
| 314 | |
346 | |
| 315 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
347 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 316 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
348 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 317 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
349 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
| 318 | |
350 | |
| … | |
… | |
| 412 | |
444 | |
| 413 | cd "${S}" |
445 | cd "${S}" |
| 414 | insinto "${VDR_PLUGIN_DIR}" |
446 | insinto "${VDR_PLUGIN_DIR}" |
| 415 | doins libvdr-*.so.* |
447 | doins libvdr-*.so.* |
| 416 | |
448 | |
| 417 | if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then |
449 | if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then |
| 418 | einfo "Installing locales" |
450 | einfo "Installing locales" |
| 419 | cd "${TMP_LOCALE_DIR}" |
451 | cd "${TMP_LOCALE_DIR}" |
| 420 | insinto "${LOCDIR}" |
452 | insinto "${LOCDIR}" |
| 421 | doins -r * |
453 | doins -r * |
| 422 | fi |
454 | fi |