/[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.53 Revision 1.74
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/vdr-plugin.eclass,v 1.53 2008/02/13 19:44:44 zzam Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.74 2011/08/29 01:28:10 vapier Exp $
4# 4#
5# Author: 5# Author:
6# Matthias Schwarzott <zzam@gentoo.org> 6# Matthias Schwarzott <zzam@gentoo.org>
7# Joerg Bornkessel <hd_brummy@gentoo.org> 7# Joerg Bornkessel <hd_brummy@gentoo.org>
8 8
9# vdr-plugin.eclass 9# vdr-plugin.eclass
10# 10#
11# eclass to create ebuilds for vdr plugins 11# eclass to create ebuilds for vdr plugins
12# 12#
13 13
14# Example ebuild (vdr-femon): 14# Example ebuild (basic version without patching):
15# 15#
16# EAPI="2"
16# inherit vdr-plugin 17# inherit vdr-plugin
17# IUSE="" 18# IUSE=""
18# SLOT="0" 19# SLOT="0"
19# DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)" 20# DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)"
20# HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/" 21# HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/"
21# SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz" 22# SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz"
22# LICENSE="GPL-2" 23# LICENSE="GPL-2"
23# KEYWORDS="~x86" 24# KEYWORDS="~x86"
24# DEPEND=">=media-video/vdr-1.3.27" 25# DEPEND=">=media-video/vdr-1.6.0"
25# 26#
26# 27#
28
29# For patching you should modify src_prepare phase:
30#
31# src_prepare() {
32# epatch "${FILESDIR}"/${P}-xxx.patch
33# vdr-plugin_src_prepare
34# }
27 35
28# Installation of a config file for the plugin 36# Installation of a config file for the plugin
29# 37#
30# If ${VDR_CONFD_FILE} is set install this file 38# If ${VDR_CONFD_FILE} is set install this file
31# else install ${FILESDIR}/confd if it exists. 39# else install ${FILESDIR}/confd if it exists.
57# 65#
58# all patches which ending on diff or patch in this DIR will automatically applied 66# all patches which ending on diff or patch in this DIR will automatically applied
59# 67#
60 68
61inherit base multilib eutils flag-o-matic 69inherit base multilib eutils flag-o-matic
70
71if ! has "${EAPI:-0}" 0 1 2 3; then
72 die "API of vdr-plugin.eclass in EAPI=\"${EAPI}\" not established"
73fi
62 74
63IUSE="" 75IUSE=""
64 76
65# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes 77# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
66VDRPLUGIN="${PN/#vdrplugin-/}" 78VDRPLUGIN="${PN/#vdrplugin-/}"
71 83
72# works in most cases 84# works in most cases
73S="${WORKDIR}/${VDRPLUGIN}-${PV}" 85S="${WORKDIR}/${VDRPLUGIN}-${PV}"
74 86
75# depend on headers for DVB-driver 87# depend on headers for DVB-driver
76DEPEND=">=media-tv/gentoo-vdr-scripts-0.3.8 88COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
77 || ( >=media-tv/gentoo-vdr-scripts-0.4.2 >=media-tv/vdrplugin-rebuild-0.2 ) 89
78 >=app-admin/eselect-vdr-0.0.2 90DEPEND="${COMMON_DEPEND}
79 media-tv/linuxtv-dvb-headers" 91 media-tv/linuxtv-dvb-headers"
92RDEPEND="${COMMON_DEPEND}
93 >=app-admin/eselect-vdr-0.0.2"
80 94
95# this is a hack for ebuilds like vdr-xineliboutput that want to
96# conditionally install a vdr-plugin
97if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
98 # make DEPEND conditional
99 IUSE="${IUSE} vdr"
100 DEPEND="vdr? ( ${DEPEND} )"
101 RDEPEND="vdr? ( ${RDEPEND} )"
102fi
81 103
82# New method of storing plugindb 104# New method of storing plugindb
83# Called from src_install 105# Called from src_install
84# file maintained by normal portage-methods 106# file maintained by normal portage-methods
85create_plugindb_file() { 107create_plugindb_file() {
97 { 119 {
98 echo "VDRPLUGIN_DB=1" 120 echo "VDRPLUGIN_DB=1"
99 echo "CREATOR=ECLASS" 121 echo "CREATOR=ECLASS"
100 echo "EBUILD=${CATEGORY}/${PN}" 122 echo "EBUILD=${CATEGORY}/${PN}"
101 echo "EBUILD_V=${PVR}" 123 echo "EBUILD_V=${PVR}"
124 echo "PLUGINS=\"$@\""
102 } > "${D}/${DB_FILE}" 125 } > "${D}/${DB_FILE}"
103} 126}
104 127
105# Delete files created outside of vdr-plugin.eclass 128# Delete files created outside of vdr-plugin.eclass
106# vdrplugin-rebuild.ebuild converted plugindb and files are 129# vdrplugin-rebuild.ebuild converted plugindb and files are
130create_header_checksum_file() 153create_header_checksum_file()
131{ 154{
132 # Danger: Not using $ROOT here, as compile will also not use it !!! 155 # Danger: Not using $ROOT here, as compile will also not use it !!!
133 # If vdr in $ROOT and / differ, plugins will not run anyway 156 # If vdr in $ROOT and / differ, plugins will not run anyway
134 157
158 local CHKSUM="header-md5-vdr"
159
160 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
161 cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
162 elif type -p md5sum >/dev/null 2>&1; then
163 (
164 cd "${VDR_INCLUDE_DIR}"
165 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
166 ) > "${CHKSUM}"
167 else
168 die "Could not create md5 checksum of headers"
169 fi
170
135 insinto "${VDR_CHECKSUM_DIR}" 171 insinto "${VDR_CHECKSUM_DIR}"
136 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then 172 local p_name
137 newins "${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}" 173 for p_name; do
174 newins "${CHKSUM}" "header-md5-${p_name}"
175 done
176}
177
178fix_vdr_libsi_include()
179{
180 #einfo "Fixing include of libsi-headers"
181 local f
182 for f; do
183 sed -i "${f}" \
184 -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
185 -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
186 done
187}
188
189vdr_patchmakefile() {
190 einfo "Patching Makefile"
191 [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
192 cp Makefile "${WORKDIR}"/Makefile.before
193
194 # plugin makefiles use VDRDIR in strange ways
195 # assumptions:
196 # 1. $(VDRDIR) contains Make.config
197 # 2. $(VDRDIR) contains config.h
198 # 3. $(VDRDIR)/include/vdr contains the headers
199 # 4. $(VDRDIR) contains main vdr Makefile
200 # 5. $(VDRDIR)/locale exists
201 # 6. $(VDRDIR) allows to access vdr source files
202 #
203 # We only have one directory (for now /usr/include/vdr),
204 # that contains vdr-headers and Make.config.
205 # To satisfy 1-3 we do this:
206 # Set VDRDIR=/usr/include/vdr
207 # Set VDRINCDIR=/usr/include
208 # Change $(VDRDIR)/include to $(VDRINCDIR)
209
210 sed -i Makefile \
211 -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
212 -e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \
213 -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
214 \
215 -e 's:-I$(DVBDIR)/include::' \
216 -e 's:-I$(DVBDIR)::'
217
218 # maybe needed for multiproto:
219 #sed -i Makefile \
220 # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
221 # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
222
223 if ! grep -q APIVERSION Makefile; then
224 ebegin " Converting to APIVERSION"
225 sed -i Makefile \
226 -e 's:^APIVERSION = :APIVERSION ?= :' \
227 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
228 -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
229 eend $?
230 fi
231
232 # Correcting Compile-Flags
233 # Do not overwrite CXXFLAGS, add LDFLAGS if missing
234 sed -i Makefile \
235 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
236 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
237
238 # Disabling file stripping, useful for debugging
239 sed -i Makefile \
240 -e '/@.*strip/d' \
241 -e '/strip \$(LIBDIR)\/\$@/d' \
242 -e 's/STRIP.*=.*$/STRIP = true/'
243
244 # Use a file instead of a variable as single-stepping via ebuild
245 # destroys environment.
246 touch "${WORKDIR}"/.vdr-plugin_makefile_patched
247}
248
249vdr_add_local_patch() {
250 if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then
251 echo
252 einfo "Applying local patches"
253 for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do
254 test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
255 done
256 fi
257}
258
259vdr_has_gettext() {
260 has_version ">=media-video/vdr-1.5.7"
261}
262
263plugin_has_gettext() {
264 [[ -d po ]]
265}
266
267vdr_i18n_convert_to_gettext() {
268 local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
269
270 if [[ ${NO_GETTEXT_HACK} == "1" ]]; then
271 ewarn "Conversion to gettext disabled in ebuild"
272 return 1
273 fi
274
275 if [[ ! -x ${i18n_tool} ]]; then
276 eerror "Missing ${i18n_tool}"
277 eerror "Please re-emerge vdr"
278 die "Missing ${i18n_tool}"
279 fi
280
281 ebegin "Auto converting translations to gettext"
282 # call i18n-to-gettext tool
283 # take all texts missing tr call into special file
284 "${i18n_tool}" 2>/dev/null \
285 |sed -e '/^"/!d' \
286 -e '/^""$/d' \
287 -e 's/\(.*\)/trNOOP(\1)/' \
288 > dummy-translations-trNOOP.c
289
290 # if there were untranslated texts just run it again
291 # now the missing calls are listed in
292 # dummy-translations-trNOOP.c
293 if [[ -s dummy-translations-trNOOP.c ]]; then
294 "${i18n_tool}" &>/dev/null
295 fi
296
297 # now use the modified Makefile
298 if [[ -f Makefile.new ]]; then
299 mv Makefile.new Makefile
300 eend 0 ""
138 else 301 else
139 if type -p md5sum >/dev/null 2>&1; then 302 eend 1 "Conversion to gettext failed. Plugin needs fixing."
140 cd "${S}" 303 return 1
141 ( 304 fi
142 cd "${VDR_INCLUDE_DIR}" 305}
143 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2 306
144 ) > header-md5-${PN} 307vdr_i18n_disable_gettext() {
145 doins header-md5-${PN} 308 #einfo "Disabling gettext support in plugin"
309
310 # Remove i18n Target if using older vdr
311 sed -i Makefile \
312 -e '/^all:/s/ i18n//'
313}
314
315vdr_i18n() {
316 if vdr_has_gettext; then
317 #einfo "VDR has gettext support"
318 if plugin_has_gettext; then
319 #einfo "Plugin has gettext support, fine"
320 if [[ ${NO_GETTEXT_HACK} == "1" ]]; then
321 ewarn "Please remove unneeded NO_GETTEXT_HACK from ebuild."
322 fi
323 else
324 vdr_i18n_convert_to_gettext
325 if [[ $? != 0 ]]; then
326 eerror ""
327 eerror "Plugin will have only english OSD texts"
328 eerror "it needs manual fixing."
329 fi
146 fi 330 fi
331 else
332 #einfo "VDR has no gettext support"
333 if plugin_has_gettext; then
334 vdr_i18n_disable_gettext
147 fi 335 fi
336 fi
148} 337}
338
339vdr-plugin_copy_source_tree() {
340 pushd . >/dev/null
341 cp -r "${S}" "${T}"/source-tree
342 cd "${T}"/source-tree
343 cp "${WORKDIR}"/Makefile.before Makefile
344 # TODO: Fix this, maybe no longer needed
345 sed -i Makefile \
346 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
347 -e 's:^CXXFLAGS:#CXXFLAGS:' \
348 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
349 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
350 popd >/dev/null
351}
352
353vdr-plugin_install_source_tree() {
354 einfo "Installing sources"
355 destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
356 insinto "${destdir}-${PV}"
357 doins -r "${T}"/source-tree/*
358
359 dosym "${VDRPLUGIN}-${PV}" "${destdir}"
360}
361
362vdr-plugin_print_enable_command() {
363 local p_name c=0 l=""
364 for p_name in ${vdr_plugin_list}; do
365 c=$(( c+1 ))
366 l="$l ${p_name#vdr-}"
367 done
368
369 elog
370 case $c in
371 1) elog "Installed plugin${l}" ;;
372 *) elog "Installed $c plugins:${l}" ;;
373 esac
374 elog "To activate a plugin execute this command:"
375 elog "\teselect vdr-plugin enable <plugin_name> ..."
376 elog
377}
378
379has_vdr() {
380 [[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
381}
382
383## exported functions
149 384
150vdr-plugin_pkg_setup() { 385vdr-plugin_pkg_setup() {
151 # -fPIC is needed for shared objects on some platforms (amd64 and others) 386 # -fPIC is needed for shared objects on some platforms (amd64 and others)
152 append-flags -fPIC 387 append-flags -fPIC
153 388
389 # Plugins need to be compiled with position independent code, otherwise linking
390 # VDR against it will fail
391 if has_version ">=media-video/vdr-1.7.13"; then
392 append-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
393 fi
394
154 # Where should the plugins live in the filesystem 395 # Where should the plugins live in the filesystem
155 VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" 396 VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins"
156 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" 397 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
157 398
158 # was /usr/lib/... some time ago 399 # was /usr/lib/... some time ago
161 402
162 # Pathes to includes 403 # Pathes to includes
163 VDR_INCLUDE_DIR="/usr/include/vdr" 404 VDR_INCLUDE_DIR="/usr/include/vdr"
164 DVB_INCLUDE_DIR="/usr/include" 405 DVB_INCLUDE_DIR="/usr/include"
165 406
166
167 TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" 407 TMP_LOCALE_DIR="${WORKDIR}/tmp-locale"
168 LOCDIR="/usr/share/vdr/locale"
169 if has_version ">=media-video/vdr-1.5.7"; then 408 if has_version ">=media-video/vdr-1.7.17"; then
170 USE_GETTEXT=1 409 LOCDIR="/usr/share/locale"
171 else 410 else
172 USE_GETTEXT=0 411 LOCDIR="/usr/share/vdr/locale"
412 fi
413
414 if ! has_vdr; then
415 # set to invalid values to detect abuses
416 VDRVERSION="eclass_no_vdr_installed"
417 APIVERSION="eclass_no_vdr_installed"
418
419 if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then
420 einfo "VDR not found!"
421 else
422 # if vdr is required
423 die "VDR not found!"
424 fi
425 return
173 fi 426 fi
174 427
175 VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) 428 VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
176 APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) 429 APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
177 [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" 430 [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
178 431
179 einfo "Building ${PF} against vdr-${VDRVERSION}" 432 einfo "Compiling against"
180 einfo "APIVERSION: ${APIVERSION}" 433 einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
434}
435
436vdr-plugin_src_util() {
437
438 while [ "$1" ]; do
439
440 case "$1" in
441 all)
442 vdr-plugin_src_util unpack add_local_patch patchmakefile i18n
443 ;;
444 prepare|all_but_unpack)
445 vdr-plugin_src_util add_local_patch patchmakefile i18n
446 ;;
447 unpack)
448 base_src_unpack
449 ;;
450 add_local_patch)
451 cd "${S}" || die "Could not change to plugin-source-directory!"
452 vdr_add_local_patch
453 ;;
454 patchmakefile)
455 cd "${S}" || die "Could not change to plugin-source-directory!"
456 vdr_patchmakefile
457 ;;
458 i18n)
459 cd "${S}" || die "Could not change to plugin-source-directory!"
460 vdr_i18n
461 ;;
462 esac
463
464 shift
465 done
181} 466}
182 467
183vdr-plugin_src_unpack() { 468vdr-plugin_src_unpack() {
184 if [[ -z ${VDR_INCLUDE_DIR} ]]; then 469 if [[ -z ${VDR_INCLUDE_DIR} ]]; then
185 eerror "Wrong use of vdr-plugin.eclass." 470 eerror "Wrong use of vdr-plugin.eclass."
186 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup." 471 eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup."
187 echo 472 echo
188 eerror "Please report this at bugs.gentoo.org." 473 eerror "Please report this at bugs.gentoo.org."
189 die "vdr-plugin_pkg_setup not called!" 474 die "vdr-plugin_pkg_setup not called!"
190 fi 475 fi
191 [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile i18n 476 if [ -z "$1" ]; then
477 case "${EAPI:-0}" in
478 2|3)
479 vdr-plugin_src_util unpack
480 ;;
481 *)
482 vdr-plugin_src_util all
483 ;;
484 esac
485
486 else
487 vdr-plugin_src_util $@
488 fi
489}
490
491vdr-plugin_src_prepare() {
492 base_src_prepare
493 vdr-plugin_src_util prepare
494}
495
496vdr-plugin_src_compile() {
497 [ -z "$1" ] && vdr-plugin_src_compile copy_source compile
192 498
193 while [ "$1" ]; do 499 while [ "$1" ]; do
194 500
195 case "$1" in 501 case "$1" in
196 all_but_unpack) 502 copy_source)
197 vdr-plugin_src_unpack add_local_patch patchmakefile i18n
198 ;;
199 unpack)
200 base_src_unpack
201 ;;
202 patchmakefile)
203 if ! cd "${S}"; then
204 ewarn "There seems to be no plugin-directory with the name ${S##*/}"
205 ewarn "Perhaps you find one among these:"
206 cd "${WORKDIR}"
207 ewarn "$(/bin/ls -1 "${WORKDIR}")"
208 die "Could not change to plugin-source-directory!"
209 fi
210
211 einfo "Patching Makefile"
212 [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
213 cp Makefile "${WORKDIR}"/Makefile.before
214
215 sed -i Makefile \
216 -e '1i\#Makefile was patched by vdr-plugin.eclass'
217
218 ebegin " Setting Pathes"
219 sed -i Makefile \
220 -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
221 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
222 -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \
223 -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \
224 -e 's:-I$(VDRDIR)/include -I$(DVBDIR)/include:-I$(DVBDIR)/include -I$(VDRDIR)/include:' \
225 -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \
226 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
227 eend $?
228
229 ebegin " Converting to APIVERSION"
230 sed -i Makefile \
231 -e 's:^APIVERSION = :APIVERSION ?= :' \
232 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
233 -e '2i\APIVERSION = '"${APIVERSION}"
234 eend $?
235
236 ebegin " Correcting Compile-Flags"
237 sed -i Makefile \
238 -e 's:^CXXFLAGS:#CXXFLAGS:' \
239 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
240 eend $?
241
242 ebegin " Disabling file stripping"
243 sed -i Makefile \
244 -e '/@.*strip/d' \
245 -e '/strip \$(LIBDIR)\/\$@/d' \
246 -e '/^STRIP =/d' \
247 -e '/@.*\$(STRIP)/d'
248 eend $?
249
250 # Use a file instead of an variable as single-stepping via ebuild
251 # destroys environment.
252 touch "${WORKDIR}"/.vdr-plugin_makefile_patched
253 ;;
254 add_local_patch)
255 cd "${S}"
256 if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then
257 echo
258 einfo "Applying local patches"
259 for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do
260 test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
261 done
262 fi
263 ;;
264 i18n)
265 cd "${S}"
266 if [[ ${USE_GETTEXT} = 0 ]]; then
267 # Remove i18n Target if using older vdr
268 sed -i Makefile \
269 -e '/^all:/s/ i18n//'
270 elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then
271 einfo "Converting translations to gettext"
272
273 local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
274 if [[ ! -x ${i18n_tool} ]]; then
275 eerror "Missing ${i18n_tool}"
276 eerror "Please re-emerge vdr"
277 die "Missing ${i18n_tool}"
278 fi
279
280 # call i18n-to-gettext tool
281 # take all texts missing tr call into special file
282 "${i18n_tool}" 2>/dev/null \
283 |sed -e '/^"/!d' \
284 -e '/^""$/d' \
285 -e 's/\(.*\)/trNOOP(\1)/' \
286 > dummy-translations-trNOOP.c
287
288 # if there were untranslated texts just run it again
289 # now the missing calls are listed in
290 # dummy-translations-trNOOP.c
291 if [[ -s dummy-translations-trNOOP.c ]]; then
292 "${i18n_tool}" &>/dev/null
293 fi
294
295 # now use the modified Makefile
296 mv Makefile.new Makefile
297 fi
298 esac
299
300 shift
301 done
302}
303
304vdr-plugin_copy_source_tree() {
305 pushd . >/dev/null
306 cp -r "${S}" "${T}"/source-tree
307 cd "${T}"/source-tree
308 cp "${WORKDIR}"/Makefile.before Makefile
309 sed -i Makefile \
310 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
311 -e 's:^CXXFLAGS:#CXXFLAGS:' \
312 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
313 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
314 popd >/dev/null
315}
316
317vdr-plugin_install_source_tree() {
318 einfo "Installing sources"
319 destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
320 insinto "${destdir}-${PV}"
321 doins -r "${T}"/source-tree/*
322
323 dosym "${VDRPLUGIN}-${PV}" "${destdir}"
324}
325
326vdr-plugin_src_compile() {
327 [ -z "$1" ] && vdr-plugin_src_compile prepare compile
328
329 while [ "$1" ]; do
330
331 case "$1" in
332 prepare)
333 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree 503 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree
334 ;; 504 ;;
335 compile) 505 compile)
336 if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then 506 if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
337 eerror "Wrong use of vdr-plugin.eclass." 507 eerror "Wrong use of vdr-plugin.eclass."
341 eerror "Please report this at bugs.gentoo.org." 511 eerror "Please report this at bugs.gentoo.org."
342 die "vdr-plugin_src_unpack not called!" 512 die "vdr-plugin_src_unpack not called!"
343 fi 513 fi
344 cd "${S}" 514 cd "${S}"
345 515
516 BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all}}
517
346 emake ${BUILD_PARAMS} \ 518 emake ${BUILD_PARAMS} \
347 ${VDRPLUGIN_MAKE_TARGET:-all} \ 519 ${BUILD_TARGETS} \
348 LOCALEDIR="${TMP_LOCALE_DIR}" \ 520 LOCALEDIR="${TMP_LOCALE_DIR}" \
521 LIBDIR="${S}" \
522 TMPDIR="${T}" \
349 || die "emake failed" 523 || die "emake failed"
350 ;; 524 ;;
351 esac 525 esac
352 526
353 shift 527 shift
374 insinto "/usr/share/vdr/maintainer-data/makefile-patched" 548 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
375 doins "${mname}.patched" 549 doins "${mname}.patched"
376 550
377 fi 551 fi
378 552
553
554
379 cd "${S}" 555 cd "${S}"
380 insinto "${VDR_PLUGIN_DIR}" 556 insinto "${VDR_PLUGIN_DIR}"
381 doins libvdr-*.so.* 557 doins libvdr-*.so.*
382 558
383 if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then 559 # create list of all created plugin libs
560 vdr_plugin_list=""
561 local p_name
562 for p in libvdr-*.so.*; do
563 p_name="${p%.so*}"
564 p_name="${p_name#lib}"
565 vdr_plugin_list="${vdr_plugin_list} ${p_name}"
566 done
567
568 create_header_checksum_file ${vdr_plugin_list}
569 create_plugindb_file ${vdr_plugin_list}
570
571 if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then
384 einfo "Installing locales" 572 einfo "Installing locales"
385 cd "${TMP_LOCALE_DIR}" 573 cd "${TMP_LOCALE_DIR}"
386 insinto "${LOCDIR}" 574 insinto "${LOCDIR}"
387 doins -r * 575 doins -r *
388 fi 576 fi
406 594
407 if [[ -n ${VDR_RCADDON_FILE} ]]; then 595 if [[ -n ${VDR_RCADDON_FILE} ]]; then
408 insinto "${VDR_RC_DIR}" 596 insinto "${VDR_RC_DIR}"
409 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh 597 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
410 fi 598 fi
411
412 create_header_checksum_file
413 create_plugindb_file
414}
415
416vdr-plugin_print_enable_command() {
417 ewarn "emerge --config ${PN} is deprecated"
418 elog
419 elog "To activate this vdr-plugin execute the following command:"
420 elog "\teselect vdr-plugin enable ${PN#vdr-}"
421 elog
422} 599}
423 600
424vdr-plugin_pkg_postinst() { 601vdr-plugin_pkg_postinst() {
425 vdr-plugin_print_enable_command 602 vdr-plugin_print_enable_command
426 603
433 610
434vdr-plugin_pkg_postrm() { 611vdr-plugin_pkg_postrm() {
435 delete_orphan_plugindb_file 612 delete_orphan_plugindb_file
436} 613}
437 614
438vdr-plugin_pkg_config_legacy() {
439 elog "Using old interface to gentoo-vdr-scripts-0.3.7"
440 if [[ -z "${INSTALLPLUGIN}" ]]; then
441 INSTALLPLUGIN="${VDRPLUGIN}"
442 fi
443
444 active=0
445 # First test if plugin is already inside PLUGINS
446 local conf=/etc/conf.d/vdr.plugins
447 exec 3<${conf}
448 while read -u 3 line; do
449 [[ ${line} == "" ]] && continue
450 [[ ${line:0:1} == "#" ]] && continue
451 set -- ${line}
452 [[ ${1} == ${INSTALLPLUGIN} ]] && active=1
453 done
454 exec 3<&-
455
456 if [[ $active == 0 ]]; then
457 elog "Adding ${INSTALLPLUGIN} to active plugins."
458
459 # The pure edit process.
460 echo "${INSTALLPLUGIN}" >> "${conf}"
461 else
462 elog "${INSTALLPLUGIN} already activated"
463 echo
464 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
465 if [[ "${answer}" != "yes" ]]; then
466 elog "aborted"
467 return
468 fi
469 elog "Removing ${INSTALLPLUGIN} from active plugins."
470
471 # The pure edit process
472 sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d"
473 fi
474}
475
476vdr-plugin_pkg_config() { 615vdr-plugin_pkg_config() {
616 ewarn "emerge --config ${PN} is no longer supported"
477 vdr-plugin_print_enable_command 617 vdr-plugin_print_enable_command
478
479 einfo "Calling this now"
480 eselect vdr-plugin enable "${PN#vdr-}"
481} 618}
482 619
483fix_vdr_libsi_include() 620case "${EAPI:-0}" in
484{ 621 2|3)
485 einfo "Fixing include of libsi-headers" 622 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
486 local f 623 ;;
487 for f; do 624 *)
488 sed -i "${f}" \
489 -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
490 -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
491 done
492}
493
494EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config 625 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config
626 ;;
627esac

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.74

  ViewVC Help
Powered by ViewVC 1.1.20