| 1 |
# Copyright 1999-2012 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.16 2012/12/31 18:53:47 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 |
local SOFILE_STRING=$(grep SOFILE Makefile) |
| 547 |
if [[ -n ${SOFILE_STRING} ]]; then |
| 548 |
dev_check "compiling with new Makefile handling" |
| 549 |
BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install }} |
| 550 |
emake ${BUILD_PARAMS} \ |
| 551 |
${BUILD_TARGETS} \ |
| 552 |
LOCDIR="${TMP_LOCALE_DIR}" \ |
| 553 |
LIBDIR="${S}" \ |
| 554 |
TMPDIR="${T}" \ |
| 555 |
|| die "emake failed" |
| 556 |
else |
| 557 |
dev_check "compiling with old Makefile handling" |
| 558 |
BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all }} |
| 559 |
emake ${BUILD_PARAMS} \ |
| 560 |
${BUILD_TARGETS} \ |
| 561 |
LOCALEDIR="${TMP_LOCALE_DIR}" \ |
| 562 |
LIBDIR="${S}" \ |
| 563 |
TMPDIR="${T}" \ |
| 564 |
|| die "emake failed" |
| 565 |
fi |
| 566 |
;; |
| 567 |
esac |
| 568 |
|
| 569 |
shift |
| 570 |
done |
| 571 |
} |
| 572 |
|
| 573 |
vdr-plugin-2_src_install() { |
| 574 |
if [[ -z ${VDR_INCLUDE_DIR} ]]; then |
| 575 |
eerror "Wrong use of vdr-plugin-2.eclass." |
| 576 |
eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin-2_src_install." |
| 577 |
echo |
| 578 |
eerror "Please report this at bugs.gentoo.org." |
| 579 |
die "vdr-plugin-2_src_install not called!" |
| 580 |
fi |
| 581 |
|
| 582 |
# ToDo: obsolet, remove it, later... |
| 583 |
# [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_install_source_tree |
| 584 |
cd "${WORKDIR}" |
| 585 |
|
| 586 |
if [[ -n ${VDR_MAINTAINER_MODE} ]]; then |
| 587 |
local mname="${P}-Makefile" |
| 588 |
cp "${S}"/Makefile "${mname}.patched" |
| 589 |
cp Makefile.before "${mname}.before" |
| 590 |
|
| 591 |
diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff" |
| 592 |
|
| 593 |
insinto "/usr/share/vdr/maintainer-data/makefile-changes" |
| 594 |
doins "${mname}.diff" |
| 595 |
|
| 596 |
insinto "/usr/share/vdr/maintainer-data/makefile-before" |
| 597 |
doins "${mname}.before" |
| 598 |
|
| 599 |
insinto "/usr/share/vdr/maintainer-data/makefile-patched" |
| 600 |
doins "${mname}.patched" |
| 601 |
|
| 602 |
fi |
| 603 |
|
| 604 |
cd "${S}" |
| 605 |
|
| 606 |
insinto "${VDR_PLUGIN_DIR}" |
| 607 |
doins libvdr-*.so.* |
| 608 |
|
| 609 |
# create list of all created plugin libs |
| 610 |
vdr_plugin_list="" |
| 611 |
local p_name |
| 612 |
for p in libvdr-*.so.*; do |
| 613 |
p_name="${p%.so*}" |
| 614 |
p_name="${p_name#lib}" |
| 615 |
vdr_plugin_list="${vdr_plugin_list} ${p_name}" |
| 616 |
done |
| 617 |
|
| 618 |
create_header_checksum_file ${vdr_plugin_list} |
| 619 |
create_plugindb_file ${vdr_plugin_list} |
| 620 |
|
| 621 |
if [[ -d ${TMP_LOCALE_DIR} ]]; then |
| 622 |
einfo "Installing locales" |
| 623 |
cd "${TMP_LOCALE_DIR}" |
| 624 |
local linguas |
| 625 |
for linguas in ${LINGUAS[*]}; do |
| 626 |
insinto "${LOCDIR}" |
| 627 |
cp -r --parents ${linguas}* ${D}/${LOCDIR} |
| 628 |
done |
| 629 |
fi |
| 630 |
|
| 631 |
cd "${S}" |
| 632 |
local docfile |
| 633 |
for docfile in README* HISTORY CHANGELOG; do |
| 634 |
[[ -f ${docfile} ]] && dodoc ${docfile} |
| 635 |
done |
| 636 |
|
| 637 |
# if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it |
| 638 |
[[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd |
| 639 |
|
| 640 |
if [[ -n ${VDR_CONFD_FILE} ]]; then |
| 641 |
newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} |
| 642 |
fi |
| 643 |
|
| 644 |
# if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it |
| 645 |
[[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh |
| 646 |
|
| 647 |
if [[ -n ${VDR_RCADDON_FILE} ]]; then |
| 648 |
insinto "${VDR_RC_DIR}" |
| 649 |
newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh |
| 650 |
fi |
| 651 |
} |
| 652 |
|
| 653 |
vdr-plugin-2_pkg_postinst() { |
| 654 |
vdr-plugin-2_print_enable_command |
| 655 |
|
| 656 |
if [[ -n "${VDR_CONFD_FILE}" ]]; then |
| 657 |
elog "Please have a look at the config-file" |
| 658 |
elog "\t/etc/conf.d/vdr.${VDRPLUGIN}" |
| 659 |
elog |
| 660 |
fi |
| 661 |
} |
| 662 |
|
| 663 |
vdr-plugin-2_pkg_postrm() { |
| 664 |
delete_orphan_plugindb_file |
| 665 |
} |
| 666 |
|
| 667 |
vdr-plugin-2_pkg_config() { |
| 668 |
: |
| 669 |
} |