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