Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: vdr-plugin.eclass
Date: Sun, 13 Apr 2008 16:26:09
Message-Id: E1Jl51p-0008D5-Ri@stork.gentoo.org
1 zzam 08/04/13 16:26:05
2
3 Modified: vdr-plugin.eclass
4 Log:
5 Cleanup of eclass. Try to minimize changes to Makefile.
6
7 Revision Changes Path
8 1.55 eclass/vdr-plugin.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.55&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.55&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?r1=1.54&r2=1.55
13
14 Index: vdr-plugin.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v
17 retrieving revision 1.54
18 retrieving revision 1.55
19 diff -u -r1.54 -r1.55
20 --- vdr-plugin.eclass 22 Mar 2008 18:04:51 -0000 1.54
21 +++ vdr-plugin.eclass 13 Apr 2008 16:26:05 -0000 1.55
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2005 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.54 2008/03/22 18:04:51 zzam Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.55 2008/04/13 16:26:05 zzam Exp $
27 #
28 # Author:
29 # Matthias Schwarzott <zzam@g.o>
30 @@ -147,6 +147,146 @@
31 fi
32 }
33
34 +fix_vdr_libsi_include()
35 +{
36 + einfo "Fixing include of libsi-headers"
37 + local f
38 + for f; do
39 + sed -i "${f}" \
40 + -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
41 + -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
42 + done
43 +}
44 +
45 +vdr_patchmakefile() {
46 + einfo "Patching Makefile"
47 + [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
48 + cp Makefile "${WORKDIR}"/Makefile.before
49 +
50 + ebegin " Setting Pathes"
51 + sed -i Makefile \
52 + -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
53 + -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \
54 + -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \
55 + -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \
56 + -e "/^DVBDIR/d" \
57 + -e 's:-I$(DVBDIR)/include::'
58 + eend $?
59 +
60 + # maybe needed for multiproto:
61 + #sed -i Makefile \
62 + # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
63 + # -e 's:-I$(VDRDIR)/include -I$(DVBDIR)/include:-I$(DVBDIR)/include -I$(VDRDIR)/include:' \
64 + # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
65 +
66 + if ! grep -q APIVERSION Makefile; then
67 + ebegin " Converting to APIVERSION"
68 + sed -i Makefile \
69 + -e 's:^APIVERSION = :APIVERSION ?= :' \
70 + -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
71 + -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
72 + eend $?
73 + fi
74 +
75 + # Correcting Compile-Flags
76 + # Do not overwrite CXXFLAGS, add LDFLAGS if missing
77 + sed -i Makefile \
78 + -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
79 + -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
80 +
81 + # Disabling file stripping, useful for debugging
82 + sed -i Makefile \
83 + -e '/@.*strip/d' \
84 + -e '/strip \$(LIBDIR)\/\$@/d' \
85 + -e '/@.*\$(STRIP)/d'
86 +
87 + # Use a file instead of a variable as single-stepping via ebuild
88 + # destroys environment.
89 + touch "${WORKDIR}"/.vdr-plugin_makefile_patched
90 +}
91 +
92 +vdr_add_local_patch() {
93 + if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then
94 + echo
95 + einfo "Applying local patches"
96 + for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do
97 + test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
98 + done
99 + fi
100 +}
101 +
102 +vdr_i18n() {
103 + if [[ ${USE_GETTEXT} = 0 ]]; then
104 + # Remove i18n Target if using older vdr
105 + sed -i Makefile \
106 + -e '/^all:/s/ i18n//'
107 + elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then
108 + einfo "Plugin is not yet changed for new translation system."
109 + einfo "Auto converting translations to gettext"
110 +
111 + local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
112 + if [[ ! -x ${i18n_tool} ]]; then
113 + eerror "Missing ${i18n_tool}"
114 + eerror "Please re-emerge vdr"
115 + die "Missing ${i18n_tool}"
116 + fi
117 +
118 + # call i18n-to-gettext tool
119 + # take all texts missing tr call into special file
120 + "${i18n_tool}" 2>/dev/null \
121 + |sed -e '/^"/!d' \
122 + -e '/^""$/d' \
123 + -e 's/\(.*\)/trNOOP(\1)/' \
124 + > dummy-translations-trNOOP.c
125 +
126 + # if there were untranslated texts just run it again
127 + # now the missing calls are listed in
128 + # dummy-translations-trNOOP.c
129 + if [[ -s dummy-translations-trNOOP.c ]]; then
130 + "${i18n_tool}" &>/dev/null
131 + fi
132 +
133 + # now use the modified Makefile
134 + if [[ -f Makefile.new ]]; then
135 + mv Makefile.new Makefile
136 + else
137 + ewarn "Conversion to gettext failed. Plugin needs fixing."
138 + fi
139 + fi
140 +}
141 +
142 +vdr-plugin_copy_source_tree() {
143 + pushd . >/dev/null
144 + cp -r "${S}" "${T}"/source-tree
145 + cd "${T}"/source-tree
146 + cp "${WORKDIR}"/Makefile.before Makefile
147 + sed -i Makefile \
148 + -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
149 + -e 's:^CXXFLAGS:#CXXFLAGS:' \
150 + -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
151 + -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
152 + popd >/dev/null
153 +}
154 +
155 +vdr-plugin_install_source_tree() {
156 + einfo "Installing sources"
157 + destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
158 + insinto "${destdir}-${PV}"
159 + doins -r "${T}"/source-tree/*
160 +
161 + dosym "${VDRPLUGIN}-${PV}" "${destdir}"
162 +}
163 +
164 +vdr-plugin_print_enable_command() {
165 + elog
166 + elog "To activate this vdr-plugin execute the following command:"
167 + elog "\teselect vdr-plugin enable ${PN#vdr-}"
168 + elog
169 +}
170 +
171 +
172 +## exported functions
173 +
174 vdr-plugin_pkg_setup() {
175 # -fPIC is needed for shared objects on some platforms (amd64 and others)
176 append-flags -fPIC
177 @@ -176,8 +316,8 @@
178 APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
179 [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
180
181 - einfo "Building ${PF} against vdr-${VDRVERSION}"
182 - einfo "APIVERSION: ${APIVERSION}"
183 + einfo "Compiling against"
184 + einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
185 }
186
187 vdr-plugin_src_unpack() {
188 @@ -199,136 +339,24 @@
189 unpack)
190 base_src_unpack
191 ;;
192 - patchmakefile)
193 - if ! cd "${S}"; then
194 - ewarn "There seems to be no plugin-directory with the name ${S##*/}"
195 - ewarn "Perhaps you find one among these:"
196 - cd "${WORKDIR}"
197 - ewarn "$(/bin/ls -1 "${WORKDIR}")"
198 - die "Could not change to plugin-source-directory!"
199 - fi
200 -
201 - einfo "Patching Makefile"
202 - [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
203 - cp Makefile "${WORKDIR}"/Makefile.before
204 -
205 - sed -i Makefile \
206 - -e '1i\#Makefile was patched by vdr-plugin.eclass'
207 -
208 - ebegin " Setting Pathes"
209 - sed -i Makefile \
210 - -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \
211 - -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
212 - -e "s:^LIBDIR.*$:LIBDIR = ${S}:" \
213 - -e "s:^TMPDIR.*$:TMPDIR = ${T}:" \
214 - -e 's:-I$(VDRDIR)/include -I$(DVBDIR)/include:-I$(DVBDIR)/include -I$(VDRDIR)/include:' \
215 - -e 's:-I$(VDRDIR)/include:-I'"${VDR_INCLUDE_DIR%vdr}"':' \
216 - -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
217 - eend $?
218 -
219 - ebegin " Converting to APIVERSION"
220 - sed -i Makefile \
221 - -e 's:^APIVERSION = :APIVERSION ?= :' \
222 - -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
223 - -e '2i\APIVERSION = '"${APIVERSION}"
224 - eend $?
225 -
226 - ebegin " Correcting Compile-Flags"
227 - # Do not overwrite CXXFLAGS, add LDFLAGS if missing
228 - sed -i Makefile \
229 - -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
230 - -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
231 - eend $?
232 -
233 - ebegin " Disabling file stripping"
234 - sed -i Makefile \
235 - -e '/@.*strip/d' \
236 - -e '/strip \$(LIBDIR)\/\$@/d' \
237 - -e '/^STRIP =/d' \
238 - -e '/@.*\$(STRIP)/d'
239 - eend $?
240 -
241 - # Use a file instead of an variable as single-stepping via ebuild
242 - # destroys environment.
243 - touch "${WORKDIR}"/.vdr-plugin_makefile_patched
244 - ;;
245 add_local_patch)
246 - cd "${S}"
247 - if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then
248 - echo
249 - einfo "Applying local patches"
250 - for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do
251 - test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
252 - done
253 - fi
254 + cd "${S}" || die "Could not change to plugin-source-directory!"
255 + vdr_add_local_patch
256 + ;;
257 + patchmakefile)
258 + cd "${S}" || die "Could not change to plugin-source-directory!"
259 + vdr_patchmakefile
260 ;;
261 i18n)
262 - cd "${S}"
263 - if [[ ${USE_GETTEXT} = 0 ]]; then
264 - # Remove i18n Target if using older vdr
265 - sed -i Makefile \
266 - -e '/^all:/s/ i18n//'
267 - elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then
268 - einfo "Plugin is not yet changed for new translation system."
269 - einfo "Auto converting translations to gettext"
270 -
271 - local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
272 - if [[ ! -x ${i18n_tool} ]]; then
273 - eerror "Missing ${i18n_tool}"
274 - eerror "Please re-emerge vdr"
275 - die "Missing ${i18n_tool}"
276 - fi
277 -
278 - # call i18n-to-gettext tool
279 - # take all texts missing tr call into special file
280 - "${i18n_tool}" 2>/dev/null \
281 - |sed -e '/^"/!d' \
282 - -e '/^""$/d' \
283 - -e 's/\(.*\)/trNOOP(\1)/' \
284 - > dummy-translations-trNOOP.c
285 -
286 - # if there were untranslated texts just run it again
287 - # now the missing calls are listed in
288 - # dummy-translations-trNOOP.c
289 - if [[ -s dummy-translations-trNOOP.c ]]; then
290 - "${i18n_tool}" &>/dev/null
291 - fi
292 -
293 - # now use the modified Makefile
294 - if [[ -f Makefile.new ]]; then
295 - mv Makefile.new Makefile
296 - else
297 - ewarn "Conversion to gettext failed. Plugin needs fixing."
298 - fi
299 - fi
300 + cd "${S}" || die "Could not change to plugin-source-directory!"
301 + vdr_i18n
302 + ;;
303 esac
304
305 shift
306 done
307 }
308
309 -vdr-plugin_copy_source_tree() {
310 - pushd . >/dev/null
311 - cp -r "${S}" "${T}"/source-tree
312 - cd "${T}"/source-tree
313 - cp "${WORKDIR}"/Makefile.before Makefile
314 - sed -i Makefile \
315 - -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
316 - -e 's:^CXXFLAGS:#CXXFLAGS:' \
317 - -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \
318 - -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):'
319 - popd >/dev/null
320 -}
321 -
322 -vdr-plugin_install_source_tree() {
323 - einfo "Installing sources"
324 - destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
325 - insinto "${destdir}-${PV}"
326 - doins -r "${T}"/source-tree/*
327 -
328 - dosym "${VDRPLUGIN}-${PV}" "${destdir}"
329 -}
330 -
331 vdr-plugin_src_compile() {
332 [ -z "$1" ] && vdr-plugin_src_compile prepare compile
333
334 @@ -419,13 +447,6 @@
335 create_plugindb_file
336 }
337
338 -vdr-plugin_print_enable_command() {
339 - elog
340 - elog "To activate this vdr-plugin execute the following command:"
341 - elog "\teselect vdr-plugin enable ${PN#vdr-}"
342 - elog
343 -}
344 -
345 vdr-plugin_pkg_postinst() {
346 vdr-plugin_print_enable_command
347
348 @@ -440,58 +461,9 @@
349 delete_orphan_plugindb_file
350 }
351
352 -vdr-plugin_pkg_config_legacy() {
353 - elog "Using old interface to gentoo-vdr-scripts-0.3.7"
354 - if [[ -z "${INSTALLPLUGIN}" ]]; then
355 - INSTALLPLUGIN="${VDRPLUGIN}"
356 - fi
357 -
358 - active=0
359 - # First test if plugin is already inside PLUGINS
360 - local conf=/etc/conf.d/vdr.plugins
361 - exec 3<${conf}
362 - while read -u 3 line; do
363 - [[ ${line} == "" ]] && continue
364 - [[ ${line:0:1} == "#" ]] && continue
365 - set -- ${line}
366 - [[ ${1} == ${INSTALLPLUGIN} ]] && active=1
367 - done
368 - exec 3<&-
369 -
370 - if [[ $active == 0 ]]; then
371 - elog "Adding ${INSTALLPLUGIN} to active plugins."
372 -
373 - # The pure edit process.
374 - echo "${INSTALLPLUGIN}" >> "${conf}"
375 - else
376 - elog "${INSTALLPLUGIN} already activated"
377 - echo
378 - read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
379 - if [[ "${answer}" != "yes" ]]; then
380 - elog "aborted"
381 - return
382 - fi
383 - elog "Removing ${INSTALLPLUGIN} from active plugins."
384 -
385 - # The pure edit process
386 - sed -i "${conf}" -e "/^[[:space:]]*${INSTALLPLUGIN}[[:space:]]*\$/d"
387 - fi
388 -}
389 -
390 vdr-plugin_pkg_config() {
391 ewarn "emerge --config ${PN} is no longer supported"
392 vdr-plugin_print_enable_command
393 }
394
395 -fix_vdr_libsi_include()
396 -{
397 - einfo "Fixing include of libsi-headers"
398 - local f
399 - for f; do
400 - sed -i "${f}" \
401 - -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
402 - -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
403 - done
404 -}
405 -
406 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config
407
408
409
410 --
411 gentoo-commits@l.g.o mailing list