| 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/vdr-plugin.eclass,v 1.7 2005/10/28 08:58:19 zzam Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.11 2005/12/10 10:59:59 zzam Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: |
5 | # Author: |
| 6 | # Matthias Schwarzott <zzam@gentoo.org> |
6 | # Matthias Schwarzott <zzam@gentoo.org> |
| 7 | |
7 | |
| 8 | # vdr-plugin.eclass |
8 | # vdr-plugin.eclass |
| … | |
… | |
| 55 | # works in most cases |
55 | # works in most cases |
| 56 | S="${WORKDIR}/${VDRPLUGIN}-${PV}" |
56 | S="${WORKDIR}/${VDRPLUGIN}-${PV}" |
| 57 | |
57 | |
| 58 | # depend on headers for DVB-driver |
58 | # depend on headers for DVB-driver |
| 59 | RDEPEND="" |
59 | RDEPEND="" |
| 60 | DEPEND="|| ( |
60 | DEPEND="media-tv/linuxtv-dvb-headers" |
| 61 | >=sys-kernel/linux-headers-2.6.11-r2 |
|
|
| 62 | media-tv/linuxtv-dvb |
|
|
| 63 | )" |
|
|
| 64 | |
61 | |
| 65 | # Where should the plugins live in the filesystem |
62 | # Where should the plugins live in the filesystem |
| 66 | VDR_PLUGIN_DIR="/usr/lib/vdr/plugins" |
63 | VDR_PLUGIN_DIR="/usr/lib/vdr/plugins" |
| 67 | |
64 | |
| 68 | VDR_RC_DIR="/usr/lib/vdr/rcscript" |
65 | VDR_RC_DIR="/usr/lib/vdr/rcscript" |
| … | |
… | |
| 123 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
120 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
| 124 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
121 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 125 | -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \ |
122 | -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \ |
| 126 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
123 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 127 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \ |
124 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \ |
| 128 | -e 's:$(VDRDIR)/\(config.h\|Make.config\):$(VDRDIR)/vdr/\1:' |
125 | -e 's:$(VDRDIR)/\([a-z]*\.h\|Make.config\):$(VDRDIR)/vdr/\1:' |
| 129 | eend $? |
126 | eend $? |
| 130 | ;; |
127 | ;; |
| 131 | esac |
128 | esac |
| 132 | |
129 | |
| 133 | shift |
130 | shift |
| … | |
… | |
| 200 | } |
197 | } |
| 201 | |
198 | |
| 202 | vdr-plugin_pkg_postinst() { |
199 | vdr-plugin_pkg_postinst() { |
| 203 | update_vdrplugindb |
200 | update_vdrplugindb |
| 204 | einfo |
201 | einfo |
| 205 | einfo "The vdr plugin ${VDRPLUGIN} has now been installed," |
202 | einfo "The vdr plugin ${VDRPLUGIN} has now been installed." |
| 206 | einfo "to activate it you have to add it to /etc/conf.d/vdr." |
203 | einfo "To activate execute the following command:" |
|
|
204 | einfo |
|
|
205 | einfo " emerge --config ${PN}" |
| 207 | einfo |
206 | einfo |
| 208 | } |
207 | } |
| 209 | |
208 | |
| 210 | vdr-plugin_pkg_postrm() { |
209 | vdr-plugin_pkg_postrm() { |
| 211 | remove_vdrplugindb |
210 | remove_vdrplugindb |
| 212 | } |
211 | } |
| 213 | |
212 | |
|
|
213 | vdr-plugin_pkg_config_final() { |
|
|
214 | diff ${conf_orig} ${conf} |
|
|
215 | rm ${conf_orig} |
|
|
216 | } |
|
|
217 | |
|
|
218 | vdr-plugin_pkg_config() { |
|
|
219 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
|
|
220 | INSTALLPLUGIN="${VDRPLUGIN}" |
|
|
221 | fi |
|
|
222 | # First test if plugin is already inside PLUGINS |
|
|
223 | local conf=/etc/conf.d/vdr |
|
|
224 | conf_orig=${conf}.before_emerge_config |
|
|
225 | cp ${conf} ${conf_orig} |
|
|
226 | |
|
|
227 | einfo "Reading ${conf}" |
|
|
228 | if ! grep -q "^PLUGINS=" ${conf}; then |
|
|
229 | local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) |
|
|
230 | if [[ -n "${LINE}" ]]; then |
|
|
231 | sed -e ${LINE}'a PLUGINS=""' -i ${conf} |
|
|
232 | else |
|
|
233 | echo 'PLUGINS=""' >> ${conf} |
|
|
234 | fi |
|
|
235 | unset LINE |
|
|
236 | fi |
|
|
237 | |
|
|
238 | unset PLUGINS |
|
|
239 | PLUGINS=$(source /etc/conf.d/vdr; echo ${PLUGINS}) |
|
|
240 | |
|
|
241 | active=0 |
|
|
242 | for p in ${PLUGINS}; do |
|
|
243 | if [[ "${p}" == "${INSTALLPLUGIN}" ]]; then |
|
|
244 | active=1 |
|
|
245 | break; |
|
|
246 | fi |
|
|
247 | done |
|
|
248 | |
|
|
249 | if [[ "${active}" == "1" ]]; then |
|
|
250 | einfo "${INSTALLPLUGIN} already activated" |
|
|
251 | echo |
|
|
252 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
|
|
253 | if [[ "${answer}" != "yes" ]]; then |
|
|
254 | einfo "aborted" |
|
|
255 | return |
|
|
256 | fi |
|
|
257 | einfo "Removing ${INSTALLPLUGIN} from active plugins." |
|
|
258 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) |
|
|
259 | sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ |
|
|
260 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
261 | -e ${LINE}'s/ "/"/g' \ |
|
|
262 | -e ${LINE}'s/" /"/g' |
|
|
263 | |
|
|
264 | vdr-plugin_pkg_config_final |
|
|
265 | return |
|
|
266 | fi |
|
|
267 | |
|
|
268 | |
|
|
269 | einfo "Adding ${INSTALLPLUGIN} to active plugins." |
|
|
270 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) |
|
|
271 | sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ |
|
|
272 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
273 | -e ${LINE}'s/ "/"/g' \ |
|
|
274 | -e ${LINE}'s/" /"/g' |
|
|
275 | |
|
|
276 | vdr-plugin_pkg_config_final |
|
|
277 | } |
|
|
278 | |
| 214 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm |
279 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config |