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
This commit is contained in:
Emmanuele Bassi 2015-08-19 13:38:30 +01:00 committed by Matthias Clasen
parent 1dec512a66
commit 5ce70917df
4 changed files with 22 additions and 48 deletions

View File

@ -2537,30 +2537,10 @@ int error = EILSEQ;
], have_eilseq=yes, have_eilseq=no); ], have_eilseq=yes, have_eilseq=no);
AC_MSG_RESULT($have_eilseq) AC_MSG_RESULT($have_eilseq)
dnl ****************************************************************** dnl Add a conditional we can use when cross-compiling, so we avoid running
dnl *** If we are cross-compiling, look for glib-genmarshal and *** dnl binaries
dnl *** glib-compile-schemas in PATH ***
dnl ******************************************************************
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes) 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 **************************
dnl *** Checks for gtk-doc *** dnl *** Checks for gtk-doc ***
dnl ************************** dnl **************************

View File

@ -503,8 +503,10 @@ test_programs += \
endif 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 test_programs += resources
resources_SOURCES = resources.c resources_SOURCES = resources.c
nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h
@ -526,11 +528,7 @@ if !ENABLE_INSTALLED_TESTS
libresourceplugin_la_LDFLAGS += -rpath / libresourceplugin_la_LDFLAGS += -rpath /
endif endif
if CROSS_COMPILING
glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
else
glib_compile_resources=$(top_builddir)/gio/glib-compile-resources glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
endif
resources.o: test_resources2.h resources.o: test_resources2.h
test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml) 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) $< $(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 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 CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource
endif # !CROSS_COMPILING
BUILT_SOURCES += giotypefuncs.c BUILT_SOURCES += giotypefuncs.c

View File

@ -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 test_programs += signals
signals_SOURCES = signals.c signals_SOURCES = signals.c
nodist_signals_SOURCES = marshalers.c marshalers.h nodist_signals_SOURCES = marshalers.c marshalers.h
@ -39,14 +45,10 @@ signals.o: marshalers.h
CLEANFILES += marshalers.h marshalers.c CLEANFILES += marshalers.h marshalers.c
EXTRA_DIST += marshalers.list 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 marshalers.h: Makefile.am marshalers.list
$(AM_V_GEN) $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --header --valist-marshallers > marshalers.h $(AM_V_GEN) $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --header --valist-marshallers > marshalers.h
marshalers.c: Makefile.am marshalers.h marshalers.list 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 $@ $(AM_V_GEN) (echo "#include \"marshalers.h\""; $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --body --valist-marshallers) > $@.tmp && mv $@.tmp $@
endif # !CROSS_COMPILING

View File

@ -48,11 +48,10 @@ if ENABLE_TIMELOOP
installed_test_programs += timeloop-closure installed_test_programs += timeloop-closure
endif endif
if CROSS_COMPILING # The marshal test requires running a binary, which means we cannot
glib_genmarshal=$(GLIB_GENMARSHAL) # build it when cross-compiling
else if !CROSS_COMPILING
glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
endif
testmarshal.h: stamp-testmarshal.h testmarshal.h: stamp-testmarshal.h
@true @true
@ -68,14 +67,9 @@ testmarshal.c: @REBUILD@ testmarshal.h testmarshal.list $(glib_genmarshal)
BUILT_SOURCES += testmarshal.h testmarshal.c BUILT_SOURCES += testmarshal.h testmarshal.c
CLEANFILES += stamp-testmarshal.h CLEANFILES += stamp-testmarshal.h
EXTRA_DIST += testcommon.h testmarshal.list
EXTRA_DIST += \ BUILT_EXTRA_DIST += testmarshal.h testmarshal.c
testcommon.h \ endif # !CROSS_COMPILING
testmarshal.list
BUILT_EXTRA_DIST += \
testmarshal.h \
testmarshal.c
dist-hook: $(BUILT_EXTRA_DIST) dist-hook: $(BUILT_EXTRA_DIST)
files='$(BUILT_EXTRA_DIST)'; \ files='$(BUILT_EXTRA_DIST)'; \