# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
# @ECLASS: vdr-plugin-2.eclass
# @MAINTAINER:
# Joerg Bornkessel <hd_brummy@gentoo.org>
# Christian Ruppert <idl0r@gentoo.org>
# (undisclosed contributors)
+# @SUPPORTED_EAPIS: 4 5 6
# @BLURB: common vdr plugin ebuild functions
# @DESCRIPTION:
# Eclass for easing maintenance of vdr plugin ebuilds
# PO_SUBDIR="bla foo/bla"
# @CODE
-# @ECLASS-VARIABLE: VDR_MAINTAINER_MODE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Output from function dev_check if it is defined in ebuild or eclass,
-# helpfull for gentoo ebuild developer
-#
-# This will also install any debug files in /usr/share/vdr/maintainer-data
-#
-# This is intended to be set by user in make.conf. Ebuilds must not set
-# it.
-#
-# VDR_MAINTAINER_MODE=1
-
# @FUNCTION: fix_vdr_libsi_include
# @DESCRIPTION:
# Plugins failed on compile with wrong path of libsi includes,
# fix_vdr_libsi_include bla.c foo.c
# @CODE
-# @FUNCTION: remove_i18n_include
+# @FUNCTION: vdr_remove_i18n_include
# @DESCRIPTION:
# Compile will fail if plugin still use the old i18n language handling,
# most parts are fixed by vdr-plugin-2.eclass internal functions itself.
#
# Example:
# @CODE
-# remove_i18n_include bla.n foo.n
+# vdr_remove_i18n_include bla.n foo.n
# @CODE
# Applying your own local/user patches:
# This is done by using the
# (EAPI = 4,5) epatch_user() function of the eutils.eclass,
-# (EAPI = 6) eapply_user function integrated in EAPI = 6.
+# (EAPI = 6,7) eapply_user function integrated in EAPI = 6.
# Simply add your patches into one of these directories:
# /etc/portage/patches/<CATEGORY>/<PF|P|PN>/
# Quote: where the first of these three directories to exist will be the one to
#
# For more details about it please take a look at the eutils.class.
-[[ ${EAPI} == [45] ]] && inherit eutils multilib
+[[ ${EAPI} == [45] ]] && inherit multilib
+[[ ${EAPI} == [456] ]] && inherit eutils
inherit flag-o-matic toolchain-funcs unpacker
case ${EAPI:-0} in
- 4|5|6)
+ 4|5|6|7)
;;
*) die "EAPI ${EAPI} unsupported."
;;
# New method of storing plugindb
# Called from src_install
# file maintained by normal portage-methods
-create_plugindb_file() {
- #ToDo: rename this to vdr_...
+vdr_create_plugindb_file() {
local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
insinto "${NEW_VDRPLUGINDB_DIR}"
echo "EBUILD=${CATEGORY}/${PN}"
echo "EBUILD_V=${PVR}"
echo "PLUGINS=\"$@\""
- } > "${D}/${DB_FILE}"
+ } > "${D%/}/${DB_FILE}"
}
-create_header_checksum_file() {
- #ToDo: rename this to vdr_...
+vdr_create_header_checksum_file() {
# Danger: Not using $ROOT here, as compile will also not use it !!!
# If vdr in $ROOT and / differ, plugins will not run anyway
}
fix_vdr_libsi_include() {
- dev_check "Fixing include of libsi-headers"
+ eqawarn "Fixing include of libsi-headers"
local f
for f; do
sed -i "${f}" \
-e 's:-I$(DVBDIR)/include::' \
-e 's:-I$(DVBDIR)::'
- # may be needed for multiproto:
- #sed -i Makefile \
- # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
- # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
- # obsolet? fix me later...
-
if ! grep -q APIVERSION Makefile; then
ebegin " Converting to APIVERSION"
sed -i Makefile \
touch "${WORKDIR}"/.vdr-plugin_makefile_patched
}
-dev_check() {
- # ToDo: rename this to vdr_...; IMPORTANT: check availabel plugins, if we use this function in the tree...
- # A lot useful debug infos
- # set VDR_MAINTAINER_MODE="1" in make.conf
- if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
- eerror "\t Gentoo Developer Debug: $@"
- fi
-}
-
-gettext_missing() {
- #ToDo: rename this to vdr_...
+vdr_gettext_missing() {
# plugins without converting to gettext
local GETTEXT_MISSING=$( grep xgettext Makefile )
if [[ -z ${GETTEXT_MISSING} ]]; then
- dev_check "Plugin isn't converted to gettext handling \n"
+ eqawarn "Plugin isn't converted to gettext handling!"
fi
}
-detect_po_dir() {
- # ToDo: rename this to vdr_...
+vdr_detect_po_dir() {
# helper function
[[ -f po ]] && local po_dir="${S}"
pofile_dir=( ${po_dir} ${po_subdir[*]} )
}
-linguas_support() {
- # ToDo: rename this to vdr_...
+vdr_linguas_support() {
# Patching Makefile for linguas support.
# Only locales, enabled through the LINGUAS (make.conf) variable will be
# compiled and installed.
einfo "Patching for Linguas support"
einfo "available Languages for ${P} are:"
- detect_po_dir
+ vdr_detect_po_dir
for f in ${pofile_dir[*]}; do
PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
# Simply remove the i18n.o object from Makefile (OBJECT) and
# remove "static const tI18nPhrase*" from i18n.h.
- gettext_missing
+ vdr_gettext_missing
local I18N_OBJECT=$( grep i18n.o Makefile )
if [[ -n ${I18N_OBJECT} ]]; then
if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
- dev_check "Forced to keep i18n.o"
+ eqawarn "Forced to keep i18n.o"
else
sed -i "s:i18n.o::g" Makefile
- dev_check "OBJECT i18n.o found"
- dev_check "removed per sed \n"
+ eqawarn "OBJECT i18n.o found, removed per sed"
fi
-
- else
- dev_check "OBJECT i18n.o not found in Makefile"
- dev_check "all fine or manual review needed? \n"
fi
local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
if [[ -n ${I18N_STRING} ]]; then
sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h
- dev_check "obsolete tI18nPhrase found"
- dev_check "disabled per sed, please recheck \n"
- else
- dev_check "obsolete tI18nPhrase not found, fine..."
- dev_check "please review, may be in subdir... \n"
+ eqawarn "obsolete tI18nPhrase found, disabled per sed, please recheck"
fi
}
-remove_i18n_include() {
- # ToDo: rename this to vdr_...; IMPORTANT!!! We use this in the tree
+vdr_remove_i18n_include() {
# remove uneeded i18.n includes
local f
-e "s:^#include[[:space:]]*\"i18n.h\"://:"
done
- dev_check "removed i18n.h include in ${@}"
+ eqawarn "removed i18n.h include in ${@}"
}
vdr-plugin-2_print_enable_command() {
if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then
eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!"
eerror "Please move all your patches into"
- eerror "${EROOT}/etc/portage/patches/${CATEGORY}/${P}"
+ eerror "${EROOT%/}/etc/portage/patches/${CATEGORY}/${P}"
eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable."
die
fi
vdr_i18n
;;
linguas_patch)
- linguas_support
+ vdr_linguas_support
;;
esac
emake install \
${BUILD_PARAMS} \
TMPDIR="${T}" \
- DESTDIR="${D}" \
+ DESTDIR="${D%/}" \
|| die "emake install (makefile target) failed"
else
- dev_check "Plugin use still the old Makefile handling"
+ eqawarn "Plugin use still the old Makefile handling"
insinto "${VDR_PLUGIN_DIR}"
doins libvdr-*.so.*
fi
local linguas
for linguas in ${LINGUAS[*]}; do
insinto "${LOCDIR}"
- cp -r --parents ${linguas}* ${D}/${LOCDIR}
+ cp -r --parents ${linguas}* ${D%/}/${LOCDIR}
done
fi
- cd "${D}/usr/$(get_libdir)/vdr/plugins" || die "could not change to D/usr/libdir/vdr/plugins"
+ cd "${D%/}/usr/$(get_libdir)/vdr/plugins" || die "could not change to D/usr/libdir/vdr/plugins"
# create list of all created plugin libs
vdr_plugin_list=""
cd "${S}" || die "could not change to plugin source directory (src_install)"
- create_header_checksum_file ${vdr_plugin_list}
- create_plugindb_file ${vdr_plugin_list}
+ vdr_create_header_checksum_file ${vdr_plugin_list}
+ vdr_create_plugindb_file ${vdr_plugin_list}
- local commondoc=( README* HISTORY CHANGELOG )
- for docfile in "${commondoc[@]}"; do
- if [[ ${EAPI} == "6" ]]; then
- local DOCS="${DOCS} ${docfile}"
- [[ -f ${docfile} ]] && einstalldocs "${DOCS[@]}"
- else
- [[ -f ${docfile} ]] && dodoc ${docfile}
- fi
- done
+ if [[ ${EAPI} != [45] ]]; then
+ einstalldocs
+ else
+ local docfile
+ for docfile in README* HISTORY CHANGELOG; do
+ [[ -f ${docfile} ]] && dodoc ${docfile}
+ done
+ fi
# if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
[[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd