[glib] Drop binary checks when cross-compiling



commit 5ce70917df75f87c89a9b1e9d0583ae4135f0b2c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 19 13:38:30 2015 +0100

    Drop binary checks when cross-compiling
    
    We don't need to run binaries we just built in order to successfully
    build GLib and friends any more.
    
    Since commit b74e2a7, we don't need to run glib-genmarshal when building
    GIO; since commit f9eb9eed, all our tests (including the ones that do
    need to run binaries we just built) are only built when running "make
    check", instead of unconditionally at every build.
    
    This means that we don't need to check for existing, native binaries
    when cross-compiling, and fail the configuration step if they are not
    found — which also means that you don't need to natively build GLib for
    your toolchain, in order to cross-compile GLib.
    
    We can also use the cross-compilation conditional, and skip those tests
    that require a binary we just built in order to build.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753745

 configure.ac              |   24 ++----------------------
 gio/tests/Makefile.am     |   12 +++++-------
 gobject/tests/Makefile.am |   14 ++++++++------
 tests/gobject/Makefile.am |   20 +++++++-------------
 4 files changed, 22 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d9b065f..3534ade 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2537,30 +2537,10 @@ int error = EILSEQ;
 ], have_eilseq=yes, have_eilseq=no);
 AC_MSG_RESULT($have_eilseq)
 
-dnl ******************************************************************
-dnl *** If we are cross-compiling, look for glib-genmarshal and    ***
-dnl *** glib-compile-schemas in PATH                               ***
-dnl ******************************************************************
-
+dnl Add a conditional we can use when cross-compiling, so we avoid running
+dnl binaries
 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
 
-AS_IF([ test $cross_compiling = yes ], [
-  AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no)
-  if test x$GLIB_GENMARSHAL = xno; then
-    AC_MSG_ERROR(Could not find a glib-genmarshal in your PATH)
-  fi
-
-  AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas, no)
-  if test x$GLIB_COMPILE_SCHEMAS = xno; then
-    AC_MSG_ERROR(Could not find a glib-compile-schemas in your PATH)
-  fi
-
-  AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources, no)
-  if test x$GLIB_COMPILE_RESOURCES = xno; then
-    AC_MSG_ERROR(Could not find a glib-compile-resources in your PATH)
-  fi
-])
-
 dnl **************************
 dnl *** Checks for gtk-doc ***
 dnl **************************
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 12c5b67..868873f 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -503,8 +503,10 @@ test_programs += \
 endif
 
 # -----------------------------------------------------------------------------
-#  The resources test is a bit more complicated...
+#  The resources test is a bit more complicated, and we cannot build it when
+#  cross-compiling GIO because it requires running a binary...
 
+if !CROSS_COMPILING
 test_programs += resources
 resources_SOURCES = resources.c
 nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h
@@ -526,11 +528,7 @@ if !ENABLE_INSTALLED_TESTS
 libresourceplugin_la_LDFLAGS += -rpath /
 endif
 
-if CROSS_COMPILING
-  glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
-else
-  glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
-endif
+glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
 
 resources.o: test_resources2.h
 test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/test2.gresource.xml)
@@ -546,8 +544,8 @@ test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --
        $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
 
 EXTRA_DIST += test.gresource.xml test1.txt test2.gresource.xml test2.txt test3.gresource.xml test3.txt 
test4.gresource.xml
-
 CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource
+endif # !CROSS_COMPILING
 
 BUILT_SOURCES += giotypefuncs.c
 
diff --git a/gobject/tests/Makefile.am b/gobject/tests/Makefile.am
index 534ca52..bfd962b 100644
--- a/gobject/tests/Makefile.am
+++ b/gobject/tests/Makefile.am
@@ -32,6 +32,12 @@ ifaceproperties_SOURCES = ifaceproperties.c testcommon.h
 
 # -----------------------------------------------------------------------------
 
+# The marshalers test requires running a binary, so we cannot build it when
+# cross-compiling
+
+if !CROSS_COMPILING
+glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
+
 test_programs += signals
 signals_SOURCES = signals.c
 nodist_signals_SOURCES = marshalers.c marshalers.h
@@ -39,14 +45,10 @@ signals.o: marshalers.h
 CLEANFILES += marshalers.h marshalers.c
 EXTRA_DIST += marshalers.list
 
-if CROSS_COMPILING
-  glib_genmarshal=$(GLIB_GENMARSHAL)
-else
-  glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
-endif
-
 marshalers.h: Makefile.am marshalers.list
        $(AM_V_GEN) $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --header --valist-marshallers 
marshalers.h
 
 marshalers.c: Makefile.am marshalers.h marshalers.list
        $(AM_V_GEN) (echo "#include \"marshalers.h\""; $(glib_genmarshal) --prefix=test 
$(srcdir)/marshalers.list --body --valist-marshallers) > $  tmp && mv $  tmp $@
+
+endif # !CROSS_COMPILING
diff --git a/tests/gobject/Makefile.am b/tests/gobject/Makefile.am
index 213f2b0..16f2827 100644
--- a/tests/gobject/Makefile.am
+++ b/tests/gobject/Makefile.am
@@ -48,11 +48,10 @@ if ENABLE_TIMELOOP
 installed_test_programs += timeloop-closure
 endif
 
-if CROSS_COMPILING
-  glib_genmarshal=$(GLIB_GENMARSHAL)
-else
-  glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
-endif
+# The marshal test requires running a binary, which means we cannot
+# build it when cross-compiling
+if !CROSS_COMPILING
+glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
 
 testmarshal.h: stamp-testmarshal.h
        @true
@@ -68,14 +67,9 @@ testmarshal.c: @REBUILD@ testmarshal.h testmarshal.list $(glib_genmarshal)
 
 BUILT_SOURCES += testmarshal.h testmarshal.c
 CLEANFILES += stamp-testmarshal.h
-
-EXTRA_DIST += \
-       testcommon.h                            \
-       testmarshal.list
-
-BUILT_EXTRA_DIST += \
-       testmarshal.h                           \
-       testmarshal.c
+EXTRA_DIST += testcommon.h testmarshal.list
+BUILT_EXTRA_DIST += testmarshal.h testmarshal.c
+endif # !CROSS_COMPILING
 
 dist-hook: $(BUILT_EXTRA_DIST)
        files='$(BUILT_EXTRA_DIST)';                            \


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