| 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.45 2007/06/02 15:07:43 zzam Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.48 2007/08/14 18:42:22 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 | # Joerg Bornkessel <hd_brummy@gentoo.org> |
| 8 | |
8 | |
| … | |
… | |
| 175 | # Pathes to includes |
175 | # Pathes to includes |
| 176 | VDR_INCLUDE_DIR="/usr/include/vdr" |
176 | VDR_INCLUDE_DIR="/usr/include/vdr" |
| 177 | DVB_INCLUDE_DIR="/usr/include" |
177 | DVB_INCLUDE_DIR="/usr/include" |
| 178 | |
178 | |
| 179 | |
179 | |
|
|
180 | TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
|
|
181 | LOCDIR="/usr/share/vdr/locale" |
|
|
182 | if has_version ">=media-video/vdr-1.5.7"; then |
|
|
183 | USE_GETTEXT=1 |
|
|
184 | else |
|
|
185 | USE_GETTEXT=0 |
|
|
186 | fi |
|
|
187 | |
| 180 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
188 | VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
| 181 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
189 | APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h) |
| 182 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
190 | [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" |
| 183 | |
191 | |
| 184 | einfo "Building ${PF} against vdr-${VDRVERSION}" |
192 | einfo "Building ${PF} against vdr-${VDRVERSION}" |
| … | |
… | |
| 191 | eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup." |
199 | eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup." |
| 192 | echo |
200 | echo |
| 193 | eerror "Please report this at bugs.gentoo.org." |
201 | eerror "Please report this at bugs.gentoo.org." |
| 194 | die "vdr-plugin_pkg_setup not called!" |
202 | die "vdr-plugin_pkg_setup not called!" |
| 195 | fi |
203 | fi |
| 196 | [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile |
204 | [ -z "$1" ] && vdr-plugin_src_unpack unpack add_local_patch patchmakefile i18n |
| 197 | |
205 | |
| 198 | while [ "$1" ]; do |
206 | while [ "$1" ]; do |
| 199 | |
207 | |
| 200 | case "$1" in |
208 | case "$1" in |
| 201 | all_but_unpack) |
209 | all_but_unpack) |
| 202 | vdr-plugin_src_unpack add_local_patch patchmakefile |
210 | vdr-plugin_src_unpack add_local_patch patchmakefile i18n |
| 203 | ;; |
211 | ;; |
| 204 | unpack) |
212 | unpack) |
| 205 | base_src_unpack |
213 | base_src_unpack |
| 206 | ;; |
214 | ;; |
| 207 | patchmakefile) |
215 | patchmakefile) |
| … | |
… | |
| 213 | die "Could not change to plugin-source-directory!" |
221 | die "Could not change to plugin-source-directory!" |
| 214 | fi |
222 | fi |
| 215 | |
223 | |
| 216 | einfo "Patching Makefile" |
224 | einfo "Patching Makefile" |
| 217 | [[ -e Makefile ]] || die "Makefile of plugin can not be found!" |
225 | [[ -e Makefile ]] || die "Makefile of plugin can not be found!" |
| 218 | cp Makefile Makefile.orig |
226 | cp Makefile "${WORKDIR}"/Makefile.before |
| 219 | |
227 | |
| 220 | sed -i Makefile \ |
228 | sed -i Makefile \ |
| 221 | -e '1i\#Makefile was patched by vdr-plugin.eclass' |
229 | -e '1i\#Makefile was patched by vdr-plugin.eclass' |
| 222 | |
230 | |
| 223 | ebegin " Setting Pathes" |
231 | ebegin " Setting Pathes" |
| … | |
… | |
| 264 | for LOCALPATCH in ${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}/*.{diff,patch}; do |
272 | for LOCALPATCH in ${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}/*.{diff,patch}; do |
| 265 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
273 | test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" |
| 266 | done |
274 | done |
| 267 | fi |
275 | fi |
| 268 | ;; |
276 | ;; |
|
|
277 | i18n) |
|
|
278 | cd ${S} |
|
|
279 | if [[ ${USE_GETTEXT} = 0 ]]; then |
|
|
280 | # Remove i18n Target if using older vdr |
|
|
281 | sed -i Makefile \ |
|
|
282 | -e '/^all:/s/ i18n//' |
|
|
283 | elif [[ ${USE_GETTEXT} = 1 && ! -d po ]]; then |
|
|
284 | einfo "Converting translations to gettext" |
|
|
285 | |
|
|
286 | local i18n_tool=/usr/share/vdr/bin/i18n-to-gettext.pl |
|
|
287 | if [[ ! -x ${i18n_tool} ]]; then |
|
|
288 | eerror "Missing ${i18n_tool}" |
|
|
289 | eerror "Please re-emerge vdr" |
|
|
290 | die "Missing ${i18n_tool}" |
|
|
291 | fi |
|
|
292 | |
|
|
293 | # call i18n-to-gettext tool |
|
|
294 | # take all texts missing tr call into special file |
|
|
295 | ${i18n_tool} 2>/dev/null \ |
|
|
296 | |sed -e '/^"/!d' \ |
|
|
297 | -e '/^""$/d' \ |
|
|
298 | -e 's/\(.*\)/trNOOP(\1)/' \ |
|
|
299 | > dummy-translations-trNOOP.c |
|
|
300 | |
|
|
301 | # if there were untranslated texts just run it again |
|
|
302 | # now the missing calls are listed in |
|
|
303 | # dummy-translations-trNOOP.c |
|
|
304 | if [[ -s dummy-translations-trNOOP.c ]]; then |
|
|
305 | ${i18n_tool} &>/dev/null |
|
|
306 | fi |
|
|
307 | |
|
|
308 | # now use the modified Makefile |
|
|
309 | mv Makefile.new Makefile |
|
|
310 | fi |
| 269 | esac |
311 | esac |
| 270 | |
312 | |
| 271 | shift |
313 | shift |
| 272 | done |
314 | done |
| 273 | } |
315 | } |
| 274 | |
316 | |
| 275 | vdr-plugin_copy_source_tree() { |
317 | vdr-plugin_copy_source_tree() { |
| 276 | pushd . >/dev/null |
318 | pushd . >/dev/null |
| 277 | cp -r ${S} ${T}/source-tree |
319 | cp -r ${S} ${T}/source-tree |
| 278 | cd ${T}/source-tree |
320 | cd ${T}/source-tree |
| 279 | mv Makefile.orig Makefile |
321 | cp "${WORKDIR}"/Makefile.before Makefile |
| 280 | sed -i Makefile \ |
322 | sed -i Makefile \ |
| 281 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
323 | -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ |
| 282 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
324 | -e 's:^CXXFLAGS:#CXXFLAGS:' \ |
| 283 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
325 | -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ |
| 284 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
326 | -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' |
| … | |
… | |
| 312 | eerror "Please report this at bugs.gentoo.org." |
354 | eerror "Please report this at bugs.gentoo.org." |
| 313 | die "vdr-plugin_src_unpack not called!" |
355 | die "vdr-plugin_src_unpack not called!" |
| 314 | fi |
356 | fi |
| 315 | cd ${S} |
357 | cd ${S} |
| 316 | |
358 | |
| 317 | emake ${BUILD_PARAMS} ${VDRPLUGIN_MAKE_TARGET:-all} || die "emake failed" |
359 | emake ${BUILD_PARAMS} \ |
|
|
360 | ${VDRPLUGIN_MAKE_TARGET:-all} \ |
|
|
361 | LOCALEDIR="${TMP_LOCALE_DIR}" \ |
|
|
362 | || die "emake failed" |
| 318 | ;; |
363 | ;; |
| 319 | esac |
364 | esac |
| 320 | |
365 | |
| 321 | shift |
366 | shift |
| 322 | done |
367 | done |
| 323 | } |
368 | } |
| 324 | |
369 | |
| 325 | vdr-plugin_src_install() { |
370 | vdr-plugin_src_install() { |
| 326 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
371 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
| 327 | cd ${S} |
372 | cd "${WORKDIR}" |
| 328 | |
373 | |
| 329 | if [[ -n ${VDR_MAINTAINER_MODE} ]]; then |
374 | if [[ -n ${VDR_MAINTAINER_MODE} ]]; then |
| 330 | local mname=${P}-Makefile |
375 | local mname=${P}-Makefile |
| 331 | cp Makefile ${mname}.patched |
376 | cp "${S}"/Makefile ${mname}.patched |
| 332 | cp Makefile.orig ${mname}.before |
377 | cp Makefile.before ${mname}.before |
| 333 | |
378 | |
| 334 | diff -u ${mname}.before ${mname}.patched > ${mname}.diff |
379 | diff -u ${mname}.before ${mname}.patched > ${mname}.diff |
| 335 | |
380 | |
| 336 | insinto "/usr/share/vdr/maintainer-data/makefile-changes" |
381 | insinto "/usr/share/vdr/maintainer-data/makefile-changes" |
| 337 | doins ${mname}.diff |
382 | doins ${mname}.diff |
| … | |
… | |
| 342 | insinto "/usr/share/vdr/maintainer-data/makefile-patched" |
387 | insinto "/usr/share/vdr/maintainer-data/makefile-patched" |
| 343 | doins ${mname}.patched |
388 | doins ${mname}.patched |
| 344 | |
389 | |
| 345 | fi |
390 | fi |
| 346 | |
391 | |
|
|
392 | cd "${S}" |
| 347 | insinto "${VDR_PLUGIN_DIR}" |
393 | insinto "${VDR_PLUGIN_DIR}" |
| 348 | doins libvdr-*.so.* |
394 | doins libvdr-*.so.* |
|
|
395 | |
|
|
396 | if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then |
|
|
397 | einfo "Installing locales" |
|
|
398 | cd "${TMP_LOCALE_DIR}" |
|
|
399 | insinto "${LOCDIR}" |
|
|
400 | doins -r * |
|
|
401 | fi |
|
|
402 | |
|
|
403 | cd "${S}" |
| 349 | local docfile |
404 | local docfile |
| 350 | for docfile in README* HISTORY CHANGELOG; do |
405 | for docfile in README* HISTORY CHANGELOG; do |
| 351 | [[ -f ${docfile} ]] && dodoc ${docfile} |
406 | [[ -f ${docfile} ]] && dodoc ${docfile} |
| 352 | done |
407 | done |
| 353 | |
408 | |