| 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.46 2007/08/14 12:50:16 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) |
| … | |
… | |
| 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 | } |
| … | |
… | |
| 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 |
| … | |
… | |
| 326 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
371 | [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree |
| 327 | cd "${WORKDIR}" |
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.before ${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" |
| … | |
… | |
| 345 | fi |
390 | fi |
| 346 | |
391 | |
| 347 | cd "${S}" |
392 | cd "${S}" |
| 348 | insinto "${VDR_PLUGIN_DIR}" |
393 | insinto "${VDR_PLUGIN_DIR}" |
| 349 | 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}" |
| 350 | local docfile |
404 | local docfile |
| 351 | for docfile in README* HISTORY CHANGELOG; do |
405 | for docfile in README* HISTORY CHANGELOG; do |
| 352 | [[ -f ${docfile} ]] && dodoc ${docfile} |
406 | [[ -f ${docfile} ]] && dodoc ${docfile} |
| 353 | done |
407 | done |
| 354 | |
408 | |