# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/vdrplugin.eclass,v 1.35 2005/10/23 14:31:01 zzam Exp $ # # Matthias Schwarzott # Christian Gmeiner # # Changelog # # 17.08.2004 # 05.09.2004 added README.de # 07.09.2004 changed to README* # 20.09.2004 added FFMDIR in sed # 24.09.2004 cosmetic changes # 01.10.2004 we can extract now all sourcefiles # 08.11.2004 we use RESTRICT="nomirror" for all plugins # 10.01.2005 docs get now only installed if doc is in the USE-Flags # 12.01.2005 some improvements - thanks to Helmut Auer # * we dont need to change the lib-extension # * better copying of source-files # 12.01.2005 we install now all *.so files # 24.01.2005 little typo fix # 26.03.2005 add helper-function for some ebuilds # 23.04.2005 make ready for amd64 # make it importable by vdr-ebuild # 02.05.2005 change Makefile to use ebuilds CXXFLAGS # 16.05.2005 make -fPIC default MS # 07.08.2005 detect install location for newer vdr ebuilds # create vdrplugindb for easier tracking of installed plugins # 23.08.2005 do not create the *.so links # install plugin in /usr/lib/vdr/plugins # inherit dvb flag-o-matic vdrmirror ECLASS=vdrplugin INHERITED="$INHERITED $ECLASS" IUSE="doc" # ## This is the minimal plugin-ebuild: ## ## ### cut ############################################ ## ## # Copyright 1999-2004 Gentoo Technologies, Inc. ## # Distributed under the terms of the GNU General Public License v2 ## # $Header: /var/cvsroot/gentoo-x86/eclass/vdrplugin.eclass,v 1.35 2005/10/23 14:31:01 zzam Exp $ ## ## inherit vdrplugin ## ## DESCRIPTION="..." ## HOMEPAGE="http://.../" ## SRC_URI="http://.../.../vdr-${VDRPLUGIN}-${PV}.tgz" ## LICENSE="GPL-2" ## ## DEPEND=">=media-video/vdr-1.3.7" ## ## ### cut ############################################ # # # Configuration-Variables used by this eclass: # # Automatically filled with values: # (You can change them after inherit if you need to) # VDRPLUGIN - Name of the plugin # S - Path of the sources # KEYWORDS - Set ebuild to state masked # SLOT - Set to 0 # # # # You must set in your ebuild # SRC_URI - Download location # HOMEPAGE - Homepage of plugin # DESCRIPTION - Description # LICENSE - License of plugin (GPL-2) # DEPEND - Dependencies to vdr etc. # # This eclass exports these functions: # src_unpack # src_compile # src_install # pkg_postinst # # If this implementation is good for you, # you have nothing to do, else you can inherit this # Version and change it how you like. # Example for src_unpack: # # inherit eutils # src_unpack() { # # inherited version # vdrplugin_src_unpack # # # Added code # epatch ${FILESDIR}/patch-no5.diff # } # # If this ebuild is in portage of gentoo.org remove nomirror RESTRICT="nomirror" # # VDRPLUGIN - Name of the plugin # if test -z "${VDRPLUGIN}"; then VDRPLUGIN="${PN/#vdrplugin-/}" VDRPLUGIN="${VDRPLUGIN/#vdr-/}" # Für CVS-Ebuilds VDRPLUGIN="${VDRPLUGIN/%-cvs/}" fi # Fixed install-path of Headers VDRDIR=/usr/include # # S=${WORKDIR}/${VDRPLUGIN}-${PV} DESCRIPTION="Video Disk Recorder ${VDRPLUGIN} PlugIn" SRC_URI="-TODO- Insert download location here" # Do this if not in vdr-ebuild if [ "$PN" != "vdr" ]; then DEPEND="media-video/vdr" # # Export default functions for ebuilds # EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm fi vdr_get_version() { VDRVERSION=$(awk -F'"' '/VDRVERSION/ {print $2}' /usr/include/vdr/config.h) } vdrplugin_patch_makefile() { local f="${1}" test -z "${f}" && f="${S}/Makefile" dvb_patch_makefile ${f} # replace / with \/ local MY_VDRDIR=${VDRDIR}${VDRDIR_ADD} sed -i.original ${f} \ -e "s:VDRINC:VDRDIR:" \ -e "s:^FFMDIR.*$:FFMDIR = /usr/include/ffmpeg:" \ -e "s:^VDRDIR.*$:VDRDIR = ${MY_VDRDIR}:" \ -e 's:\$(VDRDIR)/include:$(VDRDIR):' \ -e 's:\$(VDRDIR)/config.h:$(VDRDIR)/vdr/config.h:' \ -e "s:^LIBDIR.*$:LIBDIR = .:" \ -e "s:-I\$(VDR.*) -I\$(DVBDIR):-I\$(DVBDIR) -I\$(VDRDIR):" \ -e "s:^CXXFLAGS:#CXXFLAGS:" \ #DEBUG #cp ${S}/Makefile /tmp/Makefile-${VDRPLUGIN} } vdrplugin_patch_all_makefiles() { einfo "Patching Makefiles for new path to dvb-driver" local f for f in $(find -name Makefile); do SILENT=1 vdrplugin_patch_makefile "${f}" done } vdrplugin_make() { local OLD_CFLAGS="${CFLAGS}" local OLD_CXXFLAGS="${CXXFLAGS}" # Add -fPIC for plugins by default (not only amd64) if [ -z "$VDRPLUGIN_DISABLE_PIC" ]; then append-flags -fPIC else strip-flags -fPIC fi if [ $# -gt 0 ]; then make $@ || die "compile problem" else make ${VDRPLUGIN_MAKE_TARGET:-all} || die "compile problem" fi CFLAGS="${OLD_CFLAGS}" CXXFLAGS="${OLD_CXXFLAGS}" } # this code is from linux-mod.eclass update_vdrplugindb() { local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/ if [[ ! -f ${VDRPLUGINDB_DIR}/vdrplugindb ]]; then [[ ! -d ${VDRPLUGINDB_DIR} ]] && mkdir -p ${VDRPLUGINDB_DIR} touch ${VDRPLUGINDB_DIR}/vdrplugindb fi if [[ -z $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then einfo "Adding plugin to vdrplugindb." echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${VDRPLUGINDB_DIR}/vdrplugindb fi } remove_vdrplugindb() { local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/ if [[ -n $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb." sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb fi } # # * src_unpack # * src_compile # * src_install # * pkg_postinst # * pkg_postrm # # Standardversionen dieser Routinen # wenn sie im ebuild nicht # ueberschrieben werden # vdrplugin_pkg_setup() { # Call pkg_setup from dvb.eclass dvb_pkg_setup vdr_get_version einfo "Found Includes for vdr version:" einfo " ${VDRVERSION}" } vdrplugin_src_unpack() { unpack ${A} } vdrplugin_src_compile() { vdrplugin_patch_all_makefiles vdrplugin_make } vdrplugin_src_install() { cd ${S} VDR_PLUGIN_DIR=/usr/lib/vdr/plugins if [[ ! -d "${ROOT}/usr/lib/vdr/plugins" ]]; then ewarn "In case it don't work, reemerge vdr" fi einfo "installing plugin in ${VDR_PLUGIN_DIR}" insinto "${VDR_PLUGIN_DIR}" insopts -m0755 # install all *.so files for f in libvdr-*.so.*; do test -f "${f}" && doins "${f}" done # install docs only, if we have doc in the USE-Flags if use doc; then einfo "Installing docs..." for f in COPYING README* HISTORY TODO; do test -f "${f}" && dodoc "${f}" done fi if test -f ${FILESDIR}/vdr.${VDRPLUGIN}; then insinto /etc/conf.d doins ${FILESDIR}/vdr.${VDRPLUGIN} fi # install all source files if [ -d $VDRSOURCE_DIR ] && [ ! -z $VDRSOURCE_DIR ]; then VDRDIR=vdr-${VDRVERSION} dodir $VDRSOURCE_DIR/$VDRDIR/PLUGINS/src/${VDRPLUGIN}-${PV} dosym ${VDRPLUGIN}-${PV} $VDRSOURCE_DIR/$VDRDIR/PLUGINS/src/${VDRPLUGIN} for d in `find . -type d` ; do dodir $VDRSOURCE_DIR/$VDRDIR/PLUGINS/src/${VDRPLUGIN}-${PV}/${d} insinto $VDRSOURCE_DIR/$VDRDIR/PLUGINS/src/${VDRPLUGIN}-${PV}/${d} cd ${S}/${d} for f in *.original ; do if [ -s ${f} ] ; then ORGNAME=`echo "${f}" | sed "s/.original//"` mv -f "$ORGNAME" "$ORGNAME.new" mv -f "${f}" "$ORGNAME" fi done for f in * .* ; do test -f "${f}" && doins "${f}" done done fi cd ${S} } vdrplugin_pkg_postinst() { update_vdrplugindb einfo einfo "you need to add the module to /etc/conf.d/vdr" einfo "and restart vdr to activate it." einfo } vdrplugin_pkg_postrm() { remove_vdrplugindb } function vdr_plugin_opts { local x for x in {VDR_$1_OPTS} do if [ "${x}" = "${2}" ] then return 0 fi done return 1 } create_missing_libvdr_links() { ebegin "Creating missing links to libvdr-files" for i in libvdr-*.so; do ln -s ${i} ${i}.${VDRVERSION} done eend $? }