Patchwork [1/3] gtk+: version installed gtk-update-icon-cache and use alternatives

login
register
mail settings
Submitter Ross Burton
Date Jan. 9, 2013, 4:48 p.m.
Message ID <3871eb23bfa3bad736cccf1076a4424258039403.1357749457.git.ross.burton@intel.com>
Download mbox | patch
Permalink /patch/42397/
State New
Headers show

Comments

Ross Burton - Jan. 9, 2013, 4:48 p.m.
With GTK+ 3 being added soon we'll have potentially two providers of
gtk-update-icon-cache.  Append a version to the binary and use
update-alternatives to ensure that the unversioned name works.

For gtk+-native the alternatives won't take effect, so install a symlink
explicitly.  This will break if we have a gtk+3-native but we can fix that if
and when that happens.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-gnome/gtk+/gtk+.inc        |   15 +++++++++++++--
 meta/recipes-gnome/gtk+/gtk+_2.24.14.bb |    2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/recipes-gnome/gtk+/gtk+.inc b/meta/recipes-gnome/gtk+/gtk+.inc
index c6d235f..97d3650 100644
--- a/meta/recipes-gnome/gtk+/gtk+.inc
+++ b/meta/recipes-gnome/gtk+/gtk+.inc
@@ -23,11 +23,11 @@  PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
 PACKAGECONFIG[x11] = "--with-x=yes --with-gdktarget=x11,--with-x=no,${X11DEPENDS}"
 PACKAGECONFIG[gtk-directfb] = "--with-gdktarget=directfb,,directfb"
 
-inherit autotools gtk-doc pkgconfig
+inherit autotools gtk-doc pkgconfig update-alternatives
 
 PACKAGES += "libgail gtk-demo"
 
-FILES_${PN} = "${bindir}/gtk-update-icon-cache \
+FILES_${PN} = "${bindir}/gtk-update-icon-cache-2.0 \
 	${bindir}/gtk-query-immodules-2.0 \
 	${libdir}/lib*${SOLIBS} \
 	${datadir}/themes ${sysconfdir} \
@@ -66,6 +66,9 @@  GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
 RRECOMMENDS_${PN} = "${GTKBASE_RRECOMMENDS}"
 RRECOMMENDS_${PN}_libc-glibc = "${GTKGLIBC_RRECOMMENDS}"
 
+ALTERNATIVE_${PN} = "gtk-update-icon-cache"
+ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-2.0"
+
 do_install () {
 	autotools_do_install
 
@@ -77,6 +80,14 @@  do_install () {
 	install -m 0644 gtk/gtkfilechooserprivate.h ${D}${includedir}/gtk-2.0/gtk/
 	install -m 0644 gtk/gtkfilechooserutils.h   ${D}${includedir}/gtk-2.0/gtk/
 	install -m 0644 gtk/gtkfilesystemmodel.h    ${D}${includedir}/gtk-2.0/gtk/
+
+	mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-2.0
+}
+
+do_install_append_class-native () {
+	# Ideally we'd use alternatives in the sysroot, but they don't work.
+	# As we know we don't have a native GTK+ 3 (yet), make a symlink instead.
+	ln -s gtk-update-icon-cache-2.0 ${D}${bindir}/gtk-update-icon-cache
 }
 
 SYSROOT_PREPROCESS_FUNCS += "gtk_sysroot_preprocess"
diff --git a/meta/recipes-gnome/gtk+/gtk+_2.24.14.bb b/meta/recipes-gnome/gtk+/gtk+_2.24.14.bb
index 553196a..028b238 100644
--- a/meta/recipes-gnome/gtk+/gtk+_2.24.14.bb
+++ b/meta/recipes-gnome/gtk+/gtk+_2.24.14.bb
@@ -43,7 +43,7 @@  RRECOMMENDS_${PN}_class-native = ""
 DEPENDS_class-native = "glib-2.0-native atk-native pango-native cairo-native gdk-pixbuf-native"
 
 do_install_append_class-native () {
-	create_wrapper ${D}/${bindir}/gtk-update-icon-cache \
+	create_wrapper ${D}/${bindir}/gtk-update-icon-cache-2.0 \
 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
 }