| 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.59 2008/04/23 13:56:20 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 | |
| … | |
… | |
| 168 | -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ |
168 | -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ |
| 169 | -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \ |
169 | -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \ |
| 170 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
170 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
| 171 | -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \ |
171 | -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \ |
| 172 | -e "/^DVBDIR/d" \ |
172 | -e "/^DVBDIR/d" \ |
| 173 | -e 's:-I$(DVBDIR)/include::' |
173 | -e 's:-I$(DVBDIR)/include::' \ |
|
|
174 | -e 's:-I$(DVBDIR)::' |
| 174 | eend $? |
175 | eend $? |
| 175 | |
176 | |
| 176 | # maybe needed for multiproto: |
177 | # maybe needed for multiproto: |
| 177 | #sed -i Makefile \ |
178 | #sed -i Makefile \ |
| 178 | # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
179 | # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| … | |
… | |
| 213 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
214 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
| 214 | done |
215 | done |
| 215 | fi |
216 | fi |
| 216 | } |
217 | } |
| 217 | |
218 | |
|
|
219 | vdr_has_gettext() { |
|
|
220 | has_version ">=media-video/vdr-1.5.7" |
|
|
221 | } |
|
|
222 | |
|
|
223 | plugin_has_gettext() { |
|
|
224 | [[ -d po ]] |
|
|
225 | } |
|
|
226 | |
|
|
227 | vdr_i18n_convert_to_gettext() { |
|
|
228 | local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
|
|
229 | |
|
|
230 | if [[ ${NO_GETTEXT_HACK} == "1" ]]; then |
|
|
231 | ewarn "Conversion to gettext disabled in ebuild" |
|
|
232 | return 1 |
|
|
233 | fi |
|
|
234 | |
|
|
235 | if [[ ! -x ${i18n_tool} ]]; then |
|
|
236 | eerror "Missing ${i18n_tool}" |
|
|
237 | eerror "Please re-emerge vdr" |
|
|
238 | die "Missing ${i18n_tool}" |
|
|
239 | fi |
|
|
240 | |
|
|
241 | ebegin "Auto converting translations to gettext" |
|
|
242 | # call i18n-to-gettext tool |
|
|
243 | # take all texts missing tr call into special file |
|
|
244 | "${i18n_tool}" 2>/dev/null \ |
|
|
245 | |sed -e '/^"/!d' \ |
|
|
246 | -e '/^""$/d' \ |
|
|
247 | -e 's/\(.*\)/trNOOP(\1)/' \ |
|
|
248 | > dummy-translations-trNOOP.c |
|
|
249 | |
|
|
250 | # if there were untranslated texts just run it again |
|
|
251 | # now the missing calls are listed in |
|
|
252 | # dummy-translations-trNOOP.c |
|
|
253 | if [[ -s dummy-translations-trNOOP.c ]]; then |
|
|
254 | "${i18n_tool}" &>/dev/null |
|
|
255 | fi |
|
|
256 | |
|
|
257 | # now use the modified Makefile |
|
|
258 | if [[ -f Makefile.new ]]; then |
|
|
259 | mv Makefile.new Makefile |
|
|
260 | eend 0 "" |
|
|
261 | else |
|
|
262 | eend 1 "Conversion to gettext failed. Plugin needs fixing." |
|
|
263 | return 1 |
|
|
264 | fi |
|
|
265 | } |
|
|
266 | |
|
|
267 | vdr_i18n_disable_gettext() { |
|
|
268 | ebegin "Disabling gettext support in plugin" |
|
|
269 | # Remove i18n Target if using older vdr |
|
|
270 | sed -i Makefile \ |
|
|
271 | -e '/^all:/s/ i18n//' |
|
|
272 | eend 0 |
|
|
273 | } |
|
|
274 | |
| 218 | vdr_i18n() { |
275 | vdr_i18n() { |
| 219 | if [[ ${USE_GETTEXT} = 0 ]]; then |
276 | if vdr_has_gettext; then |
| 220 | # Remove i18n Target if using older vdr |
277 | einfo "VDR has gettext support" |
| 221 | sed -i Makefile \ |
278 | if plugin_has_gettext; then |
| 222 | -e '/^all:/s/ i18n//' |
279 | einfo "Plugin has gettext support, fine" |
| 223 | elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then |
280 | else |
| 224 | einfo "Plugin is not yet changed for new translation system." |
281 | vdr_i18n_convert_to_gettext |
| 225 | einfo "Auto converting translations to gettext" |
282 | if [[ $? != 0 ]]; then |
| 226 | |
283 | eerror "" |
| 227 | local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
284 | eerror "Plugin will have only english OSD texts" |
| 228 | if [[ ! -x ${i18n_tool} ]]; then |
285 | eerror "it needs manual fixing." |
| 229 | eerror "Missing ${i18n_tool}" |
286 | fi |
| 230 | eerror "Please re-emerge vdr" |
|
|
| 231 | die "Missing ${i18n_tool}" |
|
|
| 232 | fi |
287 | 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 |
288 | else |
| 253 | ewarn "Conversion to gettext failed. Plugin needs fixing." |
289 | einfo "VDR has no gettext support" |
|
|
290 | if plugin_has_gettext; then |
|
|
291 | vdr_i18n_disable_gettext |
| 254 | fi |
292 | fi |
| 255 | fi |
293 | fi |
| 256 | } |
294 | } |
| 257 | |
295 | |
| 258 | vdr-plugin_copy_source_tree() { |
296 | vdr-plugin_copy_source_tree() { |
| 259 | pushd . >/dev/null |
297 | pushd . >/dev/null |
| 260 | cp -r "${S}" "${T}"/source-tree |
298 | cp -r "${S}" "${T}"/source-tree |
| 261 | cd "${T}"/source-tree |
299 | cd "${T}"/source-tree |
| 262 | cp "${WORKDIR}"/Makefile.before Makefile |
300 | cp "${WORKDIR}"/Makefile.before Makefile |
|
|
301 | # TODO: Fix this, maybe no longer needed |
| 263 | sed -i Makefile \ |
302 | sed -i Makefile \ |
| 264 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
303 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| 265 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
304 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 266 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
305 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 267 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
306 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
| … | |
… | |
| 304 | DVB_INCLUDE_DIR="/usr/include" |
343 | DVB_INCLUDE_DIR="/usr/include" |
| 305 | |
344 | |
| 306 | |
345 | |
| 307 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
346 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
| 308 | LOCDIR="/usr/share/vdr/locale" |
347 | 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 | |
348 | |
| 315 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
349 | 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) |
350 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 317 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
351 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
| 318 | |
352 | |
| … | |
… | |
| 412 | |
446 | |
| 413 | cd "${S}" |
447 | cd "${S}" |
| 414 | insinto "${VDR_PLUGIN_DIR}" |
448 | insinto "${VDR_PLUGIN_DIR}" |
| 415 | doins libvdr-*.so.* |
449 | doins libvdr-*.so.* |
| 416 | |
450 | |
| 417 | if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then |
451 | if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then |
| 418 | einfo "Installing locales" |
452 | einfo "Installing locales" |
| 419 | cd "${TMP_LOCALE_DIR}" |
453 | cd "${TMP_LOCALE_DIR}" |
| 420 | insinto "${LOCDIR}" |
454 | insinto "${LOCDIR}" |
| 421 | doins -r * |
455 | doins -r * |
| 422 | fi |
456 | fi |