| 1 | # Copyright 1999-2006 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.21 2011/01/31 17:03:45 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 | # |
|
|
| 6 | # gnome2-utils.eclass |
5 | # @ECLASS: gnome2-utils.eclass |
| 7 | # |
6 | # @MAINTAINER: |
| 8 | # Set of auxiliary functions used to perform actions commonly needed by packages |
7 | # gnome@gentoo.org |
| 9 | # using the GNOME framework. |
8 | # @BLURB: Auxiliary functions commonly used by Gnome packages. |
| 10 | # |
9 | # @DESCRIPTION: |
| 11 | # Maintained by Gentoo's GNOME herd <gnome@gentoo.org> |
10 | # This eclass provides a set of auxiliary functions needed by most Gnome |
| 12 | # |
11 | # packages. It may be used by non-Gnome packages as needed for handling various |
|
|
12 | # Gnome stack related functions such as: |
|
|
13 | # * Gtk+ icon cache management |
|
|
14 | # * GSettings schemas management |
|
|
15 | # * GConf schemas management |
|
|
16 | # * scrollkeeper (old Gnome help system) management |
| 13 | |
17 | |
| 14 | case "${EAPI:-0}" in |
18 | case "${EAPI:-0}" in |
| 15 | 0|1|2|3|4) ;; |
19 | 0|1|2|3|4|5) ;; |
| 16 | *) die "EAPI=${EAPI} is not supported" ;; |
20 | *) die "EAPI=${EAPI} is not supported" ;; |
| 17 | esac |
21 | esac |
| 18 | |
22 | |
|
|
23 | # @ECLASS-VARIABLE: GCONFTOOL_BIN |
|
|
24 | # @INTERNAL |
|
|
25 | # @DESCRIPTION: |
| 19 | # Path to gconftool-2 |
26 | # Path to gconftool-2 |
| 20 | : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} |
27 | : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} |
| 21 | |
28 | |
|
|
29 | # @ECLASS-VARIABLE: SCROLLKEEPER_DIR |
|
|
30 | # @INTERNAL |
|
|
31 | # @DESCRIPTION: |
| 22 | # Directory where scrollkeeper-update should do its work |
32 | # Directory where scrollkeeper-update should do its work |
| 23 | : ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"} |
33 | : ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"} |
| 24 | |
34 | |
|
|
35 | # @ECLASS-VARIABLE: SCROLLKEEPER_UPDATE_BIN |
|
|
36 | # @INTERNAL |
|
|
37 | # @DESCRIPTION: |
| 25 | # Path to scrollkeeper-update |
38 | # Path to scrollkeeper-update |
| 26 | : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"} |
39 | : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"} |
| 27 | |
40 | |
|
|
41 | # @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
|
|
42 | # @INTERNAL |
|
|
43 | # @DESCRIPTION: |
| 28 | # Path to gtk-update-icon-cache |
44 | # Path to gtk-update-icon-cache |
| 29 | : ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
45 | : ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
| 30 | |
46 | |
|
|
47 | # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS |
|
|
48 | # @INTERNAL |
|
|
49 | # @DESCRIPTION: |
| 31 | # Path to glib-compile-schemas |
50 | # Path to glib-compile-schemas |
| 32 | : ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"} |
51 | : ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"} |
| 33 | |
52 | |
|
|
53 | # @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS |
|
|
54 | # @INTERNAL |
|
|
55 | # @DEFAULT_UNSET |
|
|
56 | # @DESCRIPTION: |
|
|
57 | # List of GConf schemas provided by the package |
| 34 | |
58 | |
|
|
59 | # @ECLASS-VARIABLE: GNOME2_ECLASS_ICONS |
|
|
60 | # @INTERNAL |
|
|
61 | # @DEFAULT_UNSET |
|
|
62 | # @DESCRIPTION: |
|
|
63 | # List of icons provided by the package |
|
|
64 | |
|
|
65 | # @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS |
|
|
66 | # @INTERNAL |
|
|
67 | # @DEFAULT_UNSET |
|
|
68 | # @DESCRIPTION: |
|
|
69 | # List of scrolls (documentation files) provided by the package |
|
|
70 | |
|
|
71 | # @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS |
|
|
72 | # @INTERNAL |
|
|
73 | # @DEFAULT_UNSET |
|
|
74 | # @DESCRIPTION: |
|
|
75 | # List of GSettings schemas provided by the package |
| 35 | |
76 | |
| 36 | DEPEND=">=sys-apps/sed-4" |
77 | DEPEND=">=sys-apps/sed-4" |
| 37 | |
78 | |
| 38 | |
79 | |
|
|
80 | # @FUNCTION: gnome2_environment_reset |
|
|
81 | # @DESCRIPTION: |
|
|
82 | # Reset various variables inherited from root's evironment to a reasonable |
|
|
83 | # default for ebuilds to help avoid access violations and test failures. |
|
|
84 | gnome2_environment_reset() { |
|
|
85 | # Respected by >=glib-2.30.1-r1 |
|
|
86 | export G_HOME="${T}" |
| 39 | |
87 | |
|
|
88 | # GST_REGISTRY is to work around gst utilities trying to read/write /root |
|
|
89 | export GST_REGISTRY="${T}/registry.xml" |
|
|
90 | |
|
|
91 | # XXX: code for resetting XDG_* directories should probably be moved into |
|
|
92 | # a separate function in a non-gnome eclass |
|
|
93 | export XDG_DATA_HOME="${T}/.local/share" |
|
|
94 | export XDG_CONFIG_HOME="${T}/.config" |
|
|
95 | export XDG_CACHE_HOME="${T}/.cache" |
|
|
96 | export XDG_RUNTIME_DIR="${T}/run" |
|
|
97 | mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \ |
|
|
98 | "${XDG_RUNTIME_DIR}" |
|
|
99 | # This directory needs to be owned by the user, and chmod 0700 |
|
|
100 | # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |
|
|
101 | chmod 0700 "${XDG_RUNTIME_DIR}" |
|
|
102 | } |
|
|
103 | |
|
|
104 | # @FUNCTION: gnome2_gconf_savelist |
|
|
105 | # @DESCRIPTION: |
| 40 | # Find the GConf schemas that are about to be installed and save their location |
106 | # Find the GConf schemas that are about to be installed and save their location |
| 41 | # in the GNOME2_ECLASS_SCHEMAS environment variable |
107 | # in the GNOME2_ECLASS_SCHEMAS environment variable. |
|
|
108 | # This function should be called from pkg_preinst. |
| 42 | gnome2_gconf_savelist() { |
109 | gnome2_gconf_savelist() { |
| 43 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
110 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
| 44 | pushd "${ED}" &> /dev/null |
111 | pushd "${ED}" &> /dev/null |
| 45 | export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) |
112 | export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) |
| 46 | popd &> /dev/null |
113 | popd &> /dev/null |
| 47 | } |
114 | } |
| 48 | |
115 | |
| 49 | |
116 | # @FUNCTION: gnome2_gconf_install |
|
|
117 | # @DESCRIPTION: |
| 50 | # Applies any schema files installed by the current ebuild to Gconf's database |
118 | # Applies any schema files installed by the current ebuild to Gconf's database |
| 51 | # using gconftool-2 |
119 | # using gconftool-2. |
|
|
120 | # This function should be called from pkg_postinst. |
| 52 | gnome2_gconf_install() { |
121 | gnome2_gconf_install() { |
| 53 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
122 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
| 54 | local updater="${EROOT}${GCONFTOOL_BIN}" |
123 | local updater="${EROOT}${GCONFTOOL_BIN}" |
| 55 | |
124 | |
| 56 | if [[ ! -x "${updater}" ]]; then |
125 | if [[ ! -x "${updater}" ]]; then |
| … | |
… | |
| 84 | kill -HUP ${pids} |
153 | kill -HUP ${pids} |
| 85 | eend $? |
154 | eend $? |
| 86 | fi |
155 | fi |
| 87 | } |
156 | } |
| 88 | |
157 | |
| 89 | |
158 | # @FUNCTION: gnome2_gconf_uninstall |
|
|
159 | # @DESCRIPTION: |
| 90 | # Removes schema files previously installed by the current ebuild from Gconf's |
160 | # Removes schema files previously installed by the current ebuild from Gconf's |
| 91 | # database. |
161 | # database. |
| 92 | gnome2_gconf_uninstall() { |
162 | gnome2_gconf_uninstall() { |
| 93 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
163 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
| 94 | local updater="${EROOT}${GCONFTOOL_BIN}" |
164 | local updater="${EROOT}${GCONFTOOL_BIN}" |
| … | |
… | |
| 123 | kill -HUP ${pids} |
193 | kill -HUP ${pids} |
| 124 | eend $? |
194 | eend $? |
| 125 | fi |
195 | fi |
| 126 | } |
196 | } |
| 127 | |
197 | |
| 128 | |
198 | # @FUNCTION: gnome2_icon_savelist |
|
|
199 | # @DESCRIPTION: |
| 129 | # Find the icons that are about to be installed and save their location |
200 | # Find the icons that are about to be installed and save their location |
| 130 | # in the GNOME2_ECLASS_ICONS environment variable |
201 | # in the GNOME2_ECLASS_ICONS environment variable. |
| 131 | # That function should be called from pkg_preinst |
202 | # This function should be called from pkg_preinst. |
| 132 | gnome2_icon_savelist() { |
203 | gnome2_icon_savelist() { |
| 133 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
204 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
| 134 | pushd "${ED}" &> /dev/null |
205 | pushd "${ED}" &> /dev/null |
| 135 | export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) |
206 | export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) |
| 136 | popd &> /dev/null |
207 | popd &> /dev/null |
| 137 | } |
208 | } |
| 138 | |
209 | |
| 139 | |
210 | # @FUNCTION: gnome2_icon_cache_update |
|
|
211 | # @DESCRIPTION: |
| 140 | # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild |
212 | # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild |
| 141 | # have installed anything under that location. |
213 | # have installed anything under that location. |
|
|
214 | # This function should be called from pkg_postinst and pkg_postrm. |
| 142 | gnome2_icon_cache_update() { |
215 | gnome2_icon_cache_update() { |
| 143 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
216 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
| 144 | local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}" |
217 | local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}" |
| 145 | |
218 | |
| 146 | if [[ ! -x "${updater}" ]] ; then |
219 | if [[ ! -x "${updater}" ]] ; then |
| … | |
… | |
| 172 | # Add to the list of failures |
245 | # Add to the list of failures |
| 173 | fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}" |
246 | fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}" |
| 174 | |
247 | |
| 175 | retval=2 |
248 | retval=2 |
| 176 | fi |
249 | fi |
|
|
250 | elif [[ $(ls "${EROOT}${dir}") = "icon-theme.cache" ]]; then |
|
|
251 | # Clear stale cache files after theme uninstallation |
|
|
252 | rm "${EROOT}${dir}/icon-theme.cache" |
|
|
253 | fi |
|
|
254 | |
|
|
255 | if [[ -z $(ls "${EROOT}${dir}") ]]; then |
|
|
256 | # Clear empty theme directories after theme uninstallation |
|
|
257 | rmdir "${EROOT}${dir}" |
| 177 | fi |
258 | fi |
| 178 | done |
259 | done |
| 179 | |
260 | |
| 180 | eend ${retval} |
261 | eend ${retval} |
| 181 | |
262 | |
| 182 | for f in "${fails[@]}" ; do |
263 | for f in "${fails[@]}" ; do |
| 183 | eerror "Failed to update cache with icon $f" |
264 | eerror "Failed to update cache with icon $f" |
| 184 | done |
265 | done |
| 185 | } |
266 | } |
| 186 | |
267 | |
| 187 | |
268 | # @FUNCTION: gnome2_omf_fix |
|
|
269 | # @DESCRIPTION: |
| 188 | # Workaround applied to Makefile rules in order to remove redundant |
270 | # Workaround applied to Makefile rules in order to remove redundant |
| 189 | # calls to scrollkeeper-update and sandbox violations. |
271 | # calls to scrollkeeper-update and sandbox violations. |
|
|
272 | # This function should be called from src_prepare. |
| 190 | gnome2_omf_fix() { |
273 | gnome2_omf_fix() { |
| 191 | local omf_makefiles filename |
274 | local omf_makefiles filename |
| 192 | |
275 | |
| 193 | omf_makefiles="$@" |
276 | omf_makefiles="$@" |
| 194 | |
277 | |
| 195 | if [[ -f ${S}/omf.make ]] ; then |
278 | if [[ -f ${S}/omf.make ]] ; then |
| 196 | omf_makefiles="${omf_makefiles} ${S}/omf.make" |
279 | omf_makefiles="${omf_makefiles} ${S}/omf.make" |
|
|
280 | fi |
|
|
281 | |
|
|
282 | if [[ -f ${S}/gnome-doc-utils.make ]] ; then |
|
|
283 | omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make" |
| 197 | fi |
284 | fi |
| 198 | |
285 | |
| 199 | # testing fixing of all makefiles found |
286 | # testing fixing of all makefiles found |
| 200 | # The sort is important to ensure .am is listed before the respective .in for |
287 | # The sort is important to ensure .am is listed before the respective .in for |
| 201 | # maintainer mode regeneration not kicking in due to .am being newer than .in |
288 | # maintainer mode regeneration not kicking in due to .am being newer than .in |
| 202 | for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do |
289 | for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do |
| 203 | omf_makefiles="${omf_makefiles} ${filename}" |
290 | omf_makefiles="${omf_makefiles} ${filename}" |
| 204 | done |
291 | done |
| 205 | |
292 | |
| 206 | ebegin "Fixing OMF Makefiles" |
293 | ebegin "Fixing OMF Makefiles" |
| 207 | |
294 | |
| 208 | local retval=0 |
295 | local retval=0 |
| 209 | local fails=( ) |
296 | local fails=( ) |
| 210 | |
297 | |
| 211 | for omf in ${omf_makefiles} ; do |
298 | for omf in ${omf_makefiles} ; do |
| 212 | local rv=0 |
|
|
| 213 | |
|
|
| 214 | sed -i -e 's:scrollkeeper-update:true:' "${omf}" |
299 | sed -i -e 's:scrollkeeper-update:true:' "${omf}" |
| 215 | retval=$? |
300 | retval=$? |
| 216 | |
301 | |
| 217 | if [[ ! $rv -eq 0 ]] ; then |
302 | if [[ $retval -ne 0 ]] ; then |
| 218 | debug-print "updating of ${omf} failed" |
303 | debug-print "updating of ${omf} failed" |
| 219 | |
304 | |
| 220 | # Add to the list of failures |
305 | # Add to the list of failures |
| 221 | fails[$(( ${#fails[@]} + 1 ))]=$omf |
306 | fails[$(( ${#fails[@]} + 1 ))]=$omf |
| 222 | |
307 | |
| … | |
… | |
| 229 | for f in "${fails[@]}" ; do |
314 | for f in "${fails[@]}" ; do |
| 230 | eerror "Failed to update OMF Makefile $f" |
315 | eerror "Failed to update OMF Makefile $f" |
| 231 | done |
316 | done |
| 232 | } |
317 | } |
| 233 | |
318 | |
|
|
319 | # @FUNCTION: gnome2_scrollkeeper_savelist |
|
|
320 | # @DESCRIPTION: |
|
|
321 | # Find the scrolls that are about to be installed and save their location |
|
|
322 | # in the GNOME2_ECLASS_SCROLLS environment variable. |
|
|
323 | # This function should be called from pkg_preinst. |
|
|
324 | gnome2_scrollkeeper_savelist() { |
|
|
325 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
|
|
326 | pushd "${ED}" &> /dev/null |
|
|
327 | export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null) |
|
|
328 | popd &> /dev/null |
|
|
329 | } |
| 234 | |
330 | |
|
|
331 | # @FUNCTION: gnome2_scrollkeeper_update |
|
|
332 | # @DESCRIPTION: |
| 235 | # Updates the global scrollkeeper database. |
333 | # Updates the global scrollkeeper database. |
|
|
334 | # This function should be called from pkg_postinst and pkg_postrm. |
| 236 | gnome2_scrollkeeper_update() { |
335 | gnome2_scrollkeeper_update() { |
| 237 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
336 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
| 238 | if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then |
337 | local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}" |
|
|
338 | |
|
|
339 | if [[ ! -x "${updater}" ]] ; then |
|
|
340 | debug-print "${updater} is not executable" |
|
|
341 | return |
|
|
342 | fi |
|
|
343 | |
|
|
344 | if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then |
|
|
345 | debug-print "No scroll cache to update" |
|
|
346 | return |
|
|
347 | fi |
|
|
348 | |
| 239 | einfo "Updating scrollkeeper database ..." |
349 | ebegin "Updating scrollkeeper database ..." |
| 240 | "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" |
350 | "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" |
| 241 | fi |
351 | eend $? |
| 242 | } |
352 | } |
| 243 | |
353 | |
|
|
354 | # @FUNCTION: gnome2_schemas_savelist |
|
|
355 | # @DESCRIPTION: |
|
|
356 | # Find if there is any GSettings schema to install and save the list in |
|
|
357 | # GNOME2_ECLASS_GLIB_SCHEMAS variable. |
|
|
358 | # This function should be called from pkg_preinst. |
| 244 | gnome2_schemas_savelist() { |
359 | gnome2_schemas_savelist() { |
| 245 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
360 | has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
| 246 | pushd "${ED}" &>/dev/null |
361 | pushd "${ED}" &>/dev/null |
| 247 | export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) |
362 | export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) |
| 248 | popd &>/dev/null |
363 | popd &>/dev/null |
| 249 | } |
364 | } |
| 250 | |
365 | |
|
|
366 | # @FUNCTION: gnome2_schemas_update |
|
|
367 | # @USAGE: gnome2_schemas_update |
|
|
368 | # @DESCRIPTION: |
|
|
369 | # Updates GSettings schemas if GNOME2_ECLASS_GLIB_SCHEMAS has some. |
|
|
370 | # This function should be called from pkg_postinst and pkg_postrm. |
| 251 | gnome2_schemas_update() { |
371 | gnome2_schemas_update() { |
| 252 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
372 | has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
| 253 | local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" |
373 | local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" |
| 254 | |
374 | |
| 255 | if [[ ! -x ${updater} ]]; then |
375 | if [[ ! -x ${updater} ]]; then |
| … | |
… | |
| 264 | |
384 | |
| 265 | ebegin "Updating GSettings schemas" |
385 | ebegin "Updating GSettings schemas" |
| 266 | ${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 |
| 267 | eend $? |
387 | eend $? |
| 268 | } |
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 | } |