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

Diff of /eclass/vdr-plugin-2.eclass

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

Revision 1.21 Revision 1.22
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 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-2.eclass,v 1.21 2013/01/27 13:32:44 hd_brummy Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin-2.eclass,v 1.22 2013/03/05 09:09:17 hd_brummy Exp $
4 4
5# @ECLASS: vdr-plugin-2.eclass 5# @ECLASS: vdr-plugin-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# vdr@gentoo.org 7# vdr@gentoo.org
8# @BLURB: common vdr plugin ebuild functions 8# @BLURB: common vdr plugin ebuild functions
101 echo "EBUILD=${CATEGORY}/${PN}" 101 echo "EBUILD=${CATEGORY}/${PN}"
102 echo "EBUILD_V=${PVR}" 102 echo "EBUILD_V=${PVR}"
103 echo "PLUGINS=\"$@\"" 103 echo "PLUGINS=\"$@\""
104 } > "${D}/${DB_FILE}" 104 } > "${D}/${DB_FILE}"
105} 105}
106
107# Delete files created outside of vdr-plugin-2.eclass
108# vdrplugin-rebuild.ebuild converted plugindb and files are
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}"
116
117 # file exists
118 [[ -f ${DB_FILE} ]] || return
119
120 # will portage handle the file itself
121 if grep -q CREATOR=ECLASS "${DB_FILE}"; then
122 #elog file owned by eclass - don't touch it
123 return
124 fi
125
126 elog "Removing orphaned plugindb-file."
127 elog "\t#rm ${DB_FILE}"
128 rm "${DB_FILE}"
129}
130
131 106
132create_header_checksum_file() { 107create_header_checksum_file() {
133 # Danger: Not using $ROOT here, as compile will also not use it !!! 108 # Danger: Not using $ROOT here, as compile will also not use it !!!
134 # If vdr in $ROOT and / differ, plugins will not run anyway 109 # If vdr in $ROOT and / differ, plugins will not run anyway
135 110
210 # Do not overwrite CXXFLAGS, add LDFLAGS if missing 185 # Do not overwrite CXXFLAGS, add LDFLAGS if missing
211 sed -i Makefile \ 186 sed -i Makefile \
212 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \ 187 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
213 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:' 188 -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
214 189
215 # Do not use {C,CXX}FLAGS from pkg-config vdr.pc, >=media-video/vdr-1.7.34
216 # we do not have the chance to overwrite it with *.eclass
217 sed -e "/^export[[:space:]]*CFLAGS[[:space:]]*=/s/=/?=/" \
218 -e "/^export[[:space:]]*CXXFLAGS[[:space:]]*=/s/=/?=/" \
219 -i Makefile
220
221 # Disabling file stripping, the package manager takes care of it 190 # Disabling file stripping, the package manager takes care of it
222 sed -i Makefile \ 191 sed -i Makefile \
223 -e '/@.*strip/d' \ 192 -e '/@.*strip/d' \
224 -e '/strip \$(LIBDIR)\/\$@/d' \ 193 -e '/strip \$(LIBDIR)\/\$@/d' \
225 -e 's/STRIP.*=.*$/STRIP = true/' 194 -e 's/STRIP.*=.*$/STRIP = true/'
246 dev_check "Plugin isn't converted to gettext handling \n" 215 dev_check "Plugin isn't converted to gettext handling \n"
247 fi 216 fi
248} 217}
249 218
250detect_po_dir() { 219detect_po_dir() {
251# Some plugins have po/ in a subdir 220# Some plugins have /po in a subdir
252# set PO_SUBDIR in .ebuild 221# set PO_SUBDIR in .ebuild
253# i.e media-plugins/vdr-streamdev 222# i.e media-plugins/vdr-streamdev
254# PO_SUBDIR="client server" 223# PO_SUBDIR="client server"
255 224
256 [[ -f po ]] && local po_dir="${S}" 225 [[ -f po ]] && local po_dir="${S}"
257 local po_subdir=( ${S}/${PO_SUBDIR} ) 226 local po_subdir=( ${S}/${PO_SUBDIR} )
258 local f 227 local f
259 228
260 pofile_dir=( ${po_dir} ${po_subdir[*]} ) 229 pofile_dir=( ${po_dir} ${po_subdir[*]} )
261
262 # maintainer check
263 if [[ ! -d ${pofile_dir[*]} ]]; then
264 dev_check "po dir not found? May be in subdir? \n"
265 fi
266} 230}
267 231
268linguas_support() { 232linguas_support() {
269# Patching Makefile for linguas support. 233# Patching Makefile for linguas support.
270# Only locales, enabled through the LINGUAS (make.conf) variable will be 234# Only locales, enabled through the LINGUAS (make.conf) variable will be
271# "compiled" and installed. 235# "compiled" and installed.
272#
273 236
274 einfo "Patching for Linguas support" 237 einfo "Patching for Linguas support"
275 einfo "available Languages for ${P} are:" 238 einfo "available Languages for ${P} are:"
276 239
277 detect_po_dir 240 detect_po_dir
278 241
279 for f in ${pofile_dir[*]}; do 242 for f in ${pofile_dir[*]}; do
280
281 PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' ) 243 PLUGIN_LINGUAS=$( ls ${f}/po --ignore="*.pot" | sed -e "s:.po::g" | cut -d_ -f1 | tr \\\012 ' ' )
282 einfo "LINGUAS=\"${PLUGIN_LINGUAS}\"" 244 einfo "LINGUAS=\"${PLUGIN_LINGUAS}\""
283 245
284 sed -i ${f}/Makefile \ 246 sed -i ${f}/Makefile \
285 -e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \ 247 -e 's:\$(wildcard[[:space:]]*\$(PODIR)/\*.po):\$(foreach dir,\$(LINGUAS),\$(wildcard \$(PODIR)\/\$(dir)\*.po)):' \
340 302
341 dev_check "removed i18n.h for ${@}" 303 dev_check "removed i18n.h for ${@}"
342} 304}
343# end new vdr-plugin-2.eclass content 305# end new vdr-plugin-2.eclass content
344 306
345# ToDo: we don't support included plugins from vdr source for install in this way !!!
346# obsolet, remove it, later...
347#vdr-plugin-2_copy_source_tree() {
348# pushd . >/dev/null
349# cp -r "${S}" "${T}"/source-tree
350# cd "${T}"/source-tree
351# cp "${WORKDIR}"/Makefile.before Makefile
352# # TODO: Fix this, maybe no longer needed
353# sed -i Makefile \
354# -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
355# -e 's:^CXXFLAGS:#CXXFLAGS:' \
356# -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
357# -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
358# popd >/dev/null
359#}
360
361#vdr-plugin-2_install_source_tree() {
362# einfo "Installing sources"
363# destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
364# insinto "${destdir}-${PV}"
365# doins -r "${T}"/source-tree/*
366#
367# dosym "${VDRPLUGIN}-${PV}" "${destdir}"
368#}
369
370vdr-plugin-2_print_enable_command() { 307vdr-plugin-2_print_enable_command() {
371 local p_name c=0 l="" 308 local p_name c=0 l=""
372 for p_name in ${vdr_plugin_list}; do 309 for p_name in ${vdr_plugin_list}; do
373 c=$(( c+1 )) 310 c=$(( c+1 ))
374 l="$l ${p_name#vdr-}" 311 l="$l ${p_name#vdr-}"
522 base_src_prepare 459 base_src_prepare
523 vdr-plugin-2_src_util prepare 460 vdr-plugin-2_src_util prepare
524} 461}
525 462
526vdr-plugin-2_src_compile() { 463vdr-plugin-2_src_compile() {
527 [ -z "$1" ] && vdr-plugin-2_src_compile copy_source compile 464 [ -z "$1" ] && vdr-plugin-2_src_compile compile
528 465
529 while [ "$1" ]; do 466 while [ "$1" ]; do
530 case "$1" in 467 case "$1" in
531 copy_source)
532 [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_copy_source_tree
533 dev_check "ToDo: obsoleted handling, vdr-plugin-2_copy_source_tree"
534 ;;
535 compile) 468 compile)
536 if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then 469 if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then
537 eerror "Wrong use of vdr-plugin-2.eclass." 470 eerror "Wrong use of vdr-plugin-2.eclass."
538 eerror "An ebuild for a vdr-plugin will not work without" 471 eerror "An ebuild for a vdr-plugin will not work without"
539 eerror "calling vdr-plugin-2_src_compile to patch the Makefile." 472 eerror "calling vdr-plugin-2_src_compile to patch the Makefile."
565 echo 498 echo
566 eerror "Please report this at bugs.gentoo.org." 499 eerror "Please report this at bugs.gentoo.org."
567 die "vdr-plugin-2_src_install not called!" 500 die "vdr-plugin-2_src_install not called!"
568 fi 501 fi
569 502
570# ToDo: obsolet, remove it, later...
571# [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin-2_install_source_tree
572 cd "${WORKDIR}" 503 cd "${WORKDIR}"
573 504
574 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then 505 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
575 local mname="${P}-Makefile" 506 local mname="${P}-Makefile"
576 cp "${S}"/Makefile "${mname}.patched" 507 cp "${S}"/Makefile "${mname}.patched"
596 dev_check "einstall with new Makefile handling" 527 dev_check "einstall with new Makefile handling"
597 BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install }} 528 BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install }}
598 einstall ${BUILD_PARAMS} \ 529 einstall ${BUILD_PARAMS} \
599 ${BUILD_TARGETS} \ 530 ${BUILD_TARGETS} \
600 TMPDIR="${T}" \ 531 TMPDIR="${T}" \
601 LOCDIR="${TMP_LOCALE_DIR}" \
602 LIBDIR="${S}" \
603 DESTDIR="${D}" \ 532 DESTDIR="${D}" \
604 || die "einstall (makefile target) failed" 533 || die "einstall (makefile target) failed"
605 fi 534 else
606
607 insinto "${VDR_PLUGIN_DIR}" 535 insinto "${VDR_PLUGIN_DIR}"
608 doins libvdr-*.so.* 536 doins libvdr-*.so.*
537 fi
609 538
610 if [[ -d ${TMP_LOCALE_DIR} ]]; then 539 if [[ -d ${TMP_LOCALE_DIR} ]]; then
611 einfo "Installing locales" 540 einfo "Installing locales"
612 cd "${TMP_LOCALE_DIR}" 541 cd "${TMP_LOCALE_DIR}"
613 542
616 insinto "${LOCDIR}" 545 insinto "${LOCDIR}"
617 cp -r --parents ${linguas}* ${D}/${LOCDIR} 546 cp -r --parents ${linguas}* ${D}/${LOCDIR}
618 done 547 done
619 fi 548 fi
620 549
621 cd "${S}" 550 cd "${D}/usr/$(get_libdir)/vdr/plugins"
622 551
623 # create list of all created plugin libs 552 # create list of all created plugin libs
624 vdr_plugin_list="" 553 vdr_plugin_list=""
625 local p_name 554 local p_name
626 for p in libvdr-*.so.*; do 555 for p in libvdr-*.so.*; do
627 p_name="${p%.so*}" 556 p_name="${p%.so*}"
628 p_name="${p_name#lib}" 557 p_name="${p_name#lib}"
629 vdr_plugin_list="${vdr_plugin_list} ${p_name}" 558 vdr_plugin_list="${vdr_plugin_list} ${p_name}"
630 done 559 done
631 560
561 cd "${S}"
562
632 create_header_checksum_file ${vdr_plugin_list} 563 create_header_checksum_file ${vdr_plugin_list}
633 create_plugindb_file ${vdr_plugin_list} 564 create_plugindb_file ${vdr_plugin_list}
634 565
635 local docfile 566 local docfile
636 for docfile in README* HISTORY CHANGELOG; do 567 for docfile in README* HISTORY CHANGELOG; do
662 elog 593 elog
663 fi 594 fi
664} 595}
665 596
666vdr-plugin-2_pkg_postrm() { 597vdr-plugin-2_pkg_postrm() {
667 delete_orphan_plugindb_file 598:
668} 599}
669 600
670vdr-plugin-2_pkg_config() { 601vdr-plugin-2_pkg_config() {
671: 602:
672} 603}

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20