/[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.38 Revision 1.47
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/Attic/vdr-plugin.eclass,v 1.38 2006/11/01 14:32:22 zzam Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/vdr-plugin.eclass,v 1.47 2007/08/14 14:47:21 zzam 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
58# all patches which ending on diff or patch in this DIR will automatically applied 58# all patches which ending on diff or patch in this DIR will automatically applied
59# 59#
60 60
61inherit base multilib eutils flag-o-matic 61inherit base multilib eutils flag-o-matic
62 62
63IUSE="debug" 63IUSE=""
64 64
65# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes 65# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
66VDRPLUGIN="${PN/#vdrplugin-/}" 66VDRPLUGIN="${PN/#vdrplugin-/}"
67VDRPLUGIN="${VDRPLUGIN/#vdr-/}" 67VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
68VDRPLUGIN="${VDRPLUGIN/%-cvs/}" 68VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
119# vdrplugin-rebuild.ebuild converted plugindb and files are 119# vdrplugin-rebuild.ebuild converted plugindb and files are
120# not deleted by portage itself - should only be needed as 120# not deleted by portage itself - should only be needed as
121# long as not every system has switched over to 121# long as not every system has switched over to
122# vdrplugin-rebuild-0.2 122# vdrplugin-rebuild-0.2
123delete_orphan_plugindb_file() { 123delete_orphan_plugindb_file() {
124 #einfo Testing for orphaned plugindb file 124 #elog Testing for orphaned plugindb file
125 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/ 125 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
126 local DB_FILE=${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF} 126 local DB_FILE=${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}
127 127
128 # file exists 128 # file exists
129 [[ -f ${DB_FILE} ]] || return 129 [[ -f ${DB_FILE} ]] || return
130 130
131 # will portage handle the file itself 131 # will portage handle the file itself
132 if grep -q CREATOR=ECLASS ${DB_FILE}; then 132 if grep -q CREATOR=ECLASS ${DB_FILE}; then
133 #einfo file owned by eclass - don't touch it 133 #elog file owned by eclass - don't touch it
134 return 134 return
135 fi 135 fi
136 136
137 einfo "Removing orphaned plugindb-file." 137 elog "Removing orphaned plugindb-file."
138 einfo "#rm ${DB_FILE}" 138 elog "\t#rm ${DB_FILE}"
139 rm ${DB_FILE} 139 rm ${DB_FILE}
140}
141
142
143create_header_checksum_file()
144{
145 # Danger: Not using $ROOT here, as compile will also not use it !!!
146 # If vdr in $ROOT and / differ, plugins will not run anyway
147
148 insinto ${VDR_CHECKSUM_DIR}
149 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
150 newins ${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}
151 else
152 if type -p md5sum >/dev/null 2>&1; then
153 cd ${S}
154 (
155 cd ${VDR_INCLUDE_DIR}
156 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
157 ) > header-md5-${PN}
158 doins header-md5-${PN}
159 fi
160 fi
140} 161}
141 162
142vdr-plugin_pkg_setup() { 163vdr-plugin_pkg_setup() {
143 # -fPIC is needed for shared objects on some platforms (amd64 and others) 164 # -fPIC is needed for shared objects on some platforms (amd64 and others)
144 append-flags -fPIC 165 append-flags -fPIC
145 use debug && append-flags -g
146 166
147 # Where should the plugins live in the filesystem 167 # Where should the plugins live in the filesystem
148 VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" 168 VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins"
149 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" 169 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
150 170
187 patchmakefile) 207 patchmakefile)
188 if ! cd ${S}; then 208 if ! cd ${S}; then
189 ewarn "There seems to be no plugin-directory with the name ${S##*/}" 209 ewarn "There seems to be no plugin-directory with the name ${S##*/}"
190 ewarn "Perhaps you find one among these:" 210 ewarn "Perhaps you find one among these:"
191 cd "${WORKDIR}" 211 cd "${WORKDIR}"
192 einfo "$(/bin/ls -1 ${WORKDIR})" 212 ewarn "$(/bin/ls -1 ${WORKDIR})"
193 die "Could not change to plugin-source-directory!" 213 die "Could not change to plugin-source-directory!"
194 fi 214 fi
195 215
196 einfo "Patching Makefile" 216 einfo "Patching Makefile"
197 [[ -e Makefile ]] || die "Makefile of plugin can not be found!" 217 [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
198 cp Makefile Makefile.orig 218 cp Makefile "${WORKDIR}"/Makefile.before
199 219
200 sed -i Makefile \ 220 sed -i Makefile \
201 -e '1i\#Makefile was patched by vdr-plugin.eclass' 221 -e '1i\#Makefile was patched by vdr-plugin.eclass'
202 222
203 ebegin " Setting Pathes" 223 ebegin " Setting Pathes"
254 274
255vdr-plugin_copy_source_tree() { 275vdr-plugin_copy_source_tree() {
256 pushd . >/dev/null 276 pushd . >/dev/null
257 cp -r ${S} ${T}/source-tree 277 cp -r ${S} ${T}/source-tree
258 cd ${T}/source-tree 278 cd ${T}/source-tree
259 mv Makefile.orig Makefile 279 cp "${WORKDIR}"/Makefile.before Makefile
260 sed -i Makefile \ 280 sed -i Makefile \
261 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ 281 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
262 -e 's:^CXXFLAGS:#CXXFLAGS:' \ 282 -e 's:^CXXFLAGS:#CXXFLAGS:' \
263 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ 283 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
264 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' 284 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
302 done 322 done
303} 323}
304 324
305vdr-plugin_src_install() { 325vdr-plugin_src_install() {
306 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree 326 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree
307 cd ${S} 327 cd "${WORKDIR}"
308 328
309 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then 329 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
310 local mname=${P}-Makefile 330 local mname=${P}-Makefile
311 cp Makefile ${mname}.patched 331 cp "${S}"/Makefile ${mname}.patched
312 cp Makefile.orig ${mname}.before 332 cp Makefile.before ${mname}.before
313 333
314 diff -u ${mname}.before ${mname}.patched > ${mname}.diff 334 diff -u ${mname}.before ${mname}.patched > ${mname}.diff
315 335
316 insinto "/usr/share/vdr/maintainer-data/makefile-changes" 336 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
317 doins ${mname}.diff 337 doins ${mname}.diff
322 insinto "/usr/share/vdr/maintainer-data/makefile-patched" 342 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
323 doins ${mname}.patched 343 doins ${mname}.patched
324 344
325 fi 345 fi
326 346
347 cd "${S}"
327 insinto "${VDR_PLUGIN_DIR}" 348 insinto "${VDR_PLUGIN_DIR}"
328 doins libvdr-*.so.* 349 doins libvdr-*.so.*
329 local docfile 350 local docfile
330 for docfile in README* HISTORY CHANGELOG; do 351 for docfile in README* HISTORY CHANGELOG; do
331 [[ -f ${docfile} ]] && dodoc ${docfile} 352 [[ -f ${docfile} ]] && dodoc ${docfile}
333 354
334 # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it 355 # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
335 [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd 356 [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd
336 357
337 if [[ -n ${VDR_CONFD_FILE} ]]; then 358 if [[ -n ${VDR_CONFD_FILE} ]]; then
338 insinto /etc/conf.d
339 newins "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} 359 newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
340 fi 360 fi
341 361
342 362
343 # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it 363 # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it
344 [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh 364 [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh
346 if [[ -n ${VDR_RCADDON_FILE} ]]; then 366 if [[ -n ${VDR_RCADDON_FILE} ]]; then
347 insinto "${VDR_RC_DIR}" 367 insinto "${VDR_RC_DIR}"
348 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh 368 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
349 fi 369 fi
350 370
351 371 create_header_checksum_file
352
353 insinto ${VDR_CHECKSUM_DIR}
354 if [[ -f ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
355 newins ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}
356 else
357 if which md5sum >/dev/null 2>&1; then
358 cd ${S}
359 (
360 cd ${ROOT}${VDR_INCLUDE_DIR}
361 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
362 ) > header-md5-${PN}
363 doins header-md5-${PN}
364 fi
365 fi
366
367 create_plugindb_file 372 create_plugindb_file
368} 373}
369 374
370vdr-plugin_pkg_postinst() { 375vdr-plugin_pkg_postinst() {
371 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then 376 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
372 update_vdrplugindb 377 update_vdrplugindb
373 fi 378 fi
374 einfo 379 elog
375 einfo "The vdr plugin ${VDRPLUGIN} has now been installed." 380 elog "The vdr plugin ${VDRPLUGIN} has now been installed."
376 einfo "To activate execute the following command:" 381 elog "To activate execute the following command:"
377 einfo 382 elog
378 einfo " emerge --config ${PN}" 383 elog " emerge --config ${PN}"
379 einfo 384 elog
380 if [[ -n "${VDR_CONFD_FILE}" ]]; then 385 if [[ -n "${VDR_CONFD_FILE}" ]]; then
381 einfo "And have a look at the config-file" 386 elog "And have a look at the config-file"
382 einfo "/etc/conf.d/vdr.${VDRPLUGIN}" 387 elog "/etc/conf.d/vdr.${VDRPLUGIN}"
383 einfo 388 elog
384 fi 389 fi
385} 390}
386 391
387vdr-plugin_pkg_postrm() { 392vdr-plugin_pkg_postrm() {
388 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then 393 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
395 diff ${conf_orig} ${conf} 400 diff ${conf_orig} ${conf}
396 rm ${conf_orig} 401 rm ${conf_orig}
397} 402}
398 403
399vdr-plugin_pkg_config_old() { 404vdr-plugin_pkg_config_old() {
400 einfo "Using interface of gentoo-vdr-scripts-0.3.6 and older" 405 elog "Using interface of gentoo-vdr-scripts-0.3.6 and older"
401 if [[ -z "${INSTALLPLUGIN}" ]]; then 406 if [[ -z "${INSTALLPLUGIN}" ]]; then
402 INSTALLPLUGIN="${VDRPLUGIN}" 407 INSTALLPLUGIN="${VDRPLUGIN}"
403 fi 408 fi
404 # First test if plugin is already inside PLUGINS 409 # First test if plugin is already inside PLUGINS
405 local conf=/etc/conf.d/vdr 410 local conf=/etc/conf.d/vdr
406 conf_orig=${conf}.before_emerge_config 411 conf_orig=${conf}.before_emerge_config
407 cp ${conf} ${conf_orig} 412 cp ${conf} ${conf_orig}
408 413
409 einfo "Reading ${conf}" 414 elog "Reading ${conf}"
410 if ! grep -q "^PLUGINS=" ${conf}; then 415 if ! grep -q "^PLUGINS=" ${conf}; then
411 local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) 416 local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1)
412 if [[ -n "${LINE}" ]]; then 417 if [[ -n "${LINE}" ]]; then
413 sed -e ${LINE}'a PLUGINS=""' -i ${conf} 418 sed -e ${LINE}'a PLUGINS=""' -i ${conf}
414 else 419 else
427 break; 432 break;
428 fi 433 fi
429 done 434 done
430 435
431 if [[ "${active}" == "1" ]]; then 436 if [[ "${active}" == "1" ]]; then
432 einfo "${INSTALLPLUGIN} already activated" 437 elog "${INSTALLPLUGIN} already activated"
433 echo 438 echo
434 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer 439 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
435 if [[ "${answer}" != "yes" ]]; then 440 if [[ "${answer}" != "yes" ]]; then
436 einfo "aborted" 441 elog "aborted"
437 return 442 return
438 fi 443 fi
439 einfo "Removing ${INSTALLPLUGIN} from active plugins." 444 elog "Removing ${INSTALLPLUGIN} from active plugins."
440 local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) 445 local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1)
441 sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ 446 sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \
442 -e ${LINE}'s/ \( \)*/ /g' \ 447 -e ${LINE}'s/ \( \)*/ /g' \
443 -e ${LINE}'s/ "/"/g' \ 448 -e ${LINE}'s/ "/"/g' \
444 -e ${LINE}'s/" /"/g' 449 -e ${LINE}'s/" /"/g'
446 vdr-plugin_pkg_config_final 451 vdr-plugin_pkg_config_final
447 return 452 return
448 fi 453 fi
449 454
450 455
451 einfo "Adding ${INSTALLPLUGIN} to active plugins." 456 elog "Adding ${INSTALLPLUGIN} to active plugins."
452 local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) 457 local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1)
453 sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ 458 sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \
454 -e ${LINE}'s/ \( \)*/ /g' \ 459 -e ${LINE}'s/ \( \)*/ /g' \
455 -e ${LINE}'s/ "/"/g' \ 460 -e ${LINE}'s/ "/"/g' \
456 -e ${LINE}'s/" /"/g' 461 -e ${LINE}'s/" /"/g'
457 462
458 vdr-plugin_pkg_config_final 463 vdr-plugin_pkg_config_final
459} 464}
460 465
461vdr-plugin_pkg_config_new() { 466vdr-plugin_pkg_config_new() {
462 einfo "Using interface introduced with gentoo-vdr-scripts-0.3.7" 467 elog "Using interface introduced with gentoo-vdr-scripts-0.3.7"
463 if [[ -z "${INSTALLPLUGIN}" ]]; then 468 if [[ -z "${INSTALLPLUGIN}" ]]; then
464 INSTALLPLUGIN="${VDRPLUGIN}" 469 INSTALLPLUGIN="${VDRPLUGIN}"
465 fi 470 fi
466 471
467 active=0 472 active=0
475 [[ ${1} == ${INSTALLPLUGIN} ]] && active=1 480 [[ ${1} == ${INSTALLPLUGIN} ]] && active=1
476 done 481 done
477 exec 3<&- 482 exec 3<&-
478 483
479 if [[ $active == 0 ]]; then 484 if [[ $active == 0 ]]; then
480 einfo "Adding ${INSTALLPLUGIN} to active plugins." 485 elog "Adding ${INSTALLPLUGIN} to active plugins."
481 486
482 # The pure edit process. 487 # The pure edit process.
483 echo "${INSTALLPLUGIN}" >> "${conf}" 488 echo "${INSTALLPLUGIN}" >> "${conf}"
484 else 489 else
485 einfo "${INSTALLPLUGIN} already activated" 490 elog "${INSTALLPLUGIN} already activated"
486 echo 491 echo
487 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer 492 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
488 if [[ "${answer}" != "yes" ]]; then 493 if [[ "${answer}" != "yes" ]]; then
489 einfo "aborted" 494 elog "aborted"
490 return 495 return
491 fi 496 fi
492 einfo "Removing ${INSTALLPLUGIN} from active plugins." 497 elog "Removing ${INSTALLPLUGIN} from active plugins."
493 498
494 # The pure edit process 499 # The pure edit process
495 sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d" 500 sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d"
496 fi 501 fi
497} 502}

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20