[gtk+] Fix the build of the native gtk-update-icon-cache when cross-compiling.



commit 4376b4f705baec38e79449525e506bf4d28de4d2
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 13 07:11:23 2014 +0000

    Fix the build of the native gtk-update-icon-cache when cross-compiling.
    
    As a noinst_PROGRAMS, the libtool generated for cross-compiling will be
    used, which will mess up the linking. Create a all-local target instead.
    Also ensure that building uses always a native version of the tool by
    specifying a GTK_UPDATE_ICON_CACHE automake variable.
    Finally "config.h" has been created to work for the target platform and
    causes problem when cross-compiling. So we temporarily generate a basic
    config.h which contains only the strict minimum.

 configure.ac                     |   23 +++++++++++++----------
 demos/gtk-demo/Makefile.am       |    2 +-
 demos/widget-factory/Makefile.am |    2 +-
 gtk/Makefile.am                  |   10 ----------
 gtk/native/Makefile.am           |    8 +++++++-
 5 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6221f60..112c413 100644
--- a/configure.ac
+++ b/configure.ac
@@ -936,7 +936,9 @@ AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
 AS_IF([test "x$enable_gtk2_dependency" = xyes],
       [AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
        if test x$GTK_UPDATE_ICON_CACHE = xno; then
-         REBUILD_PNGS=#
+         AC_MSG_ERROR([
+*** --enable-gtk2-dependency has been set but no existing
+*** `gtk-update-icon-cache` has been found in the path.])
        fi],
 
       [test "x$cross_compiling" = xyes],
@@ -954,22 +956,23 @@ AS_IF([test "x$enable_gtk2_dependency" = xyes],
 
        NATIVE_GDKPIXBUF_CFLAGS=`$PKG_CONFIG_FOR_BUILD --cflags gdk-pixbuf-2.0`
        NATIVE_GDKPIXBUF_LIBS=`$PKG_CONFIG_FOR_BUILD --libs gdk-pixbuf-2.0`
+       # This is the native gtk-update-icon-cache which will be used at
+       # build time, NOT the one installed on the target host.
+       GTK_UPDATE_ICON_CACHE="`cd $srcdir && pwd`/gtk/native/native-update-icon-cache$BUILD_EXEEXT"
        AC_SUBST(NATIVE_GDKPIXBUF_CFLAGS)
-       AC_SUBST(NATIVE_GDKPIXBUF_LIBS)]
+       AC_SUBST(NATIVE_GDKPIXBUF_LIBS)
+       AC_SUBST(GTK_UPDATE_ICON_CACHE)],
+
+      [# In native compiling case, the gtk-update-icon-cache installed
+       # is the same as the one used during build.
+       GTK_UPDATE_ICON_CACHE="`cd $srcdir && pwd`/gtk/gtk/gtk-update-icon-cache$EXEEXT"
+       AC_SUBST(GTK_UPDATE_ICON_CACHE)]
 )
 
 AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$enable_gtk2_dependency" = xyes])
 
 AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
 
-if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
-   test "x$REBUILD_PNGS" = "x#" ; then
-     AC_MSG_ERROR([
-*** gtkbuiltincache.h is not in the tree, and cannot be built
-*** because you don't have libpng, or (when cross-compiling) you
-*** don't have a prebuilt gtk-update-icon-cache on the build system.])
-fi
-
 ########################################
 # Windowing system checks
 ########################################
diff --git a/demos/gtk-demo/Makefile.am b/demos/gtk-demo/Makefile.am
index 4eb3914..0ef288f 100644
--- a/demos/gtk-demo/Makefile.am
+++ b/demos/gtk-demo/Makefile.am
@@ -165,7 +165,7 @@ dist_appsicon32_DATA = data/32x32/gtk3-demo.png
 dist_appsicon48_DATA = data/48x48/gtk3-demo.png
 dist_appsicon256_DATA = data/256x256/gtk3-demo.png
 
-update_icon_cache = gtk-update-icon-cache --ignore-theme-index --force
+update_icon_cache = $(GTK_UPDATE_ICON_CACHE) --ignore-theme-index --force
 
 install-data-hook: install-update-icon-cache
 uninstall-hook: uninstall-update-icon-cache
diff --git a/demos/widget-factory/Makefile.am b/demos/widget-factory/Makefile.am
index ff72599..d04b9c7 100644
--- a/demos/widget-factory/Makefile.am
+++ b/demos/widget-factory/Makefile.am
@@ -45,7 +45,7 @@ dist_appsicon32_DATA = data/32x32/gtk3-widget-factory.png
 dist_appsicon48_DATA = data/48x48/gtk3-widget-factory.png
 dist_appsicon256_DATA = data/256x256/gtk3-widget-factory.png
 
-update_icon_cache = gtk-update-icon-cache --ignore-theme-index --force
+update_icon_cache = $(GTK_UPDATE_ICON_CACHE) --ignore-theme-index --force
 
 install-data-hook: install-update-icon-cache
 uninstall-hook: uninstall-update-icon-cache
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 7b78fb8..12877ef 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1704,16 +1704,6 @@ files:
          echo $$p; \
        done
 
-if USE_EXTERNAL_ICON_CACHE
-gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
-else
-if CROSS_COMPILING
-gtk_update_icon_cache_program = ./native/native-update-icon-cache
-else
-gtk_update_icon_cache_program = ./gtk-update-icon-cache$(EXEEXT)
-endif
-endif
-
 gsettings_SCHEMAS = \
        org.gtk.Settings.FileChooser.gschema.xml \
        org.gtk.Settings.ColorChooser.gschema.xml \
diff --git a/gtk/native/Makefile.am b/gtk/native/Makefile.am
index 64899e9..7516dab 100644
--- a/gtk/native/Makefile.am
+++ b/gtk/native/Makefile.am
@@ -4,9 +4,15 @@ CPP = @CPP_FOR_BUILD@
 AM_CPPFLAGS = @CPPFLAGS_FOR_BUILD@
 AM_LDFLAGS = @LDFLAGS_FOR_BUILD@
 
+native-update-icon-cache$(BUILD_EXEEXT): $(srcdir)/../updateiconcache.c
+       echo '#define GETTEXT_PACKAGE "gtk30"' > $(srcdir)/config.h
+       $(AM_V_CCLD)$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir)/../.. $(NATIVE_GDKPIXBUF_CFLAGS) 
$(CFLAGS_FOR_BUILD) $^ $(LDFLAGS_FOR_BUILD) $(NATIVE_GDKPIXBUF_LIBS) $(LIBS_FOR_BUILD) -o $@
+       rm -f $(srcdir)/config.h
+
 if CROSS_COMPILING
 if !USE_EXTERNAL_ICON_CACHE
-noinst_PROGRAMS = native-update-icon-cache
+all-local: native-update-icon-cache$(BUILD_EXEEXT)
+
 native_update_icon_cache_CFLAGS = $(NATIVE_GDKPIXBUF_CFLAGS)
 native_update_icon_cache_LDADD = $(NATIVE_GDKPIXBUF_LIBS)
 native_update_icon_cache_SOURCES = $(srcdir)/../updateiconcache.c


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]