| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 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-2.eclass,v 1.13 2012/09/29 19:38:56 hd_brummy Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin-2.eclass,v 1.14 2012/12/29 17:47:53 hd_brummy Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: vdr-plugin-2.eclass |
5 | # @ECLASS: vdr-plugin-2.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # vdr@gentoo.org |
7 | # vdr@gentoo.org |
| 8 | # @BLURB: common vdr plugin ebuild functions |
8 | # @BLURB: common vdr plugin ebuild functions |
| … | |
… | |
| 239 | if [[ -z ${GETTEXT_MISSING} ]]; then |
239 | if [[ -z ${GETTEXT_MISSING} ]]; then |
| 240 | dev_check "Plugin isn't converted to gettext handling \n" |
240 | dev_check "Plugin isn't converted to gettext handling \n" |
| 241 | fi |
241 | fi |
| 242 | } |
242 | } |
| 243 | |
243 | |
|
|
244 | detect_po_dir() { |
|
|
245 | # Some plugins have po/ in a subdir |
|
|
246 | # set PO_SUBDIR in .ebuild |
|
|
247 | # i.e media-plugins/vdr-streamdev |
|
|
248 | # PO_SUBDIR="client server" |
|
|
249 | |
|
|
250 | [[ -f po ]] && local po_dir="${S}" |
|
|
251 | local po_subdir=( ${S}/${PO_SUBDIR} ) |
|
|
252 | local f |
|
|
253 | |
|
|
254 | pofile_dir=( ${po_dir} ${po_subdir[*]} ) |
|
|
255 | |
|
|
256 | # maintainer check |
|
|
257 | if [[ ! -d ${pofile_dir[*]} ]]; then |
|
|
258 | dev_check "po dir not found? May be in subdir? \n" |
|
|
259 | fi |
|
|
260 | } |
|
|
261 | |
| 244 | linguas_support() { |
262 | linguas_support() { |
| 245 | # Patching Makefile for linguas support. |
263 | # Patching Makefile for linguas support. |
| 246 | # Only locales, enabled through the LINGUAS (make.conf) variable will be |
264 | # Only locales, enabled through the LINGUAS (make.conf) variable will be |
| 247 | # "compiled" and installed. |
265 | # "compiled" and installed. |
| 248 | # |
266 | # |
| 249 | # Some plugins have po/ in a subdir |
|
|
| 250 | # set PO_SUBDIR in .ebuild |
|
|
| 251 | # i.e media-plugins/vdr-streamdev |
|
|
| 252 | # PO_SUBDIR="client server" |
|
|
| 253 | |
267 | |
| 254 | einfo "Patching for Linguas support" |
268 | einfo "Patching for Linguas support" |
| 255 | einfo "available Languages for ${P} are:" |
269 | einfo "available Languages for ${P} are:" |
| 256 | |
270 | |
| 257 | [[ -f po ]] && local po_dir="${S}" |
271 | detect_po_dir |
| 258 | local po_subdir=( ${S}/${PO_SUBDIR} ) |
|
|
| 259 | local f |
|
|
| 260 | |
272 | |
| 261 | makefile_dir=( ${po_dir} ${po_subdir[*]} ) |
|
|
| 262 | |
|
|
| 263 | for f in ${makefile_dir[*]}; do |
273 | for f in ${pofile_dir[*]}; do |
| 264 | |
274 | |
| 265 | PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' ) |
275 | PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' ) |
| 266 | einfo "LINGUAS=\"${PLUGIN_LINGUAS}\"" |
276 | einfo "LINGUAS=\"${PLUGIN_LINGUAS}\"" |
| 267 | |
277 | |
| 268 | sed -i ${f}/Makefile \ |
278 | sed -i ${f}/Makefile \ |
| 269 | -e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \ |
279 | -e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \ |
| 270 | || die "sed failed for Linguas" |
280 | || die "sed failed for Linguas" |
| 271 | done |
281 | done |
| 272 | |
282 | |
| 273 | strip-linguas ${PLUGIN_LINGUAS} en |
283 | strip-linguas ${PLUGIN_LINGUAS} en |
| 274 | |
|
|
| 275 | # maintainer check |
|
|
| 276 | if [[ ! -d po ]]; then |
|
|
| 277 | dev_check "po dir not found? May be in subdir? \n" |
|
|
| 278 | fi |
|
|
| 279 | } |
284 | } |
| 280 | |
285 | |
| 281 | vdr_i18n() { |
286 | vdr_i18n() { |
| 282 | # i18n handling was deprecated since >=media-video/vdr-1.5.9, |
287 | # i18n handling was deprecated since >=media-video/vdr-1.5.9, |
| 283 | # finally with >=media-video/vdr-1.7.27 it has been dropped entirely and some |
288 | # finally with >=media-video/vdr-1.7.27 it has been dropped entirely and some |
| … | |
… | |
| 329 | |
334 | |
| 330 | dev_check "removed i18n.h for ${@}" |
335 | dev_check "removed i18n.h for ${@}" |
| 331 | } |
336 | } |
| 332 | # end new vdr-plugin-2.eclass content |
337 | # end new vdr-plugin-2.eclass content |
| 333 | |
338 | |
|
|
339 | # we don't support included plugins from vdr source for install in this way !!! |
|
|
340 | # obsolet, remove it, later... |
| 334 | vdr-plugin-2_copy_source_tree() { |
341 | #vdr-plugin-2_copy_source_tree() { |
| 335 | pushd . >/dev/null |
342 | # pushd . >/dev/null |
| 336 | cp -r "${S}" "${T}"/source-tree |
343 | # cp -r "${S}" "${T}"/source-tree |
| 337 | cd "${T}"/source-tree |
344 | # cd "${T}"/source-tree |
| 338 | cp "${WORKDIR}"/Makefile.before Makefile |
345 | # cp "${WORKDIR}"/Makefile.before Makefile |
| 339 | # TODO: Fix this, maybe no longer needed |
346 | # # TODO: Fix this, maybe no longer needed |
| 340 | sed -i Makefile \ |
347 | # sed -i Makefile \ |
| 341 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
348 | # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| 342 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
349 | # -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 343 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
350 | # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 344 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
351 | # -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
| 345 | popd >/dev/null |
352 | # popd >/dev/null |
| 346 | } |
353 | #} |
| 347 | |
354 | |
| 348 | vdr-plugin-2_install_source_tree() { |
355 | #vdr-plugin-2_install_source_tree() { |
| 349 | einfo "Installing sources" |
356 | # einfo "Installing sources" |
| 350 | destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}" |
357 | # destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}" |
| 351 | insinto "${destdir}-${PV}" |
358 | # insinto "${destdir}-${PV}" |
| 352 | doins -r "${T}"/source-tree/* |
359 | # doins -r "${T}"/source-tree/* |
| 353 | |
360 | # |
| 354 | dosym "${VDRPLUGIN}-${PV}" "${destdir}" |
361 | # dosym "${VDRPLUGIN}-${PV}" "${destdir}" |
| 355 | } |
362 | #} |
| 356 | |
363 | |
| 357 | vdr-plugin-2_print_enable_command() { |
364 | vdr-plugin-2_print_enable_command() { |
| 358 | local p_name c=0 l="" |
365 | local p_name c=0 l="" |
| 359 | for p_name in ${vdr_plugin_list}; do |
366 | for p_name in ${vdr_plugin_list}; do |
| 360 | c=$(( c+1 )) |
367 | c=$(( c+1 )) |
| … | |
… | |
| 389 | |
396 | |
| 390 | # missing ${chost}- tag |
397 | # missing ${chost}- tag |
| 391 | tc-export CC CXX |
398 | tc-export CC CXX |
| 392 | |
399 | |
| 393 | # Where should the plugins live in the filesystem |
400 | # Where should the plugins live in the filesystem |
|
|
401 | if has_version ">=media-video/vdr-1.7.34"; then |
|
|
402 | VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr) |
|
|
403 | else |
| 394 | VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" |
404 | VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" |
|
|
405 | fi |
|
|
406 | |
| 395 | VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" |
407 | VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" |
| 396 | |
408 | |
| 397 | # was /usr/lib/... some time ago |
409 | # was /usr/lib/... some time ago |
| 398 | # since gentoo-vdr-scripts-0.3.6 it works with /usr/share/... |
410 | # since gentoo-vdr-scripts-0.3.6 it works with /usr/share/... |
| 399 | VDR_RC_DIR="/usr/share/vdr/rcscript" |
411 | VDR_RC_DIR="/usr/share/vdr/rcscript" |
| … | |
… | |
| 401 | # Pathes to includes |
413 | # Pathes to includes |
| 402 | VDR_INCLUDE_DIR="/usr/include/vdr" |
414 | VDR_INCLUDE_DIR="/usr/include/vdr" |
| 403 | DVB_INCLUDE_DIR="/usr/include" |
415 | DVB_INCLUDE_DIR="/usr/include" |
| 404 | |
416 | |
| 405 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
417 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
|
|
418 | |
|
|
419 | if has_version ">=media-video/vdr-1.7.34"; then |
|
|
420 | LOCDIR=$(pkg-config --variable=locdir vdr) |
|
|
421 | else |
| 406 | LOCDIR="/usr/share/locale" |
422 | LOCDIR="/usr/share/locale" |
|
|
423 | fi |
| 407 | |
424 | |
| 408 | if ! has_vdr; then |
425 | if ! has_vdr; then |
| 409 | # set to invalid values to detect abuses |
426 | # set to invalid values to detect abuses |
| 410 | VDRVERSION="eclass_no_vdr_installed" |
427 | VDRVERSION="eclass_no_vdr_installed" |
| 411 | APIVERSION="eclass_no_vdr_installed" |
428 | APIVERSION="eclass_no_vdr_installed" |
| … | |
… | |
| 417 | die "VDR not found!" |
434 | die "VDR not found!" |
| 418 | fi |
435 | fi |
| 419 | return |
436 | return |
| 420 | fi |
437 | fi |
| 421 | |
438 | |
|
|
439 | if has_version ">=media-video/vdr-1.7.34"; then |
|
|
440 | APIVERSION=$(pkg-config --variable=apiversion vdr) |
|
|
441 | else |
| 422 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
442 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 423 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
443 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 424 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
444 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
|
|
445 | fi |
| 425 | |
446 | |
| 426 | einfo "Compiling against" |
447 | einfo "Compiling against" |
| 427 | einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]" |
448 | einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]" |
| 428 | |
449 | |
| 429 | if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then |
450 | if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then |
| … | |
… | |
| 500 | [ -z "$1" ] && vdr-plugin-2_src_compile copy_source compile |
521 | [ -z "$1" ] && vdr-plugin-2_src_compile copy_source compile |
| 501 | |
522 | |
| 502 | while [ "$1" ]; do |
523 | while [ "$1" ]; do |
| 503 | case "$1" in |
524 | case "$1" in |
| 504 | copy_source) |
525 | copy_source) |
| 505 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_copy_source_tree |
526 | # [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_copy_source_tree |
|
|
527 | eerror "obsoleted handling, vdr-plugin-2_copy_source_tree" |
| 506 | ;; |
528 | ;; |
| 507 | compile) |
529 | compile) |
| 508 | if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then |
530 | if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then |
| 509 | eerror "Wrong use of vdr-plugin-2.eclass." |
531 | eerror "Wrong use of vdr-plugin-2.eclass." |
| 510 | eerror "An ebuild for a vdr-plugin will not work without" |
532 | eerror "An ebuild for a vdr-plugin will not work without" |
| … | |
… | |
| 513 | eerror "Please report this at bugs.gentoo.org." |
535 | eerror "Please report this at bugs.gentoo.org." |
| 514 | die "vdr-plugin-2_src_compile not called!" |
536 | die "vdr-plugin-2_src_compile not called!" |
| 515 | fi |
537 | fi |
| 516 | cd "${S}" |
538 | cd "${S}" |
| 517 | |
539 | |
|
|
540 | |
|
|
541 | if has_version ">=media-video/vdr-1.7.34"; then |
|
|
542 | BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install }} |
|
|
543 | emake ${BUILD_PARAMS} \ |
|
|
544 | ${BUILD_TARGETS} \ |
|
|
545 | LOCDIR="${TMP_LOCALE_DIR}" \ |
|
|
546 | LIBDIR="${S}" \ |
|
|
547 | TMPDIR="${T}" \ |
|
|
548 | || die "emake failed" |
|
|
549 | else |
| 518 | BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all}} |
550 | BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all }} |
| 519 | |
|
|
| 520 | emake ${BUILD_PARAMS} \ |
551 | emake ${BUILD_PARAMS} \ |
| 521 | ${BUILD_TARGETS} \ |
552 | ${BUILD_TARGETS} \ |
| 522 | LOCALEDIR="${TMP_LOCALE_DIR}" \ |
553 | LOCALEDIR="${TMP_LOCALE_DIR}" \ |
| 523 | LIBDIR="${S}" \ |
554 | LIBDIR="${S}" \ |
| 524 | TMPDIR="${T}" \ |
555 | TMPDIR="${T}" \ |
| 525 | || die "emake failed" |
556 | || die "emake failed" |
|
|
557 | fi |
| 526 | ;; |
558 | ;; |
| 527 | esac |
559 | esac |
| 528 | |
560 | |
| 529 | shift |
561 | shift |
| 530 | done |
562 | done |
| … | |
… | |
| 537 | echo |
569 | echo |
| 538 | eerror "Please report this at bugs.gentoo.org." |
570 | eerror "Please report this at bugs.gentoo.org." |
| 539 | die "vdr-plugin-2_src_install not called!" |
571 | die "vdr-plugin-2_src_install not called!" |
| 540 | fi |
572 | fi |
| 541 | |
573 | |
|
|
574 | # obsolet, remove it, later... |
| 542 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_install_source_tree |
575 | # [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_install_source_tree |
| 543 | cd "${WORKDIR}" |
576 | cd "${WORKDIR}" |
| 544 | |
577 | |
| 545 | if [[ -n ${VDR_MAINTAINER_MODE} ]]; then |
578 | if [[ -n ${VDR_MAINTAINER_MODE} ]]; then |
| 546 | local mname="${P}-Makefile" |
579 | local mname="${P}-Makefile" |
| 547 | cp "${S}"/Makefile "${mname}.patched" |
580 | cp "${S}"/Makefile "${mname}.patched" |
| … | |
… | |
| 559 | doins "${mname}.patched" |
592 | doins "${mname}.patched" |
| 560 | |
593 | |
| 561 | fi |
594 | fi |
| 562 | |
595 | |
| 563 | cd "${S}" |
596 | cd "${S}" |
|
|
597 | |
| 564 | insinto "${VDR_PLUGIN_DIR}" |
598 | insinto "${VDR_PLUGIN_DIR}" |
| 565 | doins libvdr-*.so.* |
599 | doins libvdr-*.so.* |
| 566 | |
600 | |
| 567 | # create list of all created plugin libs |
601 | # create list of all created plugin libs |
| 568 | vdr_plugin_list="" |
602 | vdr_plugin_list="" |