From: Martin Nordholts <mart...@src.gnome.org>

Look for valac and prepare app/core for .vala source files. valac is
only needed when building from git, in tarballs the generated .c and
.h files are distributed.
---
 app/core/Makefile.am |   37 +++++++++++++++++++++++++++++++++++--
 configure.ac         |    3 +++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 3a8ee12..3f0985c 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -384,13 +384,21 @@ libappcore_a_sources = \
        gimpviewable.c                          \
        gimpviewable.h
 
+libappcore_a_built_sources_vala = \
+       $(NULL)
+
+libappcore_a_extra_sources_vala = \
+       $(NULL)
+
 libappcore_a_built_sources = \
        core-enums.c    \
        gimpmarshal.c   \
-       gimpmarshal.h
+       gimpmarshal.h   \
+       $(libappcore_a_built_sources_vala)
 
 libappcore_a_extra_sources = \
-       gimpmarshal.list
+       gimpmarshal.list        \
+       $(libappcore_a_extra_sources_vala)
 
 libappcore_a_SOURCES = $(libappcore_a_built_sources) $(libappcore_a_sources)
 
@@ -429,3 +437,28 @@ core-enums.c: $(srcdir)/core-enums.h $(GIMP_MKENUMS)
                $(srcdir)/core-enums.h > xgen-cec \
        && cp xgen-cec $(@F) \
        && rm -f xgen-cec
+
+#
+# Vala helpers
+#
+
+.vala.c:
+       $(VALAC_CHECK_AVAILABILITY)
+       $(VALA_V)$(VALAC) --compile --ccode --output=$@ $<
+       @touch $@ # See Bug 649084
+
+.vala.h:
+       $(VALAC_CHECK_AVAILABILITY)
+       $(VALA_V)$(VALAC) --compile --header=$@ $<
+       @touch $@ # See Bug 649084
+
+$(libappcore_a_built_sources_vala): Makefile.am $(VALAC)
+
+# Valac is not needed when building tarballs, but we should still fail
+# properly when valac is missing
+VALAC_CHECK_AVAILABILITY = @if test -z "$(VALAC)"; then echo "$<: *** No Vala 
compiler found, can't generate $@"; false; fi
+
+# From vala/Makefile.am in vala source, slightly modified
+VALA_V = $(VALA_V_$(V))
+VALA_V_ = $(VALA_V_$(AM_DEFAULT_VERBOSITY))
+VALA_V_0 = @echo "  VALAC " $@;
diff --git a/configure.ac b/configure.ac
index 1435000..8fabc5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,6 +155,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
 AC_PROG_CC
 AM_PROG_CC_C_O
 
+# Determine a Vala compiler to use. Not needed when building tarballs.
+AM_PROG_VALAC(0.9.3)
+
 # Initialize libtool
 AM_DISABLE_STATIC
 AC_LIBTOOL_WIN32_DLL
-- 
1.7.3.4

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to