| 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.eclass,v 1.79 2012/01/15 20:54:56 idl0r Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.83 2012/03/09 23:14:46 hd_brummy Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: vdr-plugin.eclass |
5 | # @ECLASS: vdr-plugin.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 |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 10 | # Eclass for easing maitenance of vdr plugin ebuilds |
10 | # Eclass for easing maitenance of vdr plugin ebuilds |
| 11 | |
11 | |
| 12 | # Author: |
12 | # Authors: |
| 13 | # Matthias Schwarzott <zzam@gentoo.org> |
13 | # Matthias Schwarzott <zzam@gentoo.org> |
| 14 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
14 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
|
|
15 | # Christian Ruppert <idl0r@gentoo.org> |
| 15 | |
16 | |
| 16 | # Example ebuild (basic version without patching): |
17 | # Plugin config file installation: |
| 17 | # |
18 | # |
| 18 | # EAPI="2" |
19 | # A plugin config file can be specified through the $VDR_CONFD_FILE variable, it |
| 19 | # inherit vdr-plugin |
20 | # defaults to ${FILESDIR}/confd. Each config file will be installed as e.g. |
| 20 | # IUSE="" |
21 | # ${D}/etc/conf.d/vdr.${VDRPLUGIN} |
| 21 | # SLOT="0" |
22 | |
| 22 | # DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)" |
23 | # Installation of rc-addon files: |
| 23 | # HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/" |
24 | # NOTE: rc-addon files must be valid shell scripts! |
| 24 | # SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz" |
|
|
| 25 | # LICENSE="GPL-2" |
|
|
| 26 | # KEYWORDS="~x86" |
|
|
| 27 | # DEPEND=">=media-video/vdr-1.6.0" |
|
|
| 28 | # |
25 | # |
|
|
26 | # Installing rc-addon files is basically the same as for plugin config files |
|
|
27 | # (see above), it's just using the $VDR_RCADDON_FILE variable instead. |
|
|
28 | # The default value when $VDR_RCADDON_FILE is undefined is: |
|
|
29 | # ${FILESDIR}/rc-addon.sh and will be installed as |
|
|
30 | # ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh |
| 29 | # |
31 | # |
|
|
32 | # The rc-addon files will be sourced by the startscript when the specific plugin |
|
|
33 | # has been enabled. |
|
|
34 | # rc-addon files may be used to prepare everything that is necessary for the |
|
|
35 | # plugin start/stop, like passing extra command line options and so on. |
| 30 | |
36 | |
| 31 | # For patching you should modify src_prepare phase: |
37 | # Applying your own local/user patches: |
|
|
38 | # This is done by using the epatch_user() function of the eutils.eclass. |
|
|
39 | # Simply put your patches into one of these directories: |
|
|
40 | # /etc/portage/patches/<CATEGORY>/<PF|P|PN>/ |
|
|
41 | # Quote: where the first of these three directories to exist will be the one to |
|
|
42 | # use, ignoring any more general directories which might exist as well. |
| 32 | # |
43 | # |
| 33 | # src_prepare() { |
44 | # For more details about it please take a look at the eutils.class. |
| 34 | # epatch "${FILESDIR}"/${P}-xxx.patch |
|
|
| 35 | # vdr-plugin_src_prepare |
|
|
| 36 | # } |
|
|
| 37 | |
|
|
| 38 | # Installation of a config file for the plugin |
|
|
| 39 | # |
|
|
| 40 | # If ${VDR_CONFD_FILE} is set install this file |
|
|
| 41 | # else install ${FILESDIR}/confd if it exists. |
|
|
| 42 | |
|
|
| 43 | # Gets installed as /etc/conf.d/vdr.${VDRPLUGIN}. |
|
|
| 44 | # For the plugin vdr-femon this would be /etc/conf.d/vdr.femon |
|
|
| 45 | |
|
|
| 46 | |
|
|
| 47 | # Installation of an rc-addon file for the plugin |
|
|
| 48 | # |
|
|
| 49 | # If ${VDR_RCADDON_FILE} is set install this file |
|
|
| 50 | # else install ${FILESDIR}/rc-addon.sh if it exists. |
|
|
| 51 | # |
|
|
| 52 | # Gets installed under ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh |
|
|
| 53 | # (in example vdr-femon this would be /usr/share/vdr/rcscript/plugin-femon.sh) |
|
|
| 54 | # |
|
|
| 55 | # This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr |
|
|
| 56 | # It could be used for special startup actions for this plugins, or to create the |
|
|
| 57 | # plugin command line options from a nicer version of a conf.d file. |
|
|
| 58 | |
|
|
| 59 | # HowTo use own local patches; Example |
|
|
| 60 | # |
|
|
| 61 | # Add to your /etc/make.conf: |
|
|
| 62 | # VDR_LOCAL_PATCHES_DIR="/usr/local/patch" |
|
|
| 63 | # |
|
|
| 64 | # Add two DIR's in your local patch dir, ${PN}/${PV}, |
|
|
| 65 | # e.g for vdr-burn-0.1.0 should be: |
|
|
| 66 | # /usr/local/patch/vdr-burn/0.1.0/ |
|
|
| 67 | # |
|
|
| 68 | # all patches which ending on diff or patch in this DIR will automatically applied |
|
|
| 69 | # |
|
|
| 70 | |
45 | |
| 71 | inherit base multilib eutils flag-o-matic |
46 | inherit base multilib eutils flag-o-matic |
| 72 | |
47 | |
| 73 | if ! has "${EAPI:-0}" 0 1 2 3 4; then |
48 | if ! has "${EAPI:-0}" 0 1 2 3 4; then |
| 74 | die "API of vdr-plugin.eclass in EAPI=\"${EAPI}\" not established" |
49 | die "API of vdr-plugin.eclass in EAPI=\"${EAPI}\" not established" |
| … | |
… | |
| 88 | |
63 | |
| 89 | # depend on headers for DVB-driver |
64 | # depend on headers for DVB-driver |
| 90 | COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2" |
65 | COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2" |
| 91 | |
66 | |
| 92 | DEPEND="${COMMON_DEPEND} |
67 | DEPEND="${COMMON_DEPEND} |
| 93 | media-tv/linuxtv-dvb-headers" |
68 | virtual/linuxtv-dvb-headers" |
| 94 | RDEPEND="${COMMON_DEPEND} |
69 | RDEPEND="${COMMON_DEPEND} |
| 95 | >=app-admin/eselect-vdr-0.0.2" |
70 | >=app-admin/eselect-vdr-0.0.2" |
| 96 | |
71 | |
| 97 | # this is a hack for ebuilds like vdr-xineliboutput that want to |
72 | # this is a hack for ebuilds like vdr-xineliboutput that want to |
| 98 | # conditionally install a vdr-plugin |
73 | # conditionally install a vdr-plugin |
| … | |
… | |
| 244 | -e 's/STRIP.*=.*$/STRIP = true/' |
219 | -e 's/STRIP.*=.*$/STRIP = true/' |
| 245 | |
220 | |
| 246 | # Use a file instead of a variable as single-stepping via ebuild |
221 | # Use a file instead of a variable as single-stepping via ebuild |
| 247 | # destroys environment. |
222 | # destroys environment. |
| 248 | touch "${WORKDIR}"/.vdr-plugin_makefile_patched |
223 | touch "${WORKDIR}"/.vdr-plugin_makefile_patched |
| 249 | } |
|
|
| 250 | |
|
|
| 251 | vdr_add_local_patch() { |
|
|
| 252 | if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then |
|
|
| 253 | echo |
|
|
| 254 | einfo "Applying local patches" |
|
|
| 255 | for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do |
|
|
| 256 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
|
|
| 257 | done |
|
|
| 258 | fi |
|
|
| 259 | } |
224 | } |
| 260 | |
225 | |
| 261 | vdr_has_gettext() { |
226 | vdr_has_gettext() { |
| 262 | has_version ">=media-video/vdr-1.5.7" |
227 | has_version ">=media-video/vdr-1.5.7" |
| 263 | } |
228 | } |
| … | |
… | |
| 435 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
400 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
| 436 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
401 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
| 437 | |
402 | |
| 438 | einfo "Compiling against" |
403 | einfo "Compiling against" |
| 439 | einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]" |
404 | einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]" |
|
|
405 | |
|
|
406 | |
|
|
407 | if [ -n "${VDR_LOCAL_PATCHES_DIR}" ]; then |
|
|
408 | eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!" |
|
|
409 | eerror "Please move all your patches into" |
|
|
410 | eerror "${EROOT}/etc/portage/patches/${CATEGORY}/${P}" |
|
|
411 | eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable." |
|
|
412 | die |
|
|
413 | fi |
| 440 | } |
414 | } |
| 441 | |
415 | |
| 442 | vdr-plugin_src_util() { |
416 | vdr-plugin_src_util() { |
| 443 | |
|
|
| 444 | while [ "$1" ]; do |
417 | while [ "$1" ]; do |
| 445 | |
|
|
| 446 | case "$1" in |
418 | case "$1" in |
| 447 | all) |
419 | all) |
| 448 | vdr-plugin_src_util unpack add_local_patch patchmakefile i18n |
420 | vdr-plugin_src_util unpack add_local_patch patchmakefile i18n |
| 449 | ;; |
421 | ;; |
| 450 | prepare|all_but_unpack) |
422 | prepare|all_but_unpack) |
| … | |
… | |
| 453 | unpack) |
425 | unpack) |
| 454 | base_src_unpack |
426 | base_src_unpack |
| 455 | ;; |
427 | ;; |
| 456 | add_local_patch) |
428 | add_local_patch) |
| 457 | cd "${S}" || die "Could not change to plugin-source-directory!" |
429 | cd "${S}" || die "Could not change to plugin-source-directory!" |
| 458 | vdr_add_local_patch |
430 | epatch_user |
| 459 | ;; |
431 | ;; |
| 460 | patchmakefile) |
432 | patchmakefile) |
| 461 | cd "${S}" || die "Could not change to plugin-source-directory!" |
433 | cd "${S}" || die "Could not change to plugin-source-directory!" |
| 462 | vdr_patchmakefile |
434 | vdr_patchmakefile |
| 463 | ;; |
435 | ;; |
| … | |
… | |
| 617 | vdr-plugin_pkg_postrm() { |
589 | vdr-plugin_pkg_postrm() { |
| 618 | delete_orphan_plugindb_file |
590 | delete_orphan_plugindb_file |
| 619 | } |
591 | } |
| 620 | |
592 | |
| 621 | vdr-plugin_pkg_config() { |
593 | vdr-plugin_pkg_config() { |
| 622 | ewarn "emerge --config ${PN} is no longer supported" |
594 | : |
| 623 | vdr-plugin_print_enable_command |
|
|
| 624 | } |
595 | } |
| 625 | |
596 | |
| 626 | case "${EAPI:-0}" in |
597 | case "${EAPI:-0}" in |
| 627 | 2|3|4) |
598 | 2|3|4) |
| 628 | EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config |
599 | EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config |