[gjs] build: Enable subdir-objects and symlink GI files



commit 6f533d2b792229038a910500b5404cf41175bc2c
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Sep 28 23:18:45 2016 -0700

    build: Enable subdir-objects and symlink GI files
    
    Currently we compile some of gobject-introspection's installed test code
    into our tests. In the next major version of Automake, this will not be
    supported anymore; object files and other compilation byproducts will be
    put into the same directory as the source file, which would not be
    possible with the GI files since they live in the installed tree.
    
    With current Automake we can turn on forward compatibility with the
    future behaviour using the subdir-objects option.
    
    At configure time we make symlinks to the GI files into the build dir so
    that they can still be compiled using the new Automake behaviour.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772027

 .gitignore           |    8 ++++++++
 Makefile-insttest.am |   15 ++++++++++++---
 configure.ac         |   13 ++++++++++++-
 3 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 80850ae..3542f2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
 *~
 .deps/
 .libs/
+.dirstamp
 INSTALL
 Makefile
 Makefile.in
@@ -41,6 +42,13 @@ valgrind.gjs-tests.log
 valgrind.gjs-unit.log
 installed-tests/gjs-installed-tests
 installed-tests/gjs-installed-tests.testmeta
+installed-tests/gimarshallingtests.c
+installed-tests/gimarshallingtests.h
+installed-tests/gitestmacros.h
+installed-tests/regress.c
+installed-tests/regress.h
+installed-tests/warnlib.c
+installed-tests/warnlib.h
 jsunit
 jsunit.test
 jsunit-resources.[ch]
diff --git a/Makefile-insttest.am b/Makefile-insttest.am
index dc390ce..1003b0c 100644
--- a/Makefile-insttest.am
+++ b/Makefile-insttest.am
@@ -62,7 +62,10 @@ check_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
 common_test_ldflags += -rpath /nowhere
 endif
 
-nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+nodist_libregress_la_SOURCES =         \
+       installed-tests/regress.c       \
+       installed-tests/regress.h       \
+       $(NULL)
 libregress_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
 libregress_la_LDFLAGS = $(common_test_ldflags) $(GJS_GDBUS_LIBS)
 libregress_la_LIBADD = $(common_test_libadd)
@@ -74,11 +77,17 @@ libregress_scannerflags_includes += --include=cairo-1.0
 else
 libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
 endif
-nodist_libwarnlib_la_SOURCES = $(GI_DATADIR)/tests/warnlib.c $(GI_DATADIR)/tests/warnlib.h
+nodist_libwarnlib_la_SOURCES =         \
+       installed-tests/warnlib.c       \
+       installed-tests/warnlib.h       \
+       $(NULL)
 libwarnlib_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
 libwarnlib_la_LDFLAGS = $(common_test_ldflags)
 libwarnlib_la_LIBADD = $(common_test_libadd)
-nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c 
$(GI_DATADIR)/tests/gimarshallingtests.h
+nodist_libgimarshallingtests_la_SOURCES =      \
+       installed-tests/gimarshallingtests.c    \
+       installed-tests/gimarshallingtests.h    \
+       $(NULL)
 libgimarshallingtests_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
 libgimarshallingtests_la_LDFLAGS = $(common_test_ldflags)
 libgimarshallingtests_la_LIBADD = $(common_test_libadd)
diff --git a/configure.ac b/configure.ac
index 2be893c..1e2df25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 +
 
 AC_PREREQ([2.64])
 
AC_INIT([gjs],[pkg_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gjs],[gjs],[https://wiki.gnome.org/Projects/Gjs])
-AM_INIT_AUTOMAKE([1.11.1 dist-xz no-dist-gzip tar-ustar -Wno-portability])
+AM_INIT_AUTOMAKE([1.11.1 subdir-objects dist-xz no-dist-gzip tar-ustar -Wno-portability])
 AX_IS_RELEASE([git-directory])
 AC_CONFIG_SRCDIR([gjs/console.cpp])
 AC_CONFIG_MACRO_DIR([m4])
@@ -208,6 +208,17 @@ dnl automake 1.11/1.12 defines this but does not substitute it
 AC_SUBST([pkglibexecdir], ["${libexecdir}/${PACKAGE}"])
 
 AC_CONFIG_FILES([Makefile gjs-1.0.pc gjs-internals-1.0.pc])
+dnl Symlink the files from gobject-introspection's test libraries into the tree;
+dnl Automake plans to drop support for compiling them in-place.
+AC_CONFIG_LINKS([
+  installed-tests/gitestmacros.h:$GI_DATADIR/tests/gitestmacros.h
+  installed-tests/regress.c:$GI_DATADIR/tests/regress.c
+  installed-tests/regress.h:$GI_DATADIR/tests/regress.h
+  installed-tests/warnlib.c:$GI_DATADIR/tests/warnlib.c
+  installed-tests/warnlib.h:$GI_DATADIR/tests/warnlib.h
+  installed-tests/gimarshallingtests.c:$GI_DATADIR/tests/gimarshallingtests.c
+  installed-tests/gimarshallingtests.h:$GI_DATADIR/tests/gimarshallingtests.h
+])
 AC_OUTPUT
 
 TEST_MSG=


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