/[gentoo-x86]/eclass/vdr-plugin.eclass
Gentoo

Diff of /eclass/vdr-plugin.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1.1.1 Revision 1.93
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2014 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/Attic/vdr-plugin.eclass,v 1.1.1.1 2005/11/30 09:59:32 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/vdr-plugin.eclass,v 1.93 2014/04/26 05:13:24 hd_brummy dead $
4
5# @DEAD
6
7# @ECLASS: vdr-plugin.eclass
8# @MAINTAINER:
9# vdr@gentoo.org
10# @BLURB: common vdr plugin ebuild functions
11# @DESCRIPTION:
12# Eclass for easing maitenance of vdr plugin ebuilds
13
14# Authors:
15# Matthias Schwarzott <zzam@gentoo.org>
16# Joerg Bornkessel <hd_brummy@gentoo.org>
17# Christian Ruppert <idl0r@gentoo.org>
18
19# Plugin config file installation:
4# 20#
5# Author: 21# A plugin config file can be specified through the $VDR_CONFD_FILE variable, it
6# Matthias Schwarzott <zzam@gentoo.org> 22# defaults to ${FILESDIR}/confd. Each config file will be installed as e.g.
23# ${D}/etc/conf.d/vdr.${VDRPLUGIN}
7 24
8# vdr-plugin.eclass 25# Installation of rc-addon files:
26# NOTE: rc-addon files must be valid shell scripts!
9# 27#
10# eclass to create ebuilds for vdr plugins 28# Installing rc-addon files is basically the same as for plugin config files
29# (see above), it's just using the $VDR_RCADDON_FILE variable instead.
30# The default value when $VDR_RCADDON_FILE is undefined is:
31# ${FILESDIR}/rc-addon.sh and will be installed as
32# ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh
11# 33#
34# The rc-addon files will be sourced by the startscript when the specific plugin
35# has been enabled.
36# rc-addon files may be used to prepare everything that is necessary for the
37# plugin start/stop, like passing extra command line options and so on.
12 38
13# Example ebuild (vdr-femon): 39# Applying your own local/user patches:
40# This is done by using the epatch_user() function of the eutils.eclass.
41# Simply put your patches into one of these directories:
42# /etc/portage/patches/<CATEGORY>/<PF|P|PN>/
43# Quote: where the first of these three directories to exist will be the one to
44# use, ignoring any more general directories which might exist as well.
14# 45#
15# inherit vdr-plugin 46# For more details about it please take a look at the eutils.class.
47
48inherit base multilib eutils flag-o-matic
49
50if ! has "${EAPI:-0}" 0 1 2 3 4 5; then
51 die "API of vdr-plugin.eclass in EAPI=\"${EAPI}\" not established"
52fi
53
16# IUSE="" 54IUSE=""
17# SLOT="0"
18# DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)"
19# HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/"
20# SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz"
21# LICENSE="GPL-2"
22# KEYWORDS="~x86"
23# DEPEND=">=media-video/vdr-1.3.27"
24#
25#
26
27# There are some special files in ${FILESDIR} which get installed when
28# they exist:
29
30# ${FILESDIR}/confd-${PV} or ${FILESDIR}/confd:
31# The first matching is installed under /etc/conf.d/vdr.${VDRPLUGIN}
32# (in example vdr-femon this would be /etc/conf.d/vdr.femon)
33#
34# Everything put in variable _EXTRAOPTS is appended to the command line of
35# the plugin.
36
37
38# ${FILESDIR}/rc-addon-${PV}.sh or ${FILESDIR}/rc-addon.sh:
39# The first matching is installed under /usr/lib/vdr/rcscript/plugin-${VDRPLUGIN}.sh
40# (in example vdr-femon this would be /usr/lib/vdr/rcscript/plugin-femon.sh)
41#
42# This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr
43# It could be used for special startup actions for this plugins, or to create the
44# plugin command line options from a nicer version of a conf.d file.
45
46inherit eutils flag-o-matic
47 55
48# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes 56# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
49VDRPLUGIN="${PN/#vdrplugin-/}" 57VDRPLUGIN="${PN/#vdrplugin-/}"
50VDRPLUGIN="${VDRPLUGIN/#vdr-/}" 58VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
51VDRPLUGIN="${VDRPLUGIN/%-cvs/}" 59VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
54 62
55# works in most cases 63# works in most cases
56S="${WORKDIR}/${VDRPLUGIN}-${PV}" 64S="${WORKDIR}/${VDRPLUGIN}-${PV}"
57 65
58# depend on headers for DVB-driver 66# depend on headers for DVB-driver
59RDEPEND="" 67COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
60DEPEND="|| (
61 >=sys-kernel/linux-headers-2.6.11-r2
62 media-tv/linuxtv-dvb
63 )"
64 68
65# Where should the plugins live in the filesystem 69DEPEND="${COMMON_DEPEND}
66VDR_PLUGIN_DIR="/usr/lib/vdr/plugins" 70 virtual/linuxtv-dvb-headers"
71RDEPEND="${COMMON_DEPEND}
72 >=app-admin/eselect-vdr-0.0.2"
67 73
68VDR_RC_DIR="/usr/lib/vdr/rcscript" 74# this is a hack for ebuilds like vdr-xineliboutput that want to
69 75# conditionally install a vdr-plugin
70# Pathes to includes 76if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
71VDR_INCLUDE_DIR="/usr/include" 77 # make DEPEND conditional
72DVB_INCLUDE_DIR="/usr/include" 78 IUSE="${IUSE} vdr"
73 79 DEPEND="vdr? ( ${DEPEND} )"
74 80 RDEPEND="vdr? ( ${RDEPEND} )"
75# this code is from linux-mod.eclass
76update_vdrplugindb() {
77 local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/
78
79 if [[ ! -f ${VDRPLUGINDB_DIR}/vdrplugindb ]]; then
80 [[ ! -d ${VDRPLUGINDB_DIR} ]] && mkdir -p ${VDRPLUGINDB_DIR}
81 touch ${VDRPLUGINDB_DIR}/vdrplugindb
82 fi 81fi
83 if [[ -z $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then
84 einfo "Adding plugin to vdrplugindb."
85 echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${VDRPLUGINDB_DIR}/vdrplugindb
86 fi
87}
88 82
89remove_vdrplugindb() { 83# New method of storing plugindb
84# Called from src_install
85# file maintained by normal portage-methods
86create_plugindb_file() {
90 local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/ 87 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
88 local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
89 insinto "${NEW_VDRPLUGINDB_DIR}"
91 90
92 if [[ -n $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then 91# BUG: portage-2.1.4_rc9 will delete the EBUILD= line, so we cannot use this code.
93 einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb." 92# cat <<-EOT > "${D}/${DB_FILE}"
94 sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb 93# VDRPLUGIN_DB=1
95 fi 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}"
96} 105}
97 106
98vdr-plugin_pkg_setup() { 107# Delete files created outside of vdr-plugin.eclass
99 # -fPIC is needed for shared objects on some platforms (amd64 and others) 108# vdrplugin-rebuild.ebuild converted plugindb and files are
100 append-flags -fPIC 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
112delete_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}"
101 116
102 VDRVERSION=$(awk -F'"' '/VDRVERSION/ {print $2}' /usr/include/vdr/config.h) 117 # file exists
103 einfo "Building ${PF} against vdr-${VDRVERSION}" 118 [[ -f ${DB_FILE} ]] || return
104}
105 119
106vdr-plugin_src_unpack() { 120 # will portage handle the file itself
107 [ -z "$1" ] && vdr-plugin_src_unpack unpack patchmakefile 121 if grep -q CREATOR=ECLASS "${DB_FILE}"; then
122 #elog file owned by eclass - don't touch it
123 return
124 fi
108 125
109 while [ "$1" ]; do 126 elog "Removing orphaned plugindb-file."
127 elog "\t#rm ${DB_FILE}"
128 rm "${DB_FILE}"
129}
110 130
111 case "$1" in
112 unpack)
113 unpack ${A}
114 ;;
115 patchmakefile)
116 cd ${S}
117 131
118 ebegin "Patching Makefile" 132create_header_checksum_file()
119 sed -i.orig Makefile \ 133{
120 -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ 134 # Danger: Not using $ROOT here, as compile will also not use it !!!
121 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ 135 # If vdr in $ROOT and / differ, plugins will not run anyway
122 -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \
123 -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \
124 -e 's:^CXXFLAGS:#CXXFLAGS:' \
125 -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \
126 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
127 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \
128 -e 's:$(VDRDIR)/\(config.h\|Make.config\):$(VDRDIR)/vdr/\1:'
129 eend $?
130 ;;
131 esac
132 136
133 shift 137 local CHKSUM="header-md5-vdr"
138
139 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
140 cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
141 elif type -p md5sum >/dev/null 2>&1; then
142 (
143 cd "${VDR_INCLUDE_DIR}"
144 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
145 ) > "${CHKSUM}"
146 else
147 die "Could not create md5 checksum of headers"
148 fi
149
150 insinto "${VDR_CHECKSUM_DIR}"
151 local p_name
152 for p_name; do
153 newins "${CHKSUM}" "header-md5-${p_name}"
134 done 154 done
135} 155}
136 156
157fix_vdr_libsi_include()
158{
159 #einfo "Fixing include of libsi-headers"
160 local f
161 for f; do
162 sed -i "${f}" \
163 -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
164 -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
165 done
166}
167
168vdr_patchmakefile() {
169 einfo "Patching Makefile"
170 [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
171 cp Makefile "${WORKDIR}"/Makefile.before
172
173 # plugin makefiles use VDRDIR in strange ways
174 # assumptions:
175 # 1. $(VDRDIR) contains Make.config
176 # 2. $(VDRDIR) contains config.h
177 # 3. $(VDRDIR)/include/vdr contains the headers
178 # 4. $(VDRDIR) contains main vdr Makefile
179 # 5. $(VDRDIR)/locale exists
180 # 6. $(VDRDIR) allows to access vdr source files
181 #
182 # We only have one directory (for now /usr/include/vdr),
183 # that contains vdr-headers and Make.config.
184 # To satisfy 1-3 we do this:
185 # Set VDRDIR=/usr/include/vdr
186 # Set VDRINCDIR=/usr/include
187 # Change $(VDRDIR)/include to $(VDRINCDIR)
188
189 sed -i Makefile \
190 -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
191 -e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \
192 -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
193 \
194 -e 's:-I$(DVBDIR)/include::' \
195 -e 's:-I$(DVBDIR)::'
196
197 # maybe needed for multiproto:
198 #sed -i Makefile \
199 # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
200 # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
201
202 if ! grep -q APIVERSION Makefile; then
203 ebegin " Converting to APIVERSION"
204 sed -i Makefile \
205 -e 's:^APIVERSION = :APIVERSION ?= :' \
206 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
207 -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
208 eend $?
209 fi
210
211 # Correcting Compile-Flags
212 # Do not overwrite CXXFLAGS, add LDFLAGS if missing
213 sed -i Makefile \
214 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
215 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
216
217 # Disabling file stripping, useful for debugging
218 sed -i Makefile \
219 -e '/@.*strip/d' \
220 -e '/strip \$(LIBDIR)\/\$@/d' \
221 -e 's/STRIP.*=.*$/STRIP = true/'
222
223 # Use a file instead of a variable as single-stepping via ebuild
224 # destroys environment.
225 touch "${WORKDIR}"/.vdr-plugin_makefile_patched
226}
227
228vdr_has_gettext() {
229 has_version ">=media-video/vdr-1.5.7"
230}
231
232plugin_has_gettext() {
233 [[ -d po ]]
234}
235
236vdr_i18n_convert_to_gettext() {
237 if has_version ">=media-video/vdr-1.7.22"; then
238 local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext"
239 else
240 local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
241 fi
242
243 if [[ ${NO_GETTEXT_HACK} == "1" ]]; then
244 ewarn "Conversion to gettext disabled in ebuild"
245 return 1
246 fi
247
248 if [[ ! -x ${i18n_tool} ]]; then
249 eerror "Missing ${i18n_tool}"
250 eerror "Please re-emerge vdr"
251 die "Missing ${i18n_tool}"
252 fi
253
254 ebegin "Auto converting translations to gettext"
255 # call i18n-to-gettext tool
256 # take all texts missing tr call into special file
257 "${i18n_tool}" 2>/dev/null \
258 |sed -e '/^"/!d' \
259 -e '/^""$/d' \
260 -e 's/\(.*\)/trNOOP(\1)/' \
261 > dummy-translations-trNOOP.c
262
263 # if there were untranslated texts just run it again
264 # now the missing calls are listed in
265 # dummy-translations-trNOOP.c
266 if [[ -s dummy-translations-trNOOP.c ]]; then
267 "${i18n_tool}" &>/dev/null
268 fi
269
270 # now use the modified Makefile
271 if [[ -f Makefile.new ]]; then
272 mv Makefile.new Makefile
273 eend 0 ""
274 else
275 eend 1 "Conversion to gettext failed. Plugin needs fixing."
276 return 1
277 fi
278}
279
280vdr_i18n_disable_gettext() {
281 #einfo "Disabling gettext support in plugin"
282
283 # Remove i18n Target if using older vdr
284 sed -i Makefile \
285 -e '/^all:/s/ i18n//'
286}
287
288vdr_i18n() {
289 if vdr_has_gettext; then
290 #einfo "VDR has gettext support"
291 if plugin_has_gettext; then
292 #einfo "Plugin has gettext support, fine"
293 if [[ ${NO_GETTEXT_HACK} == "1" ]]; then
294 ewarn "Please remove unneeded NO_GETTEXT_HACK from ebuild."
295 fi
296 else
297 vdr_i18n_convert_to_gettext
298 if [[ $? != 0 ]]; then
299 einfo "Plugin has no OSD texts or will have only english OSD texts"
300 fi
301 fi
302 else
303 #einfo "VDR has no gettext support"
304 if plugin_has_gettext; then
305 vdr_i18n_disable_gettext
306 fi
307 fi
308}
309
137vdr-plugin_copy_source_tree() { 310vdr-plugin_copy_source_tree() {
311 pushd . >/dev/null
138 cp -r ${S} ${T}/source-tree 312 cp -r "${S}" "${T}"/source-tree
139 cd ${T}/source-tree 313 cd "${T}"/source-tree
140 mv Makefile.orig Makefile 314 cp "${WORKDIR}"/Makefile.before Makefile
315 # TODO: Fix this, maybe no longer needed
141 sed -i Makefile \ 316 sed -i Makefile \
142 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ 317 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
143 -e 's:^CXXFLAGS:#CXXFLAGS:' \ 318 -e 's:^CXXFLAGS:#CXXFLAGS:' \
144 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ 319 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
145 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' 320 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
321 popd >/dev/null
146} 322}
147 323
148vdr-plugin_install_source_tree() { 324vdr-plugin_install_source_tree() {
149 einfo "Installing sources" 325 einfo "Installing sources"
150 destdir=${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN} 326 destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
151 insinto ${destdir}-${PV} 327 insinto "${destdir}-${PV}"
152 doins -r ${T}/source-tree/* 328 doins -r "${T}"/source-tree/*
153 329
154 dosym ${VDRPLUGIN}-${PV} ${destdir} 330 dosym "${VDRPLUGIN}-${PV}" "${destdir}"
155} 331}
156 332
333vdr-plugin_print_enable_command() {
334 local p_name c=0 l=""
335 for p_name in ${vdr_plugin_list}; do
336 c=$(( c+1 ))
337 l="$l ${p_name#vdr-}"
338 done
339
340 elog
341 case $c in
342 1) elog "Installed plugin${l}" ;;
343 *) elog "Installed $c plugins:${l}" ;;
344 esac
345 elog "To activate a plugin execute this command:"
346 elog "\teselect vdr-plugin enable <plugin_name> ..."
347 elog
348}
349
350has_vdr() {
351 [[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
352}
353
354## exported functions
355
356vdr-plugin_pkg_setup() {
357 # -fPIC is needed for shared objects on some platforms (amd64 and others)
358 append-flags -fPIC
359
360 # Plugins need to be compiled with position independent code, otherwise linking
361 # VDR against it will fail
362 if has_version ">=media-video/vdr-1.7.13"; then
363 append-lfs-flags
364 fi
365
366 # Where should the plugins live in the filesystem
367 VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins"
368 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
369
370 # was /usr/lib/... some time ago
371 # since gentoo-vdr-scripts-0.3.6 it works with /usr/share/...
372 VDR_RC_DIR="/usr/share/vdr/rcscript"
373
374 # Pathes to includes
375 VDR_INCLUDE_DIR="/usr/include/vdr"
376 DVB_INCLUDE_DIR="/usr/include"
377
378 TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
379 LOCDIR="/usr/share/locale"
380
381 if ! has_vdr; then
382 # set to invalid values to detect abuses
383 VDRVERSION="eclass_no_vdr_installed"
384 APIVERSION="eclass_no_vdr_installed"
385
386 if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then
387 einfo "VDR not found!"
388 else
389 # if vdr is required
390 die "VDR not found!"
391 fi
392 return
393 fi
394
395 VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
396 APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
397 [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
398
399 einfo "Compiling against"
400 einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
401
402
403 if [ -n "${VDR_LOCAL_PATCHES_DIR}" ]; then
404 eerror "Using VDR_LOCAL_PATCHES_DIR is deprecated!"
405 eerror "Please move all your patches into"
406 eerror "${EROOT}/etc/portage/patches/${CATEGORY}/${P}"
407 eerror "and remove or unset the VDR_LOCAL_PATCHES_DIR variable."
408 die
409 fi
410}
411
157vdr-plugin_src_compile() { 412vdr-plugin_src_util() {
158 [ -z "$1" ] && vdr-plugin_src_compile prepare compile
159
160 while [ "$1" ]; do 413 while [ "$1" ]; do
161
162 case "$1" in 414 case "$1" in
163 prepare) 415 all)
164 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree 416 vdr-plugin_src_util unpack add_local_patch patchmakefile i18n
165 ;; 417 ;;
166 compile) 418 prepare|all_but_unpack)
167 cd ${S} 419 vdr-plugin_src_util add_local_patch patchmakefile i18n
168 420 ;;
169 emake ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" 421 unpack)
422 base_src_unpack
423 ;;
424 add_local_patch)
425 cd "${S}" || die "Could not change to plugin-source-directory!"
426 epatch_user
427 ;;
428 patchmakefile)
429 cd "${S}" || die "Could not change to plugin-source-directory!"
430 vdr_patchmakefile
431 ;;
432 i18n)
433 # i18n-to-gettext tool removed starting with version 1.7.27
434 if has_version "<media-video/vdr-1.7.27"; then
435 cd "${S}" || die "Could not change to plugin-source-directory!"
436 vdr_i18n
437 fi
170 ;; 438 ;;
171 esac 439 esac
172 440
173 shift 441 shift
174 done 442 done
175} 443}
176 444
445vdr-plugin_src_unpack() {
446 # mark vdr-plugin.eclass deprecated
447 eerror "\n\tvdr-plugin.eclass is deprecated"
448 eerror "\tMaintainer: please fix your ebuilds to use"
449 eerror "\tvdr-plugin-2.eclass \n"
450
451 if [[ -z ${VDR_INCLUDE_DIR} ]]; then
452 eerror "Wrong use of vdr-plugin.eclass."
453 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup."
454 echo
455 eerror "Please report this at bugs.gentoo.org."
456 die "vdr-plugin_pkg_setup not called!"
457 fi
458 if [ -z "$1" ]; then
459 case "${EAPI:-0}" in
460 2|3|4|5)
461 vdr-plugin_src_util unpack
462 ;;
463 *)
464 vdr-plugin_src_util all
465 ;;
466 esac
467
468 else
469 vdr-plugin_src_util $@
470 fi
471}
472
473vdr-plugin_src_prepare() {
474 base_src_prepare
475 vdr-plugin_src_util prepare
476}
477
478vdr-plugin_src_compile() {
479 [ -z "$1" ] && vdr-plugin_src_compile copy_source compile
480
481 while [ "$1" ]; do
482
483 case "$1" in
484 copy_source)
485 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree
486 ;;
487 compile)
488 if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
489 eerror "Wrong use of vdr-plugin.eclass."
490 eerror "An ebuild for a vdr-plugin will not work without"
491 eerror "calling vdr-plugin_src_unpack to patch the Makefile."
492 echo
493 eerror "Please report this at bugs.gentoo.org."
494 die "vdr-plugin_src_unpack not called!"
495 fi
496 cd "${S}"
497
498 BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all}}
499
500 emake ${BUILD_PARAMS} \
501 ${BUILD_TARGETS} \
502 LOCALEDIR="${TMP_LOCALE_DIR}" \
503 LIBDIR="${S}" \
504 TMPDIR="${T}" \
505 || die "emake failed"
506 ;;
507 esac
508
509 shift
510 done
511}
512
177vdr-plugin_src_install() { 513vdr-plugin_src_install() {
178 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree 514 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree
515 cd "${WORKDIR}"
516
517 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
518 local mname="${P}-Makefile"
519 cp "${S}"/Makefile "${mname}.patched"
520 cp Makefile.before "${mname}.before"
521
522 diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
523
524 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
525 doins "${mname}.diff"
526
527 insinto "/usr/share/vdr/maintainer-data/makefile-before"
528 doins "${mname}.before"
529
530 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
531 doins "${mname}.patched"
532
533 fi
534
535
536
179 cd ${S} 537 cd "${S}"
180
181 insinto "${VDR_PLUGIN_DIR}" 538 insinto "${VDR_PLUGIN_DIR}"
182 doins libvdr-*.so.* 539 doins libvdr-*.so.*
183 dodoc README* HISTORY CHANGELOG
184 540
185 for f in ${FILESDIR}/confd-${PV} ${FILESDIR}/confd; do 541 # create list of all created plugin libs
186 if [[ -f "${f}" ]]; then 542 vdr_plugin_list=""
187 insinto /etc/conf.d 543 local p_name
188 newins "${f}" vdr.${VDRPLUGIN} 544 for p in libvdr-*.so.*; do
189 break 545 p_name="${p%.so*}"
190 fi 546 p_name="${p_name#lib}"
547 vdr_plugin_list="${vdr_plugin_list} ${p_name}"
191 done 548 done
192 549
193 for f in ${FILESDIR}/rc-addon-${PV}.sh ${FILESDIR}/rc-addon.sh; do 550 create_header_checksum_file ${vdr_plugin_list}
194 if [[ -f "${f}" ]]; then 551 create_plugindb_file ${vdr_plugin_list}
552
553 if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then
554 einfo "Installing locales"
555 cd "${TMP_LOCALE_DIR}"
195 insinto "${VDR_RC_DIR}" 556 insinto "${LOCDIR}"
196 newins "${f}" plugin-${VDRPLUGIN}.sh 557 doins -r *
197 break
198 fi 558 fi
559
560 cd "${S}"
561 local docfile
562 for docfile in README* HISTORY CHANGELOG; do
563 [[ -f ${docfile} ]] && dodoc ${docfile}
199 done 564 done
565
566 # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
567 [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd
568
569 if [[ -n ${VDR_CONFD_FILE} ]]; then
570 newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
571 fi
572
573
574 # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it
575 [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh
576
577 if [[ -n ${VDR_RCADDON_FILE} ]]; then
578 insinto "${VDR_RC_DIR}"
579 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
580 fi
200} 581}
201 582
202vdr-plugin_pkg_postinst() { 583vdr-plugin_pkg_postinst() {
203 update_vdrplugindb 584 vdr-plugin_print_enable_command
204 einfo 585
205 einfo "The vdr plugin ${VDRPLUGIN} has now been installed." 586 if [[ -n "${VDR_CONFD_FILE}" ]]; then
206 einfo "To activate execute the following command:" 587 elog "Please have a look at the config-file"
207 einfo 588 elog "\t/etc/conf.d/vdr.${VDRPLUGIN}"
208 einfo " emerge --config ${PN}" 589 elog
209 einfo 590 fi
210} 591}
211 592
212vdr-plugin_pkg_postrm() { 593vdr-plugin_pkg_postrm() {
213 remove_vdrplugindb 594 delete_orphan_plugindb_file
214}
215
216vdr-plugin_pkg_config_final() {
217 diff ${conf_orig} ${conf}
218 rm ${conf_orig}
219} 595}
220 596
221vdr-plugin_pkg_config() { 597vdr-plugin_pkg_config() {
222 if [[ -z "${INSTALLPLUGIN}" ]]; then 598:
223 INSTALLPLUGIN="${VDRPLUGIN}"
224 fi
225 # First test if plugin is already inside PLUGINS
226 local conf=/etc/conf.d/vdr
227 conf_orig=${conf}.before_emerge_config
228 cp ${conf} ${conf_orig}
229
230 einfo "Reading ${conf}"
231 if ! grep -q "^PLUGINS=" ${conf}; then
232 local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1)
233 if [[ -n "${LINE}" ]]; then
234 sed -e ${LINE}'a PLUGINS=""' -i ${conf}
235 else
236 echo 'PLUGINS=""' >> ${conf}
237 fi
238 unset LINE
239 fi
240
241 unset PLUGINS
242 PLUGINS=$(source /etc/conf.d/vdr; echo ${PLUGINS})
243
244 active=0
245 for p in ${PLUGINS}; do
246 if [[ "${p}" == "${INSTALLPLUGIN}" ]]; then
247 active=1
248 break;
249 fi
250 done
251
252 if [[ "${active}" == "1" ]]; then
253 einfo "${INSTALLPLUGIN} already activated"
254 echo
255 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
256 if [[ "${answer}" != "yes" ]]; then
257 einfo "aborted"
258 return
259 fi
260 einfo "Removing ${INSTALLPLUGIN} from active plugins."
261 local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1)
262 sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \
263 -e ${LINE}'s/ \( \)*/ /g' \
264 -e ${LINE}'s/ "/"/g' \
265 -e ${LINE}'s/" /"/g'
266
267 vdr-plugin_pkg_config_final
268 return
269 fi
270
271
272 einfo "Adding ${INSTALLPLUGIN} to active plugins."
273 local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1)
274 sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \
275 -e ${LINE}'s/ \( \)*/ /g' \
276 -e ${LINE}'s/ "/"/g' \
277 -e ${LINE}'s/" /"/g'
278
279 vdr-plugin_pkg_config_final
280} 599}
281 600
601case "${EAPI:-0}" in
602 2|3|4|5)
603 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
604 ;;
605 *)
282EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config 606 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config
607 ;;
608esac

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.93

  ViewVC Help
Powered by ViewVC 1.1.20