| 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.22 2006/06/17 14:51:32 zzam Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.45 2007/06/02 15:07:43 zzam Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: |
5 | # Author: |
| 6 | # Matthias Schwarzott <zzam@gentoo.org> |
6 | # Matthias Schwarzott <zzam@gentoo.org> |
|
|
7 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
| 7 | |
8 | |
| 8 | # vdr-plugin.eclass |
9 | # vdr-plugin.eclass |
| 9 | # |
10 | # |
| 10 | # eclass to create ebuilds for vdr plugins |
11 | # eclass to create ebuilds for vdr plugins |
| 11 | # |
12 | # |
| … | |
… | |
| 37 | # |
38 | # |
| 38 | # If ${VDR_RCADDON_FILE} is set install this file |
39 | # If ${VDR_RCADDON_FILE} is set install this file |
| 39 | # else install ${FILESDIR}/rc-addon.sh if it exists. |
40 | # else install ${FILESDIR}/rc-addon.sh if it exists. |
| 40 | # |
41 | # |
| 41 | # Gets installed under ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh |
42 | # Gets installed under ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh |
| 42 | # (in example vdr-femon this would be /usr/lib/vdr/rcscript/plugin-femon.sh) |
43 | # (in example vdr-femon this would be /usr/share/vdr/rcscript/plugin-femon.sh) |
| 43 | # |
44 | # |
| 44 | # This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr |
45 | # This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr |
| 45 | # It could be used for special startup actions for this plugins, or to create the |
46 | # It could be used for special startup actions for this plugins, or to create the |
| 46 | # plugin command line options from a nicer version of a conf.d file. |
47 | # plugin command line options from a nicer version of a conf.d file. |
| 47 | |
48 | |
|
|
49 | # HowTo use own local patches; Example |
|
|
50 | # |
|
|
51 | # Add to your /etc/make.conf: |
|
|
52 | # VDR_LOCAL_PATCHES_DIR="/usr/local/patch" |
|
|
53 | # |
|
|
54 | # Add two DIR's in your local patch dir, ${PN}/${PV}, |
|
|
55 | # e.g for vdr-burn-0.1.0 should be: |
|
|
56 | # /usr/local/patch/vdr-burn/0.1.0/ |
|
|
57 | # |
|
|
58 | # all patches which ending on diff or patch in this DIR will automatically applied |
|
|
59 | # |
|
|
60 | |
| 48 | inherit base multilib eutils flag-o-matic |
61 | inherit base multilib eutils flag-o-matic |
| 49 | |
62 | |
| 50 | IUSE="debug" |
63 | IUSE="" |
| 51 | |
64 | |
| 52 | # Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes |
65 | # Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes |
| 53 | VDRPLUGIN="${PN/#vdrplugin-/}" |
66 | VDRPLUGIN="${PN/#vdrplugin-/}" |
| 54 | VDRPLUGIN="${VDRPLUGIN/#vdr-/}" |
67 | VDRPLUGIN="${VDRPLUGIN/#vdr-/}" |
| 55 | VDRPLUGIN="${VDRPLUGIN/%-cvs/}" |
68 | VDRPLUGIN="${VDRPLUGIN/%-cvs/}" |
| … | |
… | |
| 58 | |
71 | |
| 59 | # works in most cases |
72 | # works in most cases |
| 60 | S="${WORKDIR}/${VDRPLUGIN}-${PV}" |
73 | S="${WORKDIR}/${VDRPLUGIN}-${PV}" |
| 61 | |
74 | |
| 62 | # depend on headers for DVB-driver |
75 | # depend on headers for DVB-driver |
| 63 | RDEPEND="" |
76 | RDEPEND=">=media-tv/gentoo-vdr-scripts-0.3.4-r1" |
| 64 | DEPEND="media-tv/linuxtv-dvb-headers" |
77 | DEPEND="media-tv/linuxtv-dvb-headers" |
| 65 | |
78 | |
| 66 | |
79 | |
| 67 | # this code is from linux-mod.eclass |
80 | # this code is from linux-mod.eclass |
| 68 | update_vdrplugindb() { |
81 | update_vdrplugindb() { |
| … | |
… | |
| 85 | einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb." |
98 | einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb." |
| 86 | sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb |
99 | sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb |
| 87 | fi |
100 | fi |
| 88 | } |
101 | } |
| 89 | |
102 | |
|
|
103 | # New method of storing plugindb |
|
|
104 | # Called from src_install |
|
|
105 | # file maintained by normal portage-methods |
|
|
106 | create_plugindb_file() { |
|
|
107 | local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/ |
|
|
108 | local DB_FILE=${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF} |
|
|
109 | insinto ${NEW_VDRPLUGINDB_DIR} |
|
|
110 | cat <<-EOT > ${D}/${DB_FILE} |
|
|
111 | VDRPLUGIN_DB=1 |
|
|
112 | CREATOR=ECLASS |
|
|
113 | EBUILD=${CATEGORY}/${PN} |
|
|
114 | EBUILD_V=${PVR} |
|
|
115 | EOT |
|
|
116 | } |
|
|
117 | |
|
|
118 | # Delete files created outside of vdr-plugin.eclass |
|
|
119 | # vdrplugin-rebuild.ebuild converted plugindb and files are |
|
|
120 | # not deleted by portage itself - should only be needed as |
|
|
121 | # long as not every system has switched over to |
|
|
122 | # vdrplugin-rebuild-0.2 |
|
|
123 | delete_orphan_plugindb_file() { |
|
|
124 | #elog Testing for orphaned plugindb file |
|
|
125 | local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/ |
|
|
126 | local DB_FILE=${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF} |
|
|
127 | |
|
|
128 | # file exists |
|
|
129 | [[ -f ${DB_FILE} ]] || return |
|
|
130 | |
|
|
131 | # will portage handle the file itself |
|
|
132 | if grep -q CREATOR=ECLASS ${DB_FILE}; then |
|
|
133 | #elog file owned by eclass - don't touch it |
|
|
134 | return |
|
|
135 | fi |
|
|
136 | |
|
|
137 | elog "Removing orphaned plugindb-file." |
|
|
138 | elog "\t#rm ${DB_FILE}" |
|
|
139 | rm ${DB_FILE} |
|
|
140 | } |
|
|
141 | |
|
|
142 | |
|
|
143 | create_header_checksum_file() |
|
|
144 | { |
|
|
145 | # Danger: Not using $ROOT here, as compile will also not use it !!! |
|
|
146 | # If vdr in $ROOT and / differ, plugins will not run anyway |
|
|
147 | |
|
|
148 | insinto ${VDR_CHECKSUM_DIR} |
|
|
149 | if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then |
|
|
150 | newins ${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN} |
|
|
151 | else |
|
|
152 | if type -p md5sum >/dev/null 2>&1; then |
|
|
153 | cd ${S} |
|
|
154 | ( |
|
|
155 | cd ${VDR_INCLUDE_DIR} |
|
|
156 | md5sum *.h libsi/*.h|LC_ALL=C sort --key=2 |
|
|
157 | ) > header-md5-${PN} |
|
|
158 | doins header-md5-${PN} |
|
|
159 | fi |
|
|
160 | fi |
|
|
161 | } |
|
|
162 | |
| 90 | vdr-plugin_pkg_setup() { |
163 | vdr-plugin_pkg_setup() { |
| 91 | # -fPIC is needed for shared objects on some platforms (amd64 and others) |
164 | # -fPIC is needed for shared objects on some platforms (amd64 and others) |
| 92 | append-flags -fPIC |
165 | append-flags -fPIC |
| 93 | use debug && append-flags -g |
|
|
| 94 | |
166 | |
| 95 | # Where should the plugins live in the filesystem |
167 | # Where should the plugins live in the filesystem |
| 96 | VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" |
168 | VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" |
| 97 | VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" |
169 | VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" |
| 98 | |
170 | |
| 99 | # transition to /usr/share/... will need new vdr-scripts version stable |
171 | # was /usr/lib/... some time ago |
|
|
172 | # since gentoo-vdr-scripts-0.3.6 it works with /usr/share/... |
| 100 | VDR_RC_DIR="/usr/lib/vdr/rcscript" |
173 | VDR_RC_DIR="/usr/share/vdr/rcscript" |
| 101 | |
174 | |
| 102 | # Pathes to includes |
175 | # Pathes to includes |
| 103 | VDR_INCLUDE_DIR="/usr/include" |
176 | VDR_INCLUDE_DIR="/usr/include/vdr" |
| 104 | DVB_INCLUDE_DIR="/usr/include" |
177 | DVB_INCLUDE_DIR="/usr/include" |
| 105 | |
178 | |
| 106 | |
179 | |
| 107 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/vdr/config.h) |
180 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
| 108 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/vdr/config.h) |
181 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
| 109 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
182 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
| 110 | |
183 | |
| 111 | einfo "Building ${PF} against vdr-${VDRVERSION}" |
184 | einfo "Building ${PF} against vdr-${VDRVERSION}" |
| 112 | einfo "APIVERSION: ${APIVERSION}" |
185 | einfo "APIVERSION: ${APIVERSION}" |
| 113 | } |
186 | } |
| 114 | |
187 | |
| 115 | vdr-plugin_src_unpack() { |
188 | vdr-plugin_src_unpack() { |
|
|
189 | if [[ -z ${VDR_INCLUDE_DIR} ]]; then |
|
|
190 | eerror "Wrong use of vdr-plugin.eclass." |
|
|
191 | eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup." |
|
|
192 | echo |
|
|
193 | eerror "Please report this at bugs.gentoo.org." |
|
|
194 | die "vdr-plugin_pkg_setup not called!" |
|
|
195 | fi |
| 116 | [ -z "$1" ] && vdr-plugin_src_unpack unpack patchmakefile |
196 | [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile |
| 117 | |
197 | |
| 118 | while [ "$1" ]; do |
198 | while [ "$1" ]; do |
| 119 | |
199 | |
| 120 | case "$1" in |
200 | case "$1" in |
|
|
201 | all_but_unpack) |
|
|
202 | vdr-plugin_src_unpack add_local_patch patchmakefile |
|
|
203 | ;; |
| 121 | unpack) |
204 | unpack) |
| 122 | base_src_unpack |
205 | base_src_unpack |
| 123 | ;; |
206 | ;; |
| 124 | patchmakefile) |
207 | patchmakefile) |
| 125 | if ! cd ${S}; then |
208 | if ! cd ${S}; then |
| 126 | ewarn "There seems to be no plugin-directory with the name ${S##*/}" |
209 | ewarn "There seems to be no plugin-directory with the name ${S##*/}" |
| 127 | ewarn "Perhaps you find one among these:" |
210 | ewarn "Perhaps you find one among these:" |
| 128 | cd "${WORKDIR}" |
211 | cd "${WORKDIR}" |
| 129 | einfo "$(/bin/ls -1 ${WORKDIR})" |
212 | ewarn "$(/bin/ls -1 ${WORKDIR})" |
| 130 | die "Could not change to plugin-source-directory!" |
213 | die "Could not change to plugin-source-directory!" |
| 131 | fi |
214 | fi |
| 132 | |
215 | |
| 133 | ebegin "Patching Makefile" |
216 | einfo "Patching Makefile" |
| 134 | [[ -e Makefile ]] || die "Makefile of plugin can not be found!" |
217 | [[ -e Makefile ]] || die "Makefile of plugin can not be found!" |
| 135 | cp Makefile Makefile.orig |
218 | cp Makefile Makefile.orig |
|
|
219 | |
| 136 | sed -i.orig Makefile \ |
220 | sed -i Makefile \ |
|
|
221 | -e '1i\#Makefile was patched by vdr-plugin.eclass' |
|
|
222 | |
|
|
223 | ebegin " Setting Pathes" |
|
|
224 | sed -i Makefile \ |
| 137 | -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ |
225 | -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ |
| 138 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
226 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| 139 | -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \ |
227 | -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \ |
| 140 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
228 | -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \ |
| 141 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
229 | -e 's:-I$(VDRDIR)/include -I$(DVBDIR)/include:-I$(DVBDIR)/include -I$(VDRDIR)/include:' \ |
| 142 | -e 's:-I$(VDRDIR)/include:-I$(VDRDIR):' \ |
230 | -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \ |
| 143 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
231 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' |
| 144 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' \ |
232 | eend $? |
| 145 | -e 's:$(VDRDIR)/\([a-z]*\.h\|Make.config\):$(VDRDIR)/vdr/\1:' \ |
233 | |
|
|
234 | ebegin " Converting to APIVERSION" |
|
|
235 | sed -i Makefile \ |
| 146 | -e 's:^APIVERSION = :APIVERSION ?= :' \ |
236 | -e 's:^APIVERSION = :APIVERSION ?= :' \ |
| 147 | -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \ |
237 | -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \ |
| 148 | -e '1i\APIVERSION = '"${APIVERSION}" |
238 | -e '2i\APIVERSION = '"${APIVERSION}" |
| 149 | eend $? |
239 | eend $? |
|
|
240 | |
|
|
241 | ebegin " Correcting Compile-Flags" |
|
|
242 | sed -i Makefile \ |
|
|
243 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
|
|
244 | -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:' |
|
|
245 | eend $? |
|
|
246 | |
|
|
247 | ebegin " Disabling file stripping" |
|
|
248 | sed -i Makefile \ |
|
|
249 | -e '/@.*strip/d' \ |
|
|
250 | -e '/strip \$(LIBDIR)\/\$@/d' \ |
|
|
251 | -e '/^STRIP =/d' \ |
|
|
252 | -e '/@.*\$(STRIP)/d' |
|
|
253 | eend $? |
|
|
254 | |
|
|
255 | # Use a file instead of an variable as single-stepping via ebuild |
|
|
256 | # destroys environment. |
|
|
257 | touch ${WORKDIR}/.vdr-plugin_makefile_patched |
|
|
258 | ;; |
|
|
259 | add_local_patch) |
|
|
260 | cd ${S} |
|
|
261 | if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then |
|
|
262 | echo |
|
|
263 | einfo "Applying local patches" |
|
|
264 | for LOCALPATCH in ${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}/*.{diff,patch}; do |
|
|
265 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
|
|
266 | done |
|
|
267 | fi |
| 150 | ;; |
268 | ;; |
| 151 | esac |
269 | esac |
| 152 | |
270 | |
| 153 | shift |
271 | shift |
| 154 | done |
272 | done |
| 155 | } |
273 | } |
| 156 | |
274 | |
| 157 | vdr-plugin_copy_source_tree() { |
275 | vdr-plugin_copy_source_tree() { |
|
|
276 | pushd . >/dev/null |
| 158 | cp -r ${S} ${T}/source-tree |
277 | cp -r ${S} ${T}/source-tree |
| 159 | cd ${T}/source-tree |
278 | cd ${T}/source-tree |
| 160 | mv Makefile.orig Makefile |
279 | mv Makefile.orig Makefile |
| 161 | sed -i Makefile \ |
280 | sed -i Makefile \ |
| 162 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
281 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| 163 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
282 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 164 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
283 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 165 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
284 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
|
|
285 | popd >/dev/null |
| 166 | } |
286 | } |
| 167 | |
287 | |
| 168 | vdr-plugin_install_source_tree() { |
288 | vdr-plugin_install_source_tree() { |
| 169 | einfo "Installing sources" |
289 | einfo "Installing sources" |
| 170 | destdir=${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN} |
290 | destdir=${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN} |
| … | |
… | |
| 182 | case "$1" in |
302 | case "$1" in |
| 183 | prepare) |
303 | prepare) |
| 184 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree |
304 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree |
| 185 | ;; |
305 | ;; |
| 186 | compile) |
306 | compile) |
|
|
307 | if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then |
|
|
308 | eerror "Wrong use of vdr-plugin.eclass." |
|
|
309 | eerror "An ebuild for a vdr-plugin will not work without" |
|
|
310 | eerror "calling vdr-plugin_src_unpack to patch the Makefile." |
|
|
311 | echo |
|
|
312 | eerror "Please report this at bugs.gentoo.org." |
|
|
313 | die "vdr-plugin_src_unpack not called!" |
|
|
314 | fi |
| 187 | cd ${S} |
315 | cd ${S} |
| 188 | |
316 | |
| 189 | emake ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" |
317 | emake ${BUILD_PARAMS} ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" |
| 190 | ;; |
318 | ;; |
| 191 | esac |
319 | esac |
| 192 | |
320 | |
| 193 | shift |
321 | shift |
| 194 | done |
322 | done |
| … | |
… | |
| 216 | |
344 | |
| 217 | fi |
345 | fi |
| 218 | |
346 | |
| 219 | insinto "${VDR_PLUGIN_DIR}" |
347 | insinto "${VDR_PLUGIN_DIR}" |
| 220 | doins libvdr-*.so.* |
348 | doins libvdr-*.so.* |
|
|
349 | local docfile |
| 221 | dodoc README* HISTORY CHANGELOG |
350 | for docfile in README* HISTORY CHANGELOG; do |
| 222 | |
351 | [[ -f ${docfile} ]] && dodoc ${docfile} |
|
|
352 | done |
| 223 | |
353 | |
| 224 | # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it |
354 | # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it |
| 225 | [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd |
355 | [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd |
| 226 | |
356 | |
| 227 | if [[ -n ${VDR_CONFD_FILE} ]]; then |
357 | if [[ -n ${VDR_CONFD_FILE} ]]; then |
| 228 | insinto /etc/conf.d |
|
|
| 229 | newins "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} |
358 | newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} |
| 230 | fi |
359 | fi |
| 231 | |
360 | |
| 232 | |
361 | |
| 233 | # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it |
362 | # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it |
| 234 | [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh |
363 | [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh |
| … | |
… | |
| 236 | if [[ -n ${VDR_RCADDON_FILE} ]]; then |
365 | if [[ -n ${VDR_RCADDON_FILE} ]]; then |
| 237 | insinto "${VDR_RC_DIR}" |
366 | insinto "${VDR_RC_DIR}" |
| 238 | newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh |
367 | newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh |
| 239 | fi |
368 | fi |
| 240 | |
369 | |
| 241 | |
370 | create_header_checksum_file |
| 242 | |
371 | create_plugindb_file |
| 243 | insinto ${VDR_CHECKSUM_DIR} |
|
|
| 244 | if [[ -f ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then |
|
|
| 245 | newins ${ROOT}${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN} |
|
|
| 246 | else |
|
|
| 247 | if which md5sum >/dev/null 2>&1; then |
|
|
| 248 | cd ${S} |
|
|
| 249 | ( |
|
|
| 250 | cd ${ROOT}${VDR_INCLUDE_DIR}/vdr |
|
|
| 251 | md5sum *.h libsi/*.h|LC_ALL=C sort --key=2 |
|
|
| 252 | ) > header-md5-${PN} |
|
|
| 253 | doins header-md5-${PN} |
|
|
| 254 | fi |
|
|
| 255 | fi |
|
|
| 256 | } |
372 | } |
| 257 | |
373 | |
| 258 | vdr-plugin_pkg_postinst() { |
374 | vdr-plugin_pkg_postinst() { |
|
|
375 | if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then |
| 259 | update_vdrplugindb |
376 | update_vdrplugindb |
| 260 | einfo |
377 | fi |
|
|
378 | elog |
| 261 | einfo "The vdr plugin ${VDRPLUGIN} has now been installed." |
379 | elog "The vdr plugin ${VDRPLUGIN} has now been installed." |
| 262 | einfo "To activate execute the following command:" |
380 | elog "To activate execute the following command:" |
| 263 | einfo |
381 | elog |
| 264 | einfo " emerge --config ${PN}" |
382 | elog " emerge --config ${PN}" |
| 265 | einfo |
383 | elog |
| 266 | if [[ -n "${VDR_CONFD_FILE}" ]]; then |
384 | if [[ -n "${VDR_CONFD_FILE}" ]]; then |
| 267 | einfo "And have a look at the config-file" |
385 | elog "And have a look at the config-file" |
| 268 | einfo "/etc/conf.d/vdr.${VDRPLUGIN}" |
386 | elog "/etc/conf.d/vdr.${VDRPLUGIN}" |
| 269 | einfo |
387 | elog |
| 270 | fi |
388 | fi |
| 271 | } |
389 | } |
| 272 | |
390 | |
| 273 | vdr-plugin_pkg_postrm() { |
391 | vdr-plugin_pkg_postrm() { |
|
|
392 | if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then |
| 274 | remove_vdrplugindb |
393 | remove_vdrplugindb |
|
|
394 | fi |
|
|
395 | delete_orphan_plugindb_file |
| 275 | } |
396 | } |
| 276 | |
397 | |
| 277 | vdr-plugin_pkg_config_final() { |
398 | vdr-plugin_pkg_config_final() { |
| 278 | diff ${conf_orig} ${conf} |
399 | diff ${conf_orig} ${conf} |
| 279 | rm ${conf_orig} |
400 | rm ${conf_orig} |
| 280 | } |
401 | } |
| 281 | |
402 | |
| 282 | vdr-plugin_pkg_config() { |
403 | vdr-plugin_pkg_config_old() { |
|
|
404 | elog "Using interface of gentoo-vdr-scripts-0.3.6 and older" |
| 283 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
405 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
| 284 | INSTALLPLUGIN="${VDRPLUGIN}" |
406 | INSTALLPLUGIN="${VDRPLUGIN}" |
| 285 | fi |
407 | fi |
| 286 | # First test if plugin is already inside PLUGINS |
408 | # First test if plugin is already inside PLUGINS |
| 287 | local conf=/etc/conf.d/vdr |
409 | local conf=/etc/conf.d/vdr |
| 288 | conf_orig=${conf}.before_emerge_config |
410 | conf_orig=${conf}.before_emerge_config |
| 289 | cp ${conf} ${conf_orig} |
411 | cp ${conf} ${conf_orig} |
| 290 | |
412 | |
| 291 | einfo "Reading ${conf}" |
413 | elog "Reading ${conf}" |
| 292 | if ! grep -q "^PLUGINS=" ${conf}; then |
414 | if ! grep -q "^PLUGINS=" ${conf}; then |
| 293 | local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) |
415 | local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1) |
| 294 | if [[ -n "${LINE}" ]]; then |
416 | if [[ -n "${LINE}" ]]; then |
| 295 | sed -e ${LINE}'a PLUGINS=""' -i ${conf} |
417 | sed -e ${LINE}'a PLUGINS=""' -i ${conf} |
| 296 | else |
418 | else |
| … | |
… | |
| 309 | break; |
431 | break; |
| 310 | fi |
432 | fi |
| 311 | done |
433 | done |
| 312 | |
434 | |
| 313 | if [[ "${active}" == "1" ]]; then |
435 | if [[ "${active}" == "1" ]]; then |
| 314 | einfo "${INSTALLPLUGIN} already activated" |
436 | elog "${INSTALLPLUGIN} already activated" |
| 315 | echo |
437 | echo |
| 316 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
438 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
| 317 | if [[ "${answer}" != "yes" ]]; then |
439 | if [[ "${answer}" != "yes" ]]; then |
| 318 | einfo "aborted" |
440 | elog "aborted" |
| 319 | return |
441 | return |
| 320 | fi |
442 | fi |
| 321 | einfo "Removing ${INSTALLPLUGIN} from active plugins." |
443 | elog "Removing ${INSTALLPLUGIN} from active plugins." |
| 322 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) |
444 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1) |
| 323 | sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ |
445 | sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \ |
| 324 | -e ${LINE}'s/ \( \)*/ /g' \ |
446 | -e ${LINE}'s/ \( \)*/ /g' \ |
| 325 | -e ${LINE}'s/ "/"/g' \ |
447 | -e ${LINE}'s/ "/"/g' \ |
| 326 | -e ${LINE}'s/" /"/g' |
448 | -e ${LINE}'s/" /"/g' |
| … | |
… | |
| 328 | vdr-plugin_pkg_config_final |
450 | vdr-plugin_pkg_config_final |
| 329 | return |
451 | return |
| 330 | fi |
452 | fi |
| 331 | |
453 | |
| 332 | |
454 | |
| 333 | einfo "Adding ${INSTALLPLUGIN} to active plugins." |
455 | elog "Adding ${INSTALLPLUGIN} to active plugins." |
| 334 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) |
456 | local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1) |
| 335 | sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ |
457 | sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \ |
| 336 | -e ${LINE}'s/ \( \)*/ /g' \ |
458 | -e ${LINE}'s/ \( \)*/ /g' \ |
| 337 | -e ${LINE}'s/ "/"/g' \ |
459 | -e ${LINE}'s/ "/"/g' \ |
| 338 | -e ${LINE}'s/" /"/g' |
460 | -e ${LINE}'s/" /"/g' |
| 339 | |
461 | |
| 340 | vdr-plugin_pkg_config_final |
462 | vdr-plugin_pkg_config_final |
|
|
463 | } |
|
|
464 | |
|
|
465 | vdr-plugin_pkg_config_new() { |
|
|
466 | elog "Using interface introduced with gentoo-vdr-scripts-0.3.7" |
|
|
467 | if [[ -z "${INSTALLPLUGIN}" ]]; then |
|
|
468 | INSTALLPLUGIN="${VDRPLUGIN}" |
|
|
469 | fi |
|
|
470 | |
|
|
471 | active=0 |
|
|
472 | # First test if plugin is already inside PLUGINS |
|
|
473 | local conf=/etc/conf.d/vdr.plugins |
|
|
474 | exec 3<${conf} |
|
|
475 | while read -u 3 line; do |
|
|
476 | [[ ${line} == "" ]] && continue |
|
|
477 | [[ ${line:0:1} == "#" ]] && continue |
|
|
478 | set -- ${line} |
|
|
479 | [[ ${1} == ${INSTALLPLUGIN} ]] && active=1 |
|
|
480 | done |
|
|
481 | exec 3<&- |
|
|
482 | |
|
|
483 | if [[ $active == 0 ]]; then |
|
|
484 | elog "Adding ${INSTALLPLUGIN} to active plugins." |
|
|
485 | |
|
|
486 | # The pure edit process. |
|
|
487 | echo "${INSTALLPLUGIN}" >> "${conf}" |
|
|
488 | else |
|
|
489 | elog "${INSTALLPLUGIN} already activated" |
|
|
490 | echo |
|
|
491 | read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer |
|
|
492 | if [[ "${answer}" != "yes" ]]; then |
|
|
493 | elog "aborted" |
|
|
494 | return |
|
|
495 | fi |
|
|
496 | elog "Removing ${INSTALLPLUGIN} from active plugins." |
|
|
497 | |
|
|
498 | # The pure edit process |
|
|
499 | sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d" |
|
|
500 | fi |
|
|
501 | } |
|
|
502 | |
|
|
503 | vdr-plugin_pkg_config() { |
|
|
504 | if has_version ">media-tv/gentoo-vdr-scripts-0.3.6"; then |
|
|
505 | vdr-plugin_pkg_config_new |
|
|
506 | else |
|
|
507 | vdr-plugin_pkg_config_old |
|
|
508 | fi |
| 341 | } |
509 | } |
| 342 | |
510 | |
| 343 | fix_vdr_libsi_include() |
511 | fix_vdr_libsi_include() |
| 344 | { |
512 | { |
| 345 | einfo "Fixing include of libsi-headers" |
513 | einfo "Fixing include of libsi-headers" |