| 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.8 2005/11/20 14:10:05 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 |
| … | |
… | |
| 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} |
| … | |
… | |
| 197 | |
209 | |
| 198 | vdr-plugin_pkg_postrm() { |
210 | vdr-plugin_pkg_postrm() { |
| 199 | remove_vdrplugindb |
211 | remove_vdrplugindb |
| 200 | } |
212 | } |
| 201 | |
213 | |
|
|
214 | vdr-plugin_pkg_config_final() { |
|
|
215 | diff ${conf_orig} ${conf} |
|
|
216 | rm ${conf_orig} |
|
|
217 | } |
|
|
218 | |
|
|
219 | vdr-plugin_pkg_config() { |
|
|
220 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
|
|
221 | INSTALLPLUGIN="${VDRPLUGIN}" |
|
|
222 | fi |
|
|
223 | # First test if plugin is already inside PLUGINS |
|
|
224 | local conf=/etc/conf.d/vdr |
|
|
225 | conf_orig=${conf}.before_emerge_config |
|
|
226 | cp ${conf} ${conf_orig} |
|
|
227 | |
|
|
228 | einfo "Reading ${conf}" |
|
|
229 | if ! grep -q "^PLUGINS=" ${conf}; then |
|
|
230 | local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) |
|
|
231 | if [[ -n "${LINE}" ]]; then |
|
|
232 | sed -e ${LINE}'a PLUGINS=""' -i ${conf} |
|
|
233 | else |
|
|
234 | echo 'PLUGINS=""' >> ${conf} |
|
|
235 | fi |
|
|
236 | unset LINE |
|
|
237 | fi |
|
|
238 | |
|
|
239 | unset PLUGINS |
|
|
240 | PLUGINS=$(source /etc/conf.d/vdr; echo ${PLUGINS}) |
|
|
241 | |
|
|
242 | active=0 |
|
|
243 | for p in ${PLUGINS}; do |
|
|
244 | if [[ "${p}" == "${INSTALLPLUGIN}" ]]; then |
|
|
245 | active=1 |
|
|
246 | break; |
|
|
247 | fi |
|
|
248 | done |
|
|
249 | |
|
|
250 | if [[ "${active}" == "1" ]]; then |
|
|
251 | einfo "${INSTALLPLUGIN} already activated" |
|
|
252 | echo |
|
|
253 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
|
|
254 | if [[ "${answer}" != "yes" ]]; then |
|
|
255 | einfo "aborted" |
|
|
256 | return |
|
|
257 | fi |
|
|
258 | einfo "Removing ${INSTALLPLUGIN} from active plugins." |
|
|
259 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) |
|
|
260 | sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ |
|
|
261 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
262 | -e ${LINE}'s/ "/"/g' \ |
|
|
263 | -e ${LINE}'s/" /"/g' |
|
|
264 | |
|
|
265 | vdr-plugin_pkg_config_final |
|
|
266 | return |
|
|
267 | fi |
|
|
268 | |
|
|
269 | |
|
|
270 | einfo "Adding ${INSTALLPLUGIN} to active plugins." |
|
|
271 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) |
|
|
272 | sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ |
|
|
273 | -e ${LINE}'s/ \( \)*/ /g' \ |
|
|
274 | -e ${LINE}'s/ "/"/g' \ |
|
|
275 | -e ${LINE}'s/" /"/g' |
|
|
276 | |
|
|
277 | vdr-plugin_pkg_config_final |
|
|
278 | } |
|
|
279 | |
| 202 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm |
280 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config |