| 1 |
zzam |
1.1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
zzam |
1.2 |
# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.1 2005/07/23 15:11:25 zzam Exp $
|
| 4 |
zzam |
1.1 |
#
|
| 5 |
|
|
# Author:
|
| 6 |
|
|
# Matthias Schwarzott <zzam@gentoo.org>
|
| 7 |
|
|
|
| 8 |
|
|
# vdr-plugin.eclass
|
| 9 |
|
|
#
|
| 10 |
|
|
# eclass to create ebuilds for vdr plugins
|
| 11 |
|
|
#
|
| 12 |
|
|
|
| 13 |
|
|
# Example ebuild (vdr-femon):
|
| 14 |
|
|
#
|
| 15 |
|
|
# inherit vdr-plugin
|
| 16 |
|
|
# IUSE=""
|
| 17 |
|
|
# SLOT="0"
|
| 18 |
|
|
# DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)"
|
| 19 |
|
|
# HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/"
|
| 20 |
|
|
# SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz"
|
| 21 |
|
|
# LICENSE="GPL-2"
|
| 22 |
|
|
# KEYWORDS="~x86"
|
| 23 |
|
|
# DEPEND=">=media-video/vdr-1.3.27"
|
| 24 |
|
|
#
|
| 25 |
|
|
#
|
| 26 |
|
|
|
| 27 |
zzam |
1.2 |
# There are some special files in ${FILESDIR} which get installed when
|
| 28 |
|
|
# they exist:
|
| 29 |
|
|
|
| 30 |
|
|
# ${FILESDIR}/confd-${PV} or ${FILESDIR}/confd:
|
| 31 |
|
|
# The first matching is installed under /etc/conf.d/vdr.${VDRPLUGIN}
|
| 32 |
|
|
# (in example vdr-femon this would be /etc/conf.d/vdr.femon)
|
| 33 |
|
|
#
|
| 34 |
|
|
# Everything put in variable _EXTRAOPTS is appended to the command line of
|
| 35 |
|
|
# the plugin.
|
| 36 |
|
|
|
| 37 |
|
|
|
| 38 |
|
|
# ${FILESDIR}/rc-addon-${PV}.sh or ${FILESDIR}/rc-addon.sh:
|
| 39 |
|
|
# The first matching is installed under /usr/lib/vdr/rcscript/vdr.${VDRPLUGIN}.sh
|
| 40 |
|
|
# (in example vdr-femon this would be /usr/lib/vdr/rcscript/vdr.femon.sh)
|
| 41 |
|
|
#
|
| 42 |
|
|
# This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr
|
| 43 |
|
|
# It could be used for special startup actions for this plugins, or to create the
|
| 44 |
|
|
# plugin command line options from a nicer version of a conf.d file.
|
| 45 |
zzam |
1.1 |
|
| 46 |
|
|
inherit eutils flag-o-matic
|
| 47 |
|
|
|
| 48 |
|
|
# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
|
| 49 |
|
|
VDRPLUGIN="${PN/#vdrplugin-/}"
|
| 50 |
zzam |
1.2 |
VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
|
| 51 |
zzam |
1.1 |
VDRPLUGIN="${VDRPLUGIN/%-cvs/}"
|
| 52 |
|
|
|
| 53 |
|
|
DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin.eclass)"
|
| 54 |
|
|
|
| 55 |
|
|
# works in most cases
|
| 56 |
|
|
S="${WORKDIR}/${VDRPLUGIN}-${PV}"
|
| 57 |
|
|
|
| 58 |
|
|
# depend on headers for DVB-driver
|
| 59 |
|
|
RDEPEND=""
|
| 60 |
|
|
DEPEND="|| (
|
| 61 |
|
|
>=sys-kernel/linux-headers-2.6.11-r2
|
| 62 |
|
|
media-tv/linuxtv-dvb
|
| 63 |
|
|
)"
|
| 64 |
|
|
|
| 65 |
|
|
# Where should the plugins live in the filesystem
|
| 66 |
|
|
VDR_PLUGIN_DIR="/usr/lib/vdr/plugins"
|
| 67 |
|
|
|
| 68 |
zzam |
1.2 |
VDR_RC_DIR="/usr/lib/vdr/rcscript"
|
| 69 |
|
|
|
| 70 |
zzam |
1.1 |
# Pathes to includes
|
| 71 |
|
|
VDR_INCLUDE_DIR="/usr/include"
|
| 72 |
|
|
DVB_INCLUDE_DIR="/usr/include"
|
| 73 |
|
|
|
| 74 |
zzam |
1.2 |
|
| 75 |
|
|
# this code is from linux-mod.eclass
|
| 76 |
|
|
update_vdrplugindb() {
|
| 77 |
|
|
local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugins-rebuild/
|
| 78 |
|
|
|
| 79 |
|
|
if [[ ! -f ${VDRPLUGINDB_DIR}/vdrplugindb ]]; then
|
| 80 |
|
|
[[ ! -d ${VDRPLUGINDB_DIR} ]] && mkdir -p ${VDRPLUGINDB_DIR}
|
| 81 |
|
|
touch ${VDRPLUGINDB_DIR}/vdrplugindb
|
| 82 |
|
|
fi
|
| 83 |
|
|
if [[ -z $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then
|
| 84 |
|
|
einfo "Adding plugin to vdrplugindb."
|
| 85 |
|
|
echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${VDRPLUGINDB_DIR}/vdrplugindb
|
| 86 |
|
|
fi
|
| 87 |
|
|
}
|
| 88 |
|
|
|
| 89 |
|
|
remove_vdrplugindb() {
|
| 90 |
|
|
local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugins-rebuild/
|
| 91 |
|
|
|
| 92 |
|
|
if [[ -n $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then
|
| 93 |
|
|
einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb."
|
| 94 |
|
|
sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb
|
| 95 |
|
|
fi
|
| 96 |
|
|
}
|
| 97 |
|
|
|
| 98 |
zzam |
1.1 |
vdr-plugin_pkg_setup() {
|
| 99 |
|
|
# -fPIC is needed for shared objects on some platforms (amd64 and others)
|
| 100 |
|
|
append-flags -fPIC
|
| 101 |
|
|
|
| 102 |
|
|
VDRVERSION=$(awk -F'"' '/VDRVERSION/ {print $2}' /usr/include/vdr/config.h)
|
| 103 |
|
|
einfo "Building ${PF} against vdr-${VDRVERSION}"
|
| 104 |
|
|
}
|
| 105 |
|
|
|
| 106 |
|
|
vdr-plugin_src_unpack() {
|
| 107 |
|
|
[ -z "$1" ] && vdr-plugin_src_unpack unpack patchmakefile
|
| 108 |
|
|
|
| 109 |
|
|
while [ "$1" ]; do
|
| 110 |
|
|
|
| 111 |
|
|
case "$1" in
|
| 112 |
|
|
unpack)
|
| 113 |
|
|
unpack ${A}
|
| 114 |
|
|
;;
|
| 115 |
|
|
patchmakefile)
|
| 116 |
|
|
cd ${S}
|
| 117 |
|
|
|
| 118 |
|
|
ebegin "Patching Makefile"
|
| 119 |
|
|
sed -i Makefile \
|
| 120 |
|
|
-e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
|
| 121 |
|
|
-e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
|
| 122 |
|
|
-e "s:^LIBDIR.*$:LIBDIR = ${S}:" \
|
| 123 |
|
|
-e "s:^TMPDIR.*$:TMPDIR = ${T}:" \
|
| 124 |
|
|
-e 's:^CXXFLAGS:#CXXFLAGS:' \
|
| 125 |
|
|
-e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \
|
| 126 |
|
|
-e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
|
| 127 |
|
|
-e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \
|
| 128 |
|
|
-e 's:$(VDRDIR)/\(config.h\|Make.config\):$(VDRDIR)/vdr/\1:'
|
| 129 |
|
|
eend $?
|
| 130 |
|
|
;;
|
| 131 |
|
|
esac
|
| 132 |
|
|
|
| 133 |
|
|
shift
|
| 134 |
|
|
done
|
| 135 |
|
|
}
|
| 136 |
|
|
|
| 137 |
|
|
vdr-plugin_src_compile() {
|
| 138 |
|
|
cd ${S}
|
| 139 |
|
|
|
| 140 |
|
|
emake ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed"
|
| 141 |
|
|
}
|
| 142 |
|
|
|
| 143 |
|
|
vdr-plugin_src_install() {
|
| 144 |
|
|
cd ${S}
|
| 145 |
|
|
|
| 146 |
|
|
insinto "${VDR_PLUGIN_DIR}"
|
| 147 |
|
|
doins libvdr-*.so.*
|
| 148 |
|
|
dodoc README* HISTORY CHANGELOG
|
| 149 |
zzam |
1.2 |
|
| 150 |
|
|
for f in ${FILESDIR}/confd-${PV} ${FILESDIR}/confd; do
|
| 151 |
|
|
if [[ -f "${f}" ]]; then
|
| 152 |
|
|
insinto /etc/conf.d
|
| 153 |
|
|
newins "${f}" vdr.${VDRPLUGIN}
|
| 154 |
|
|
break
|
| 155 |
|
|
fi
|
| 156 |
|
|
done
|
| 157 |
|
|
|
| 158 |
|
|
for f in ${FILESDIR}/rc-addon-${PV}.sh ${FILESDIR}/rc-addon.sh; do
|
| 159 |
|
|
if [[ -f "${f}" ]]; then
|
| 160 |
|
|
insinto "${VDR_RC_DIR}"
|
| 161 |
|
|
newins "${f}" vdr.${VDRPLUGIN}.sh
|
| 162 |
|
|
break
|
| 163 |
|
|
fi
|
| 164 |
|
|
done
|
| 165 |
zzam |
1.1 |
}
|
| 166 |
|
|
|
| 167 |
|
|
vdr-plugin_pkg_postinst() {
|
| 168 |
zzam |
1.2 |
update_vdrplugindb
|
| 169 |
zzam |
1.1 |
einfo
|
| 170 |
|
|
einfo "The vdr plugin ${VDRPLUGIN} has now been installed,"
|
| 171 |
|
|
einfo "to activate it you have to add it to /etc/conf.d/vdr."
|
| 172 |
|
|
einfo
|
| 173 |
|
|
}
|
| 174 |
|
|
|
| 175 |
zzam |
1.2 |
vdr-plugin_pkg_postrm() {
|
| 176 |
|
|
remove_vdrplugindb
|
| 177 |
|
|
}
|
| 178 |
|
|
|
| 179 |
|
|
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm
|