| 1 |
# Copyright 1999-2013 Gentoo Foundation
|
| 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.17 2012/12/31 19:49:41 hd_brummy Exp $
|
| 4 |
|
| 5 |
# @ECLASS: vdr-plugin-2.eclass
|
| 6 |
# @MAINTAINER:
|
| 7 |
# vdr@gentoo.org
|
| 8 |
# @BLURB: common vdr plugin ebuild functions
|
| 9 |
# @DESCRIPTION:
|
| 10 |
# Eclass for easing maitenance of vdr plugin ebuilds
|
| 11 |
|
| 12 |
# Authors:
|
| 13 |
# Matthias Schwarzott <zzam@gentoo.org>
|
| 14 |
# Joerg Bornkessel <hd_brummy@gentoo.org>
|
| 15 |
# Christian Ruppert <idl0r@gentoo.org>
|
| 16 |
|
| 17 |
# Plugin config file installation:
|
| 18 |
#
|
| 19 |
# A plugin config file can be specified through the $VDR_CONFD_FILE variable, it
|
| 20 |
# defaults to ${FILESDIR}/confd. Each config file will be installed as e.g.
|
| 21 |
# ${D}/etc/conf.d/vdr.${VDRPLUGIN}
|
| 22 |
|
| 23 |
# Installation of rc-addon files:
|
| 24 |
# NOTE: rc-addon files must be valid shell scripts!
|
| 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
|
| 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.
|
| 36 |
|
| 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.
|
| 43 |
#
|
| 44 |
# For more details about it please take a look at the eutils.class.
|
| 45 |
|
| 46 |
inherit base eutils flag-o-matic multilib toolchain-funcs
|
| 47 |
|
| 48 |
case ${EAPI:-0} in
|
| 49 |
4|5) ;;
|
| 50 |
*) die "EAPI ${EAPI} unsupported."
|
| 51 |
esac
|
| 52 |
|
| 53 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
|
| 54 |
|
| 55 |
IUSE=""
|
| 56 |
|
| 57 |
# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
|
| 58 |
VDRPLUGIN="${PN/#vdrplugin-/}"
|
| 59 |
VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
|
| 60 |
VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
|
| 61 |
|
| 62 |
DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin-2.eclass)"
|
| 63 |
|
| 64 |
# Works in most cases
|
| 65 |
S="${WORKDIR}/${VDRPLUGIN}-${PV}"
|
| 66 |
|
| 67 |
# depend on headers for DVB-driver
|
| 68 |
COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
|
| 69 |
|
| 70 |
DEPEND="${COMMON_DEPEND}
|
| 71 |
virtual/linuxtv-dvb-headers"
|
| 72 |
RDEPEND="${COMMON_DEPEND}
|
| 73 |
>=app-admin/eselect-vdr-0.0.2"
|
| 74 |
|
| 75 |
# This is a hack for ebuilds like vdr-xineliboutput that want to
|
| 76 |
# conditionally install a vdr-plugin
|
| 77 |
if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
|
| 78 |
IUSE="${IUSE} vdr"
|
| 79 |
DEPEND="vdr? ( ${DEPEND} )"
|
| 80 |
RDEPEND="vdr? ( ${RDEPEND} )"
|
| 81 |
fi
|
| 82 |
|
| 83 |
# New method of storing plugindb
|
| 84 |
# Called from src_install
|
| 85 |
# file maintained by normal portage-methods
|
| 86 |
create_plugindb_file() {
|
| 87 |
local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
|
| 88 |
local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
|
| 89 |
insinto "${NEW_VDRPLUGINDB_DIR}"
|
| 90 |
|
| 91 |
# BUG: portage-2.1.4_rc9 will delete the EBUILD= line, so we cannot use this code.
|
| 92 |
# cat <<-EOT > "${D}/${DB_FILE}"
|
| 93 |
# VDRPLUGIN_DB=1
|
| 94 |
# CREATOR=ECLASS
|
| 95 |
# EBUILD=${CATEGORY}/${PN}
|
| 96 |
# EBUILD_V=${PVR}
|
| 97 |
# EOT
|
| 98 |
{
|
| 99 |
echo "VDRPLUGIN_DB=1"
|
| 100 |
echo "CREATOR=ECLASS"
|
| 101 |
echo "EBUILD=${CATEGORY}/${PN}"
|
| 102 |
echo "EBUILD_V=${PVR}"
|
| 103 |
echo "PLUGINS=\"$@\""
|
| 104 |
} > "${D}/${DB_FILE}"
|
| 105 |
}
|
| 106 |
|
| 107 |
# Delete files created outside of vdr-plugin-2.eclass
|
| 108 |
# vdrplugin-rebuild.ebuild converted plugindb and files are
|
| 109 |
# not deleted by portage itself - should only be needed as
|
| 110 |
# long as not every system has switched over to
|
| 111 |
# vdrplugin-rebuild-0.2 / gentoo-vdr-scripts-0.4.2
|
| 112 |
delete_orphan_plugindb_file() {
|
| 113 |
#elog Testing for orphaned plugindb file
|
| 114 |
local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
|
| 115 |
local DB_FILE="${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
|
| 116 |
|
| 117 |
# file exists
|
| 118 |
[[ -f ${DB_FILE} ]] || return
|
| 119 |
|
| 120 |
# will portage handle the file itself
|
| 121 |
if grep -q CREATOR=ECLASS "${DB_FILE}"; then
|
| 122 |
#elog file owned by eclass - don't touch it
|
| 123 |
return
|
| 124 |
fi
|
| 125 |
|
| 126 |
elog "Removing orphaned plugindb-file."
|
| 127 |
elog "\t#rm ${DB_FILE}"
|
| 128 |
rm "${DB_FILE}"
|
| 129 |
}
|
| 130 |
|
| 131 |
|
| 132 |
create_header_checksum_file() {
|
| 133 |
# Danger: Not using $ROOT here, as compile will also not use it !!!
|
| 134 |
# If vdr in $ROOT and / differ, plugins will not run anyway
|
| 135 |
|
| 136 |
local CHKSUM="header-md5-vdr"
|
| 137 |
|
| 138 |
if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
|
| 139 |
cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
|
| 140 |
elif type -p md5sum >/dev/null 2>&1; then
|
| 141 |
(
|
| 142 |
cd "${VDR_INCLUDE_DIR}"
|
| 143 |
md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
|
| 144 |
) > "${CHKSUM}"
|
| 145 |
else
|
| 146 |
die "Could not create md5 checksum of headers"
|
| 147 |
fi
|
| 148 |
|
| 149 |
insinto "${VDR_CHECKSUM_DIR}"
|
| 150 |
local p_name
|
| 151 |
for p_name; do
|
| 152 |
newins "${CHKSUM}" "header-md5-${p_name}"
|
| 153 |
done
|
| 154 |
}
|
| 155 |
|
| 156 |
fix_vdr_libsi_include() {
|
| 157 |
dev_check "Fixing include of libsi-headers"
|
| 158 |
local f
|
| 159 |
for f; do
|
| 160 |
sed -i "${f}" \
|
| 161 |
-e '/#include/s:"\(.*libsi.*\)":<\1>:' \
|
| 162 |
-e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
|
| 163 |
done
|
| 164 |
}
|
| 165 |
|
| 166 |
vdr_patchmakefile() {
|
| 167 |
einfo "Patching Makefile"
|
| 168 |
[[ -e Makefile ]] || die "Makefile of plugin can not be found!"
|
| 169 |
cp Makefile "${WORKDIR}"/Makefile.before
|
| 170 |
|
| 171 |
# plugin makefiles use VDRDIR in strange ways
|
| 172 |
# assumptions:
|
| 173 |
# 1. $(VDRDIR) contains Make.config
|
| 174 |
# 2. $(VDRDIR) contains config.h
|
| 175 |
# 3. $(VDRDIR)/include/vdr contains the headers
|
| 176 |
# 4. $(VDRDIR) contains main vdr Makefile
|
| 177 |
# 5. $(VDRDIR)/locale exists
|
| 178 |
# 6. $(VDRDIR) allows to access vdr source files
|
| 179 |
#
|
| 180 |
# We only have one directory (for now /usr/include/vdr),
|
| 181 |
# that contains vdr-headers and Make.config.
|
| 182 |
# To satisfy 1-3 we do this:
|
| 183 |
# Set VDRDIR=/usr/include/vdr
|
| 184 |
# Set VDRINCDIR=/usr/include
|
| 185 |
# Change $(VDRDIR)/include to $(VDRINCDIR)
|
| 186 |
|
| 187 |
sed -i Makefile \
|
| 188 |
-e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
|
| 189 |
-e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \
|
| 190 |
-e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
|
| 191 |
\
|
| 192 |
-e 's:-I$(DVBDIR)/include::' \
|
| 193 |
-e 's:-I$(DVBDIR)::'
|
| 194 |
|
| 195 |
# may be needed for multiproto:
|
| 196 |
#sed -i Makefile \
|
| 197 |
# -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
|
| 198 |
# -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
|
| 199 |
|
| 200 |
if ! grep -q APIVERSION Makefile; then
|
| 201 |
ebegin " Converting to APIVERSION"
|
| 202 |
sed -i Makefile \
|
| 203 |
-e 's:^APIVERSION = :APIVERSION ?= :' \
|
| 204 |
-e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
|
| 205 |
-e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
|
| 206 |
eend $?
|
| 207 |
fi
|
| 208 |
|
| 209 |
# Correcting Compile-Flags
|
| 210 |
# Do not overwrite CXXFLAGS, add LDFLAGS if missing
|
| 211 |
sed -i Makefile \
|
| 212 |
-e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
|
| 213 |
-e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
|
| 214 |
|
| 215 |
# Do not use {C,CXX}FLAGS from pkg-config vdr.pc, >=media-video/vdr-1.7.34
|
| 216 |
# we do not have the chance to overwrite it with *.eclass
|
| 217 |
sed -e "/^export[[:space:]]*CFLAGS[[:space:]]*=/s/=/?=/" \
|
| 218 |
-e "/^export[[:space:]]*CXXFLAGS[[:space:]]*=/s/=/?=/" \
|
| 219 |
-i Makefile
|
| 220 |
|
| 221 |
# Disabling file stripping, the package manager takes care of it
|
| 222 |
sed -i Makefile \
|
| 223 |
-e '/@.*strip/d' \
|
| 224 |
-e '/strip \$(LIBDIR)\/\$@/d' \
|
| 225 |
-e 's/STRIP.*=.*$/STRIP = true/'
|
| 226 |
|
| 227 |
# Use a file instead of a variable as single-stepping via ebuild
|
| 228 |
# destroys environment.
|
| 229 |
touch "${WORKDIR}"/.vdr-plugin_makefile_patched
|
| 230 |
}
|
| 231 |
|
| 232 |
# Begin new vdr-plugin-2.eclass content
|
| 233 |
dev_check() {
|
| 234 |
# A lot useful debug infos
|
| 235 |
# set VDR_MAINTAINER_MODE="1" in make.conf
|
| 236 |
if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
|
| 237 |
eerror "\t Maintainer Info: $@"
|
| 238 |
fi
|
| 239 |
}
|
| 240 |
|
| 241 |
gettext_missing() {
|
| 242 |
# plugins without converting to gettext
|
| 243 |
|
| 244 |
local GETTEXT_MISSING=$( grep xgettext Makefile )
|
| 245 |
if [[ -z ${GETTEXT_MISSING} ]]; then
|
| 246 |
dev_check "Plugin isn't converted to gettext handling \n"
|
| 247 |
fi
|
| 248 |
}
|
| 249 |
|
| 250 |
detect_po_dir() {
|
| 251 |
# Some plugins have po/ in a subdir
|
| 252 |
# set PO_SUBDIR in .ebuild
|
| 253 |
# i.e media-plugins/vdr-streamdev
|
| 254 |
# PO_SUBDIR="client server"
|
| 255 |
|
| 256 |
[[ -f po ]] && local po_dir="${S}"
|
| 257 |
local po_subdir=( ${S}/${PO_SUBDIR} )
|
| 258 |
local f
|
| 259 |
|
| 260 |
pofile_dir=( ${po_dir} ${po_subdir[*]} )
|
| 261 |
|
| 262 |
# maintainer check
|
| 263 |
if [[ ! -d ${pofile_dir[*]} ]]; then
|
| 264 |
dev_check "po dir not found? May be in subdir? \n"
|
| 265 |
fi
|
| 266 |
}
|
| 267 |
|
| 268 |
linguas_support() {
|
| 269 |
# Patching Makefile for linguas support.
|
| 270 |
# Only locales, enabled through the LINGUAS (make.conf) variable will be
|
| 271 |
# "compiled" and installed.
|
| 272 |
#
|
| 273 |
|
| 274 |
einfo "Patching for Linguas support"
|
| 275 |
einfo "available Languages for ${P} are:"
|
| 276 |
|
| 277 |
detect_po_dir
|
| 278 |
|
| 279 |
for f in ${pofile_dir[*]}; do
|
| 280 |
|
| 281 |
PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
|
| 282 |
einfo "LINGUAS=\"${PLUGIN_LINGUAS}\""
|
| 283 |
|
| 284 |
sed -i ${f}/Makefile \
|
| 285 |
-e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \
|
| 286 |
|| die "sed failed for Linguas"
|
| 287 |
done
|
| 288 |
|
| 289 |
strip-linguas ${PLUGIN_LINGUAS} en
|
| 290 |
}
|
| 291 |
|
| 292 |
vdr_i18n() {
|
| 293 |
# i18n handling was deprecated since >=media-video/vdr-1.5.9,
|
| 294 |
# finally with >=media-video/vdr-1.7.27 it has been dropped entirely and some
|
| 295 |
# plugins will fail to "compile" because they're still using the old variant.
|
| 296 |
# Simply remove the i18n.o object from Makefile (OBJECT) and
|
| 297 |
# remove "static const tI18nPhrase*" from i18n.h.
|
| 298 |
#
|
| 299 |
# Plugins that are still using the old method will be pmasked until they're
|
| 300 |
# fixed or in case of maintainer timeout they'll be masked for removal.
|
| 301 |
|
| 302 |
gettext_missing
|
| 303 |
|
| 304 |
local I18N_OBJECT=$( grep i18n.o Makefile )
|
| 305 |
if [[ -n ${I18N_OBJECT} ]]; then
|
| 306 |
|
| 307 |
if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
|
| 308 |
dev_check "Forced to keep i18n.o"
|
| 309 |
else
|
| 310 |
sed -i "s:i18n.o::g" Makefile
|
| 311 |
dev_check "OBJECT i18n.o found"
|
| 312 |
dev_check "removed per sed \n"
|
| 313 |
fi
|
| 314 |
|
| 315 |
else
|
| 316 |
dev_check "OBJECT i18n.o not found in Makefile"
|
| 317 |
dev_check "all fine or manual review needed? \n"
|
| 318 |
fi
|
| 319 |
|
| 320 |
local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
|
| 321 |
if [[ -n ${I18N_STRING} ]]; then
|
| 322 |
sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h
|
| 323 |
dev_check "obsolete tI18nPhrase found"
|
| 324 |
dev_check "disabled per sed, please recheck \n"
|
| 325 |
else
|
| 326 |
dev_check "obsolete tI18nPhrase not found, fine..."
|
| 327 |
dev_check "please review, may be in subdir... \n"
|
| 328 |
fi
|
| 329 |
}
|
| 330 |
|
| 331 |
remove_i18n_include() {
|
| 332 |
# remove uneeded i18.n includes
|
| 333 |
# call 'remove_i18n_include bla foo'
|
| 334 |
|
| 335 |
local f
|
| 336 |
for f; do
|
| 337 |
sed -i "${f}" \
|
| 338 |
-e "s:^#include[[:space:]]*\"i18n.h\"://:"
|
| 339 |
done
|
| 340 |
|
| 341 |
dev_check "removed i18n.h for ${@}"
|
| 342 |
}
|
| 343 |
# end new vdr-plugin-2.eclass content
|
| 344 |
|
| 345 |
# ToDo: we don't support included plugins from vdr source for install in this way !!!
|
| 346 |
# obsolet, remove it, later...
|
| 347 |
#vdr-plugin-2_copy_source_tree() {
|
| 348 |
# pushd . >/dev/null
|
| 349 |
# cp -r "${S}" "${T}"/source-tree
|
| 350 |
# cd "${T}"/source-tree
|
| 351 |
# cp "${WORKDIR}"/Makefile.before Makefile
|
| 352 |
# # TODO: Fix this, maybe no longer needed
|
| 353 |
# sed -i Makefile \
|
| 354 |
# -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
|
| 355 |
# -e 's:^CXXFLAGS:#CXXFLAGS:' \
|
| 356 |
# -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
|
| 357 |
# -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
|
| 358 |
# popd >/dev/null
|
| 359 |
#}
|
| 360 |
|
| 361 |
#vdr-plugin-2_install_source_tree() {
|
| 362 |
# einfo "Installing sources"
|
| 363 |
# destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
|
| 364 |
# insinto "${destdir}-${PV}"
|
| 365 |
# doins -r "${T}"/source-tree/*
|
| 366 |
#
|
| 367 |
# dosym "${VDRPLUGIN}-${PV}" "${destdir}"
|
| 368 |
#}
|
| 369 |
|
| 370 |
vdr-plugin-2_print_enable_command() {
|
| 371 |
local p_name c=0 l=""
|
| 372 |
for p_name in ${vdr_plugin_list}; do
|
| 373 |
c=$(( c+1 ))
|
| 374 |
l="$l ${p_name#vdr-}"
|
| 375 |
done
|
| 376 |
|
| 377 |
elog
|
| 378 |
case $c in
|
| 379 |
1) elog "Installed plugin${l}" ;;
|
| 380 |
*) elog "Installed $c plugins:${l}" ;;
|
| 381 |
esac
|
| 382 |
elog "To activate a plugin execute this command:"
|
| 383 |
elog "\teselect vdr-plugin enable <plugin_name> ..."
|
| 384 |
elog
|
| 385 |
}
|
| 386 |
|
| 387 |
has_vdr() {
|
| 388 |
[[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
|
| 389 |
}
|
| 390 |
|
| 391 |
## exported functions
|
| 392 |
|
| 393 |
vdr-plugin-2_pkg_setup() {
|
| 394 |
# missing ${chost}- tag
|
| 395 |
tc-export CC CXX
|
| 396 |
|
| 397 |
# -fPIC is needed for shared objects on some platforms (amd64 and others)
|
| 398 |
append-flags -fPIC
|
| 399 |
|
| 400 |
# Plugins need to be compiled with position independent code, otherwise linking
|
| 401 |
# VDR against it will fail
|
| 402 |
if has_version ">=media-video/vdr-1.7.13"; then
|
| 403 |
append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
| 404 |
fi
|
| 405 |
|
| 406 |
# Where should the plugins live in the filesystem
|
| 407 |
if has_version ">=media-video/vdr-1.7.34"; then
|
| 408 |
VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr)
|
| 409 |
else
|
| 410 |
VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins"
|
| 411 |
fi
|
| 412 |
|
| 413 |
VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
|
| 414 |
|
| 415 |
# was /usr/lib/... some time ago
|
| 416 |
# since gentoo-vdr-scripts-0.3.6 it works with /usr/share/...
|
| 417 |
VDR_RC_DIR="/usr/share/vdr/rcscript"
|
| 418 |
|
| 419 |
# Pathes to includes
|
| 420 |
VDR_INCLUDE_DIR="/usr/include/vdr"
|
| 421 |
DVB_INCLUDE_DIR="/usr/include"
|
| 422 |
|
| 423 |
TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
|
| 424 |
|
| 425 |
if has_version ">=media-video/vdr-1.7.34"; then
|
| 426 |
LOCDIR=$(pkg-config --variable=locdir vdr)
|
| 427 |
else
|
| 428 |
LOCDIR="/usr/share/locale"
|
| 429 |
fi
|
| 430 |
|
| 431 |
if ! has_vdr; then
|
| 432 |
# set to invalid values to detect abuses
|
| 433 |
VDRVERSION="eclass_no_vdr_installed"
|
| 434 |
APIVERSION="eclass_no_vdr_installed"
|
| 435 |
|
| 436 |
if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then
|
| 437 |
einfo "VDR not found!"
|
| 438 |
else
|
| 439 |
# if vdr is required
|
| 440 |
die "VDR not found!"
|
| 441 |
fi
|
| 442 |
return
|
| 443 |
fi
|
| 444 |
|
| 445 |
if has_version ">=media-video/vdr-1.7.34"; then
|
| 446 |
APIVERSION=$(pkg-config --variable=apiversion vdr)
|
| 447 |
else
|
| 448 |
VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
|
| 449 |
APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
|
| 450 |
[[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
|
| 451 |
fi
|
| 452 |
|
| 453 |
einfo "Compiling against"
|
| 454 |
einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
|
| 455 |
|
| 456 |
if [[ -n "${VDR_LOCAL_PATCHES_DIR}" ]]; then
|
| 457 |
eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!"
|
| 458 |
eerror "Please move all your patches into"
|
| 459 |
eerror "${EROOT}/etc/portage/patches/${CATEGORY}/${P}"
|
| 460 |
eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable."
|
| 461 |
die
|
| 462 |
fi
|
| 463 |
}
|
| 464 |
|
| 465 |
vdr-plugin-2_src_util() {
|
| 466 |
while [ "$1" ]; do
|
| 467 |
case "$1" in
|
| 468 |
all)
|
| 469 |
vdr-plugin-2_src_util unpack add_local_patch patchmakefile linguas_patch i18n
|
| 470 |
;;
|
| 471 |
prepare)
|
| 472 |
vdr-plugin-2_src_util add_local_patch patchmakefile linguas_patch i18n
|
| 473 |
;;
|
| 474 |
unpack)
|
| 475 |
base_src_unpack
|
| 476 |
;;
|
| 477 |
add_local_patch)
|
| 478 |
cd "${S}" || die "Could not change to plugin-source-directory!"
|
| 479 |
epatch_user
|
| 480 |
;;
|
| 481 |
patchmakefile)
|
| 482 |
cd "${S}" || die "Could not change to plugin-source-directory!"
|
| 483 |
vdr_patchmakefile
|
| 484 |
;;
|
| 485 |
i18n)
|
| 486 |
vdr_i18n
|
| 487 |
;;
|
| 488 |
linguas_patch)
|
| 489 |
linguas_support
|
| 490 |
;;
|
| 491 |
esac
|
| 492 |
|
| 493 |
shift
|
| 494 |
done
|
| 495 |
}
|
| 496 |
|
| 497 |
vdr-plugin-2_src_unpack() {
|
| 498 |
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
|
| 499 |
eerror "Wrong use of vdr-plugin-2.eclass."
|
| 500 |
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_unpack."
|
| 501 |
echo
|
| 502 |
eerror "Please report this at bugs.gentoo.org."
|
| 503 |
die "vdr-plugin-2_src_unpack not called!"
|
| 504 |
fi
|
| 505 |
|
| 506 |
if [ -z "$1" ]; then
|
| 507 |
vdr-plugin-2_src_util unpack
|
| 508 |
else
|
| 509 |
vdr-plugin-2_src_util $@
|
| 510 |
fi
|
| 511 |
}
|
| 512 |
|
| 513 |
vdr-plugin-2_src_prepare() {
|
| 514 |
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
|
| 515 |
eerror "Wrong use of vdr-plugin-2.eclass."
|
| 516 |
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_prepare."
|
| 517 |
echo
|
| 518 |
eerror "Please report this at bugs.gentoo.org."
|
| 519 |
die "vdr-plugin-2_src_prepare not called!"
|
| 520 |
fi
|
| 521 |
|
| 522 |
base_src_prepare
|
| 523 |
vdr-plugin-2_src_util prepare
|
| 524 |
}
|
| 525 |
|
| 526 |
vdr-plugin-2_src_compile() {
|
| 527 |
[ -z "$1" ] && vdr-plugin-2_src_compile copy_source compile
|
| 528 |
|
| 529 |
while [ "$1" ]; do
|
| 530 |
case "$1" in
|
| 531 |
copy_source)
|
| 532 |
[[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_copy_source_tree
|
| 533 |
dev_check "ToDo: obsoleted handling, vdr-plugin-2_copy_source_tree"
|
| 534 |
;;
|
| 535 |
compile)
|
| 536 |
if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
|
| 537 |
eerror "Wrong use of vdr-plugin-2.eclass."
|
| 538 |
eerror "An ebuild for a vdr-plugin will not work without"
|
| 539 |
eerror "calling vdr-plugin-2_src_compile to patch the Makefile."
|
| 540 |
echo
|
| 541 |
eerror "Please report this at bugs.gentoo.org."
|
| 542 |
die "vdr-plugin-2_src_compile not called!"
|
| 543 |
fi
|
| 544 |
cd "${S}"
|
| 545 |
|
| 546 |
BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all }}
|
| 547 |
emake ${BUILD_PARAMS} \
|
| 548 |
${BUILD_TARGETS} \
|
| 549 |
LOCALEDIR="${TMP_LOCALE_DIR}" \
|
| 550 |
LOCDIR="${TMP_LOCALE_DIR}" \
|
| 551 |
LIBDIR="${S}" \
|
| 552 |
TMPDIR="${T}" \
|
| 553 |
|| die "emake failed"
|
| 554 |
;;
|
| 555 |
esac
|
| 556 |
|
| 557 |
shift
|
| 558 |
done
|
| 559 |
}
|
| 560 |
|
| 561 |
vdr-plugin-2_src_install() {
|
| 562 |
if [[ -z ${VDR_INCLUDE_DIR} ]]; then
|
| 563 |
eerror "Wrong use of vdr-plugin-2.eclass."
|
| 564 |
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_install."
|
| 565 |
echo
|
| 566 |
eerror "Please report this at bugs.gentoo.org."
|
| 567 |
die "vdr-plugin-2_src_install not called!"
|
| 568 |
fi
|
| 569 |
|
| 570 |
# ToDo: obsolet, remove it, later...
|
| 571 |
# [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_install_source_tree
|
| 572 |
cd "${WORKDIR}"
|
| 573 |
|
| 574 |
if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
|
| 575 |
local mname="${P}-Makefile"
|
| 576 |
cp "${S}"/Makefile "${mname}.patched"
|
| 577 |
cp Makefile.before "${mname}.before"
|
| 578 |
|
| 579 |
diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
|
| 580 |
|
| 581 |
insinto "/usr/share/vdr/maintainer-data/makefile-changes"
|
| 582 |
doins "${mname}.diff"
|
| 583 |
|
| 584 |
insinto "/usr/share/vdr/maintainer-data/makefile-before"
|
| 585 |
doins "${mname}.before"
|
| 586 |
|
| 587 |
insinto "/usr/share/vdr/maintainer-data/makefile-patched"
|
| 588 |
doins "${mname}.patched"
|
| 589 |
|
| 590 |
fi
|
| 591 |
|
| 592 |
cd "${S}"
|
| 593 |
|
| 594 |
local SOFILE_STRING=$(grep SOFILE Makefile)
|
| 595 |
if [[ -n ${SOFILE_STRING} ]]; then
|
| 596 |
dev_check "installing with new Makefile handling"
|
| 597 |
BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install }}
|
| 598 |
einstall ${BUILD_PARAMS} \
|
| 599 |
${BUILD_TARGETS} \
|
| 600 |
LOCDIR="${TMP_LOCALE_DIR}" \
|
| 601 |
LIBDIR="${S}" \
|
| 602 |
TMPDIR="${T}" \
|
| 603 |
DESTDIR="${D}" \
|
| 604 |
|| die "einstall (makefile target) failed"
|
| 605 |
fi
|
| 606 |
|
| 607 |
insinto "${VDR_PLUGIN_DIR}"
|
| 608 |
doins libvdr-*.so.*
|
| 609 |
|
| 610 |
if [[ -d ${TMP_LOCALE_DIR} ]]; then
|
| 611 |
einfo "Installing locales"
|
| 612 |
cd "${TMP_LOCALE_DIR}"
|
| 613 |
|
| 614 |
local linguas
|
| 615 |
for linguas in ${LINGUAS[*]}; do
|
| 616 |
insinto "${LOCDIR}"
|
| 617 |
cp -r --parents ${linguas}* ${D}/${LOCDIR}
|
| 618 |
done
|
| 619 |
fi
|
| 620 |
|
| 621 |
# create list of all created plugin libs
|
| 622 |
vdr_plugin_list=""
|
| 623 |
local p_name
|
| 624 |
for p in libvdr-*.so.*; do
|
| 625 |
p_name="${p%.so*}"
|
| 626 |
p_name="${p_name#lib}"
|
| 627 |
vdr_plugin_list="${vdr_plugin_list} ${p_name}"
|
| 628 |
done
|
| 629 |
|
| 630 |
create_header_checksum_file ${vdr_plugin_list}
|
| 631 |
create_plugindb_file ${vdr_plugin_list}
|
| 632 |
|
| 633 |
|
| 634 |
cd "${S}"
|
| 635 |
local docfile
|
| 636 |
for docfile in README* HISTORY CHANGELOG; do
|
| 637 |
[[ -f ${docfile} ]] && dodoc ${docfile}
|
| 638 |
done
|
| 639 |
|
| 640 |
# if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
|
| 641 |
[[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd
|
| 642 |
|
| 643 |
if [[ -n ${VDR_CONFD_FILE} ]]; then
|
| 644 |
newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
|
| 645 |
fi
|
| 646 |
|
| 647 |
# if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it
|
| 648 |
[[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh
|
| 649 |
|
| 650 |
if [[ -n ${VDR_RCADDON_FILE} ]]; then
|
| 651 |
insinto "${VDR_RC_DIR}"
|
| 652 |
newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
|
| 653 |
fi
|
| 654 |
}
|
| 655 |
|
| 656 |
vdr-plugin-2_pkg_postinst() {
|
| 657 |
vdr-plugin-2_print_enable_command
|
| 658 |
|
| 659 |
if [[ -n "${VDR_CONFD_FILE}" ]]; then
|
| 660 |
elog "Please have a look at the config-file"
|
| 661 |
elog "\t/etc/conf.d/vdr.${VDRPLUGIN}"
|
| 662 |
elog
|
| 663 |
fi
|
| 664 |
}
|
| 665 |
|
| 666 |
vdr-plugin-2_pkg_postrm() {
|
| 667 |
delete_orphan_plugindb_file
|
| 668 |
}
|
| 669 |
|
| 670 |
vdr-plugin-2_pkg_config() {
|
| 671 |
:
|
| 672 |
}
|