| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 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/gnome2-utils.eclass,v 1.27 2012/05/02 21:05:38 eva Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.30 2012/10/23 20:32:51 eva Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: gnome2-utils.eclass |
5 | # @ECLASS: gnome2-utils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # gnome@gentoo.org |
7 | # gnome@gentoo.org |
| 8 | # @BLURB: Auxiliary functions commonly used by Gnome packages. |
8 | # @BLURB: Auxiliary functions commonly used by Gnome packages. |
| … | |
… | |
| 14 | # * GSettings schemas management |
14 | # * GSettings schemas management |
| 15 | # * GConf schemas management |
15 | # * GConf schemas management |
| 16 | # * scrollkeeper (old Gnome help system) management |
16 | # * scrollkeeper (old Gnome help system) management |
| 17 | |
17 | |
| 18 | case "${EAPI:-0}" in |
18 | case "${EAPI:-0}" in |
| 19 | 0|1|2|3|4) ;; |
19 | 0|1|2|3|4|5) ;; |
| 20 | *) die "EAPI=${EAPI} is not supported" ;; |
20 | *) die "EAPI=${EAPI} is not supported" ;; |
| 21 | esac |
21 | esac |
| 22 | |
22 | |
| 23 | # @ECLASS-VARIABLE: GCONFTOOL_BIN |
23 | # @ECLASS-VARIABLE: GCONFTOOL_BIN |
| 24 | # @INTERNAL |
24 | # @INTERNAL |
| … | |
… | |
| 384 | |
384 | |
| 385 | ebegin "Updating GSettings schemas" |
385 | ebegin "Updating GSettings schemas" |
| 386 | ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null |
386 | ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null |
| 387 | eend $? |
387 | eend $? |
| 388 | } |
388 | } |
|
|
389 | |
|
|
390 | # @FUNCTION: gnome2_query_immodules_gtk2 |
|
|
391 | # @USAGE: gnome2_query_immodules_gtk2 |
|
|
392 | # @DESCRIPTION: |
|
|
393 | # Updates gtk2 immodules/gdk-pixbuf loaders listing. |
|
|
394 | gnome2_query_immodules_gtk2() { |
|
|
395 | local GTK2_CONFDIR="/etc/gtk-2.0/$(get_abi_CHOST)" |
|
|
396 | |
|
|
397 | local query_exec="${EPREFIX}/usr/bin/gtk-query-immodules-2.0" |
|
|
398 | local gtk_conf="${EPREFIX}${GTK2_CONFDIR}/gtk.immodules" |
|
|
399 | local gtk_conf_dir=$(dirname "${gtk_conf}") |
|
|
400 | |
|
|
401 | einfo "Generating Gtk2 immodules/gdk-pixbuf loaders listing:" |
|
|
402 | einfo "-> ${gtk_conf}" |
|
|
403 | |
|
|
404 | mkdir -p "${gtk_conf_dir}" |
|
|
405 | local tmp_file=$(mktemp -t tmp.XXXXXXXXXXgtk_query_immodules) |
|
|
406 | if [ -z "${tmp_file}" ]; then |
|
|
407 | ewarn "gtk_query_immodules: cannot create temporary file" |
|
|
408 | return 1 |
|
|
409 | fi |
|
|
410 | |
|
|
411 | if ${query_exec} > "${tmp_file}"; then |
|
|
412 | cat "${tmp_file}" > "${gtk_conf}" || \ |
|
|
413 | ewarn "Failed to write to ${gtk_conf}" |
|
|
414 | else |
|
|
415 | ewarn "Cannot update gtk.immodules, file generation failed" |
|
|
416 | fi |
|
|
417 | rm "${tmp_file}" |
|
|
418 | } |
|
|
419 | |
|
|
420 | # @FUNCTION: gnome2_query_immodules_gtk3 |
|
|
421 | # @USAGE: gnome2_query_immodules_gtk3 |
|
|
422 | # @DESCRIPTION: |
|
|
423 | # Updates gtk3 immodules/gdk-pixbuf loaders listing. |
|
|
424 | gnome2_query_immodules_gtk3() { |
|
|
425 | "${EPREFIX}/usr/bin/gtk-query-immodules-3.0" --update-cache |
|
|
426 | } |
|
|
427 | |
|
|
428 | # @FUNCTION: gnome2_disable_deprecation_warning |
|
|
429 | # @DESCRIPTION: |
|
|
430 | # Disable deprecation warnings commonly found in glib based packages. |
|
|
431 | # Should be called from src_prepare. |
|
|
432 | gnome2_disable_deprecation_warning() { |
|
|
433 | local retval=0 |
|
|
434 | local fails=( ) |
|
|
435 | local makefile |
|
|
436 | |
|
|
437 | ebegin "Disabling deprecation warnings" |
|
|
438 | # The sort is important to ensure .am is listed before the respective .in for |
|
|
439 | # maintainer mode regeneration not kicking in due to .am being newer than .in |
|
|
440 | while read makefile ; do |
|
|
441 | if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then |
|
|
442 | continue |
|
|
443 | fi |
|
|
444 | |
|
|
445 | LC_ALL=C sed -r -i \ |
|
|
446 | -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(NULL):g' \ |
|
|
447 | -e 's:-DGSEAL_ENABLE:$(NULL):g' \ |
|
|
448 | -i "${makefile}" |
|
|
449 | |
|
|
450 | if [[ $? -ne 0 ]]; then |
|
|
451 | # Add to the list of failures |
|
|
452 | fails+=( "${makefile}" ) |
|
|
453 | retval=2 |
|
|
454 | fi |
|
|
455 | done < <(find "${S}" -name "Makefile.in" \ |
|
|
456 | -o -name "Makefile.am" -o -name "Makefile.decl" \ |
|
|
457 | -o -name "configure.ac" -o -name "configure.in" \ |
|
|
458 | | sort; echo configure) |
|
|
459 | eend ${retval} |
|
|
460 | |
|
|
461 | for makefile in "${fails[@]}" ; do |
|
|
462 | ewarn "Failed to disable deprecation warnings in ${makefile}" |
|
|
463 | done |
|
|
464 | } |