/[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.37 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.37 2006/10/19 10:26:10 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"
216 -e 's:^APIVERSION = :APIVERSION ?= :' \ 236 -e 's:^APIVERSION = :APIVERSION ?= :' \
217 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \ 237 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
218 -e '2i\APIVERSION = '"${APIVERSION}" 238 -e '2i\APIVERSION = '"${APIVERSION}"
219 eend $? 239 eend $?
220 240
221 ebegin " Correcting CXXFLAGS" 241 ebegin " Correcting Compile-Flags"
222 sed -i Makefile \ 242 sed -i Makefile \
223 -e 's:^CXXFLAGS:#CXXFLAGS:' 243 -e 's:^CXXFLAGS:#CXXFLAGS:' \
244 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
224 eend $? 245 eend $?
225 246
226 ebegin " Disabling file stripping" 247 ebegin " Disabling file stripping"
227 sed -i Makefile \ 248 sed -i Makefile \
228 -e '/@.*strip/d' \ 249 -e '/@.*strip/d' \
253 274
254vdr-plugin_copy_source_tree() { 275vdr-plugin_copy_source_tree() {
255 pushd . >/dev/null 276 pushd . >/dev/null
256 cp -r ${S} ${T}/source-tree 277 cp -r ${S} ${T}/source-tree
257 cd ${T}/source-tree 278 cd ${T}/source-tree
258 mv Makefile.orig Makefile 279 cp "${WORKDIR}"/Makefile.before Makefile
259 sed -i Makefile \ 280 sed -i Makefile \
260 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ 281 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
261 -e 's:^CXXFLAGS:#CXXFLAGS:' \ 282 -e 's:^CXXFLAGS:#CXXFLAGS:' \
262 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ 283 -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
263 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' 284 -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
301 done 322 done
302} 323}
303 324
304vdr-plugin_src_install() { 325vdr-plugin_src_install() {
305 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree 326 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree
306 cd ${S} 327 cd "${WORKDIR}"
307 328
308 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then 329 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
309 local mname=${P}-Makefile 330 local mname=${P}-Makefile
310 cp Makefile ${mname}.patched 331 cp "${S}"/Makefile ${mname}.patched
311 cp Makefile.orig ${mname}.before 332 cp Makefile.before ${mname}.before
312 333
313 diff -u ${mname}.before ${mname}.patched > ${mname}.diff 334 diff -u ${mname}.before ${mname}.patched > ${mname}.diff
314 335
315 insinto "/usr/share/vdr/maintainer-data/makefile-changes" 336 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
316 doins ${mname}.diff 337 doins ${mname}.diff
321 insinto "/usr/share/vdr/maintainer-data/makefile-patched" 342 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
322 doins ${mname}.patched 343 doins ${mname}.patched
323 344
324 fi 345 fi
325 346
347 cd "${S}"
326 insinto "${VDR_PLUGIN_DIR}" 348 insinto "${VDR_PLUGIN_DIR}"
327 doins libvdr-*.so.* 349 doins libvdr-*.so.*
328 local docfile 350 local docfile
329 for docfile in README* HISTORY CHANGELOG; do 351 for docfile in README* HISTORY CHANGELOG; do
330 [[ -f ${docfile} ]] && dodoc ${docfile} 352 [[ -f ${docfile} ]] && dodoc ${docfile}
332 354
333 # 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
334 [[ -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
335 357
336 if [[ -n ${VDR_CONFD_FILE} ]]; then 358 if [[ -n ${VDR_CONFD_FILE} ]]; then
337 insinto /etc/conf.d
338 newins "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} 359 newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN}
339 fi 360 fi
340 361
341 362
342 # 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
343 [[ -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
345 if [[ -n ${VDR_RCADDON_FILE} ]]; then 366 if [[ -n ${VDR_RCADDON_FILE} ]]; then
346 insinto "${VDR_RC_DIR}" 367 insinto "${VDR_RC_DIR}"
347 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh 368 newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh
348 fi 369 fi
349 370
350 371 create_header_checksum_file
351
352 insinto ${VDR_CHECKSUM_DIR}
353 if [[ -f ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
354 newins ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}
355 else
356 if which md5sum >/dev/null 2>&1; then
357 cd ${S}
358 (
359 cd ${ROOT}${VDR_INCLUDE_DIR}
360 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
361 ) > header-md5-${PN}
362 doins header-md5-${PN}
363 fi
364 fi
365
366 create_plugindb_file 372 create_plugindb_file
367} 373}
368 374
369vdr-plugin_pkg_postinst() { 375vdr-plugin_pkg_postinst() {
370 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then 376 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
371 update_vdrplugindb 377 update_vdrplugindb
372 fi 378 fi
373 einfo 379 elog
374 einfo "The vdr plugin ${VDRPLUGIN} has now been installed." 380 elog "The vdr plugin ${VDRPLUGIN} has now been installed."
375 einfo "To activate execute the following command:" 381 elog "To activate execute the following command:"
376 einfo 382 elog
377 einfo " emerge --config ${PN}" 383 elog " emerge --config ${PN}"
378 einfo 384 elog
379 if [[ -n "${VDR_CONFD_FILE}" ]]; then 385 if [[ -n "${VDR_CONFD_FILE}" ]]; then
380 einfo "And have a look at the config-file" 386 elog "And have a look at the config-file"
381 einfo "/etc/conf.d/vdr.${VDRPLUGIN}" 387 elog "/etc/conf.d/vdr.${VDRPLUGIN}"
382 einfo 388 elog
383 fi 389 fi
384} 390}
385 391
386vdr-plugin_pkg_postrm() { 392vdr-plugin_pkg_postrm() {
387 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then 393 if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
394 diff ${conf_orig} ${conf} 400 diff ${conf_orig} ${conf}
395 rm ${conf_orig} 401 rm ${conf_orig}
396} 402}
397 403
398vdr-plugin_pkg_config_old() { 404vdr-plugin_pkg_config_old() {
399 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"
400 if [[ -z "${INSTALLPLUGIN}" ]]; then 406 if [[ -z "${INSTALLPLUGIN}" ]]; then
401 INSTALLPLUGIN="${VDRPLUGIN}" 407 INSTALLPLUGIN="${VDRPLUGIN}"
402 fi 408 fi
403 # First test if plugin is already inside PLUGINS 409 # First test if plugin is already inside PLUGINS
404 local conf=/etc/conf.d/vdr 410 local conf=/etc/conf.d/vdr
405 conf_orig=${conf}.before_emerge_config 411 conf_orig=${conf}.before_emerge_config
406 cp ${conf} ${conf_orig} 412 cp ${conf} ${conf_orig}
407 413
408 einfo "Reading ${conf}" 414 elog "Reading ${conf}"
409 if ! grep -q "^PLUGINS=" ${conf}; then 415 if ! grep -q "^PLUGINS=" ${conf}; then
410 local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) 416 local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1)
411 if [[ -n "${LINE}" ]]; then 417 if [[ -n "${LINE}" ]]; then
412 sed -e ${LINE}'a PLUGINS=""' -i ${conf} 418 sed -e ${LINE}'a PLUGINS=""' -i ${conf}
413 else 419 else
426 break; 432 break;
427 fi 433 fi
428 done 434 done
429 435
430 if [[ "${active}" == "1" ]]; then 436 if [[ "${active}" == "1" ]]; then
431 einfo "${INSTALLPLUGIN} already activated" 437 elog "${INSTALLPLUGIN} already activated"
432 echo 438 echo
433 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer 439 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
434 if [[ "${answer}" != "yes" ]]; then 440 if [[ "${answer}" != "yes" ]]; then
435 einfo "aborted" 441 elog "aborted"
436 return 442 return
437 fi 443 fi
438 einfo "Removing ${INSTALLPLUGIN} from active plugins." 444 elog "Removing ${INSTALLPLUGIN} from active plugins."
439 local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) 445 local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1)
440 sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ 446 sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \
441 -e ${LINE}'s/ \( \)*/ /g' \ 447 -e ${LINE}'s/ \( \)*/ /g' \
442 -e ${LINE}'s/ "/"/g' \ 448 -e ${LINE}'s/ "/"/g' \
443 -e ${LINE}'s/" /"/g' 449 -e ${LINE}'s/" /"/g'
445 vdr-plugin_pkg_config_final 451 vdr-plugin_pkg_config_final
446 return 452 return
447 fi 453 fi
448 454
449 455
450 einfo "Adding ${INSTALLPLUGIN} to active plugins." 456 elog "Adding ${INSTALLPLUGIN} to active plugins."
451 local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) 457 local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1)
452 sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ 458 sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \
453 -e ${LINE}'s/ \( \)*/ /g' \ 459 -e ${LINE}'s/ \( \)*/ /g' \
454 -e ${LINE}'s/ "/"/g' \ 460 -e ${LINE}'s/ "/"/g' \
455 -e ${LINE}'s/" /"/g' 461 -e ${LINE}'s/" /"/g'
456 462
457 vdr-plugin_pkg_config_final 463 vdr-plugin_pkg_config_final
458} 464}
459 465
460vdr-plugin_pkg_config_new() { 466vdr-plugin_pkg_config_new() {
461 einfo "Using interface introduced with gentoo-vdr-scripts-0.3.7" 467 elog "Using interface introduced with gentoo-vdr-scripts-0.3.7"
462 if [[ -z "${INSTALLPLUGIN}" ]]; then 468 if [[ -z "${INSTALLPLUGIN}" ]]; then
463 INSTALLPLUGIN="${VDRPLUGIN}" 469 INSTALLPLUGIN="${VDRPLUGIN}"
464 fi 470 fi
465 471
466 active=0 472 active=0
474 [[ ${1} == ${INSTALLPLUGIN} ]] && active=1 480 [[ ${1} == ${INSTALLPLUGIN} ]] && active=1
475 done 481 done
476 exec 3<&- 482 exec 3<&-
477 483
478 if [[ $active == 0 ]]; then 484 if [[ $active == 0 ]]; then
479 einfo "Adding ${INSTALLPLUGIN} to active plugins." 485 elog "Adding ${INSTALLPLUGIN} to active plugins."
480 486
481 # The pure edit process. 487 # The pure edit process.
482 echo "${INSTALLPLUGIN}" >> "${conf}" 488 echo "${INSTALLPLUGIN}" >> "${conf}"
483 else 489 else
484 einfo "${INSTALLPLUGIN} already activated" 490 elog "${INSTALLPLUGIN} already activated"
485 echo 491 echo
486 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer 492 read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
487 if [[ "${answer}" != "yes" ]]; then 493 if [[ "${answer}" != "yes" ]]; then
488 einfo "aborted" 494 elog "aborted"
489 return 495 return
490 fi 496 fi
491 einfo "Removing ${INSTALLPLUGIN} from active plugins." 497 elog "Removing ${INSTALLPLUGIN} from active plugins."
492 498
493 # The pure edit process 499 # The pure edit process
494 sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d" 500 sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d"
495 fi 501 fi
496} 502}

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

  ViewVC Help
Powered by ViewVC 1.1.20