| 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.6 2005/10/22 20:39:21 zzam Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.10 2005/11/30 06:53:16 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 |
| … | |
… | |
| 123 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
123 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
| 124 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
124 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 125 | -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \ |
125 | -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \ |
| 126 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
126 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 127 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \ |
127 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \ |
| 128 | -e 's:$(VDRDIR)/\(config.h\|Make.config\):$(VDRDIR)/vdr/\1:' |
128 | -e 's:$(VDRDIR)/\([a-z]*\.h\|Make.config\):$(VDRDIR)/vdr/\1:' |
| 129 | eend $? |
129 | eend $? |
| 130 | ;; |
130 | ;; |
| 131 | esac |
131 | esac |
| 132 | |
132 | |
| 133 | shift |
133 | shift |
| … | |
… | |
| 153 | |
153 | |
| 154 | dosym ${VDRPLUGIN}-${PV} ${destdir} |
154 | dosym ${VDRPLUGIN}-${PV} ${destdir} |
| 155 | } |
155 | } |
| 156 | |
156 | |
| 157 | vdr-plugin_src_compile() { |
157 | vdr-plugin_src_compile() { |
|
|
158 | [ -z "$1" ] && vdr-plugin_src_compile prepare compile |
|
|
159 | |
|
|
160 | while [ "$1" ]; do |
|
|
161 | |
|
|
162 | case "$1" in |
|
|
163 | prepare) |
| 158 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree |
164 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree |
| 159 | |
165 | ;; |
|
|
166 | compile) |
| 160 | cd ${S} |
167 | cd ${S} |
| 161 | |
168 | |
| 162 | emake ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" |
169 | emake ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" |
|
|
170 | ;; |
|
|
171 | esac |
|
|
172 | |
|
|
173 | shift |
|
|
174 | done |
| 163 | } |
175 | } |
| 164 | |
176 | |
| 165 | vdr-plugin_src_install() { |
177 | vdr-plugin_src_install() { |
| 166 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
178 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
| 167 | cd ${S} |
179 | cd ${S} |
| … | |
… | |
| 188 | } |
200 | } |
| 189 | |
201 | |
| 190 | vdr-plugin_pkg_postinst() { |
202 | vdr-plugin_pkg_postinst() { |
| 191 | update_vdrplugindb |
203 | update_vdrplugindb |
| 192 | einfo |
204 | einfo |
| 193 | einfo "The vdr plugin ${VDRPLUGIN} has now been installed," |
205 | einfo "The vdr plugin ${VDRPLUGIN} has now been installed." |
| 194 | einfo "to activate it you have to add it to /etc/conf.d/vdr." |
206 | einfo "To activate execute the following command:" |
|
|
207 | einfo |
|
|
208 | einfo " emerge --config ${PN}" |
| 195 | einfo |
209 | einfo |
| 196 | } |
210 | } |
| 197 | |
211 | |
| 198 | vdr-plugin_pkg_postrm() { |
212 | vdr-plugin_pkg_postrm() { |
| 199 | remove_vdrplugindb |
213 | remove_vdrplugindb |
| 200 | } |
214 | } |
| 201 | |
215 | |
|
|
216 | vdr-plugin_pkg_config_final() { |
|
|
217 | diff ${conf_orig} ${conf} |
|
|
218 | rm ${conf_orig} |
|
|
219 | } |
|
|
220 | |
|
|
221 | vdr-plugin_pkg_config() { |
|
|
222 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
|
|
223 | INSTALLPLUGIN="${VDRPLUGIN}" |
|
|
224 | fi |
|
|
225 | # First test if plugin is already inside PLUGINS |
|
|
226 | local conf=/etc/conf.d/vdr |
|
|
227 | conf_orig=${conf}.before_emerge_config |
|
|
228 | cp ${conf} ${conf_orig} |
|
|
229 | |
|
|
230 | einfo "Reading ${conf}" |
|
|
231 | if ! grep -q "^PLUGINS=" ${conf}; then |
|
|
232 | local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) |
|
|
233 | if [[ -n "${LINE}" ]]; then |
|
|
234 | sed -e ${LINE}'a PLUGINS=""' -i ${conf} |
|
|
235 | else |
|
|
236 | echo 'PLUGINS=""' >> ${conf} |
|
|
237 | fi |
|
|
238 | unset LINE |
|
|
239 | fi |
|
|
240 | |
|
|
241 | unset PLUGINS |
|
|
242 | PLUGINS=$(source /etc/conf.d/vdr; echo ${PLUGINS}) |
|
|
243 | |
|
|
244 | active=0 |
|
|
245 | for p in ${PLUGINS}; do |
|
|
246 | if [[ "${p}" == "${INSTALLPLUGIN}" ]]; then |
|
|
247 | active=1 |
|
|
248 | break; |
|
|
249 | fi |
|
|
250 | done |
|
|
251 | |
|
|
252 | if [[ "${active}" == "1" ]]; then |
|
|
253 | einfo "${INSTALLPLUGIN} already activated" |
|
|
254 | echo |
|
|
255 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
|
|
256 | if [[ "${answer}" != "yes" ]]; then |
|
|
257 | einfo "aborted" |
|
|
258 | return |
|
|
259 | fi |
|
|
260 | einfo "Removing ${INSTALLPLUGIN} from active plugins." |
|
|
261 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) |
|
|
262 | sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ |
|
|
263 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
264 | -e ${LINE}'s/ "/"/g' \ |
|
|
265 | -e ${LINE}'s/" /"/g' |
|
|
266 | |
|
|
267 | vdr-plugin_pkg_config_final |
|
|
268 | return |
|
|
269 | fi |
|
|
270 | |
|
|
271 | |
|
|
272 | einfo "Adding ${INSTALLPLUGIN} to active plugins." |
|
|
273 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) |
|
|
274 | sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ |
|
|
275 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
276 | -e ${LINE}'s/ "/"/g' \ |
|
|
277 | -e ${LINE}'s/" /"/g' |
|
|
278 | |
|
|
279 | vdr-plugin_pkg_config_final |
|
|
280 | } |
|
|
281 | |
| 202 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm |
282 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config |