summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2007-08-14 18:42:22 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2007-08-14 18:42:22 +0000
commit037797d36bb694c1baae6351b9c2b8235b4b9aff (patch)
tree87722d536df846f516a8643f24417c2628936d26 /eclass/vdr-plugin.eclass
parentStable on ppc64; bug #187234 (diff)
downloadgentoo-2-037797d36bb694c1baae6351b9c2b8235b4b9aff.tar.gz
gentoo-2-037797d36bb694c1baae6351b9c2b8235b4b9aff.tar.bz2
gentoo-2-037797d36bb694c1baae6351b9c2b8235b4b9aff.zip
Support gettext for vdr-1.5.7, and also support building gettext-ready plugins with older vdrs without violating sandbox.
Diffstat (limited to 'eclass/vdr-plugin.eclass')
-rw-r--r--eclass/vdr-plugin.eclass62
1 files changed, 58 insertions, 4 deletions
diff --git a/eclass/vdr-plugin.eclass b/eclass/vdr-plugin.eclass
index 317f788e638a..3dd4c3cfa338 100644
--- a/eclass/vdr-plugin.eclass
+++ b/eclass/vdr-plugin.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.47 2007/08/14 14:47:21 zzam Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.48 2007/08/14 18:42:22 zzam Exp $
#
# Author:
# Matthias Schwarzott <zzam@gentoo.org>
@@ -177,6 +177,14 @@ vdr-plugin_pkg_setup() {
DVB_INCLUDE_DIR="/usr/include"
+ TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
+ LOCDIR="/usr/share/vdr/locale"
+ if has_version ">=media-video/vdr-1.5.7"; then
+ USE_GETTEXT=1
+ else
+ USE_GETTEXT=0
+ fi
+
VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h)
APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h)
[[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
@@ -193,13 +201,13 @@ vdr-plugin_src_unpack() {
eerror "Please report this at bugs.gentoo.org."
die "vdr-plugin_pkg_setup not called!"
fi
- [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile
+ [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile i18n
while [ "$1" ]; do
case "$1" in
all_but_unpack)
- vdr-plugin_src_unpack add_local_patch patchmakefile
+ vdr-plugin_src_unpack add_local_patch patchmakefile i18n
;;
unpack)
base_src_unpack
@@ -266,6 +274,40 @@ vdr-plugin_src_unpack() {
done
fi
;;
+ i18n)
+ cd ${S}
+ if [[ ${USE_GETTEXT} = 0 ]]; then
+ # Remove i18n Target if using older vdr
+ sed -i Makefile \
+ -e '/^all:/s/ i18n//'
+ elif [[ ${USE_GETTEXT} = 1 && ! -d po ]]; then
+ einfo "Converting translations to gettext"
+
+ local i18n_tool=/usr/share/vdr/bin/i18n-to-gettext.pl
+ if [[ ! -x ${i18n_tool} ]]; then
+ eerror "Missing ${i18n_tool}"
+ eerror "Please re-emerge vdr"
+ die "Missing ${i18n_tool}"
+ fi
+
+ # call i18n-to-gettext tool
+ # take all texts missing tr call into special file
+ ${i18n_tool} 2>/dev/null \
+ |sed -e '/^"/!d' \
+ -e '/^""$/d' \
+ -e 's/\(.*\)/trNOOP(\1)/' \
+ > dummy-translations-trNOOP.c
+
+ # if there were untranslated texts just run it again
+ # now the missing calls are listed in
+ # dummy-translations-trNOOP.c
+ if [[ -s dummy-translations-trNOOP.c ]]; then
+ ${i18n_tool} &>/dev/null
+ fi
+
+ # now use the modified Makefile
+ mv Makefile.new Makefile
+ fi
esac
shift
@@ -314,7 +356,10 @@ vdr-plugin_src_compile() {
fi
cd ${S}
- emake ${BUILD_PARAMS} ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed"
+ emake ${BUILD_PARAMS} \
+ ${VDRPLUGIN_MAKE_TARGET:-all} \
+ LOCALEDIR="${TMP_LOCALE_DIR}" \
+ || die "emake failed"
;;
esac
@@ -347,6 +392,15 @@ vdr-plugin_src_install() {
cd "${S}"
insinto "${VDR_PLUGIN_DIR}"
doins libvdr-*.so.*
+
+ if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then
+ einfo "Installing locales"
+ cd "${TMP_LOCALE_DIR}"
+ insinto "${LOCDIR}"
+ doins -r *
+ fi
+
+ cd "${S}"
local docfile
for docfile in README* HISTORY CHANGELOG; do
[[ -f ${docfile} ]] && dodoc ${docfile}