Subject: Re: bug#11229: [Patch] Distcheck is broken for C/Vala mixed projects

From: Stefano Lattarini <[email-masked]>
Date: Thu, 12 Apr 2012 14:25:49 +0200

[Adding automake-patches]

Reference: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11229>

On 04/12/2012 11:10 AM, Marc-Antoine Perennou wrote:
> If a project has a single Makefile.am referrencing C and Vala projects,
> distcheck currenly fails telling there are no source files for generating
> stamps for C-only binaries.
> Attached patch avoid dealing with vala stuff for binaries not related to
> vala insice C/Vala mixed project + adds a test for it
> 
Thanks!  I've applied the patch in your name with minor stylistic changes
(see attachment).  I'm thus fixing this bug report.

Best regards,
  Stefano
>From c12161817a71b7ab5410896294ac44254e002d3b Mon Sep 17 00:00:00 2001
Message-Id: <c12161817[email-masked]>
From: Marc-Antoine Perennou <[email-masked]>
Date: Thu, 12 Apr 2012 13:32:58 +0200
Subject: [PATCH] vala: fix distcheck with c/vala mixed projects

Fixes automake bug#11229.

* automake.in (lang_vala_finish_target): Return early if the
current '_SOURCES' variable does not contain any '.vala' nor
'.vapi' source.  Otherwise, the vala compiler will be called
without arguments, causing an error.
* tests/vala-mix.test: Enhance to catch the fixed bug.

Copyright-paperwork-exempt: yes
Signed-off-by: Marc-Antoine Perennou <[email-masked]>
Signed-off-by: Stefano Lattarini <[email-masked]>
---
 automake.in         |    3 +++
 tests/vala-mix.test |   11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automake.in b/automake.in
index 08b3300..836680a 100644
--- a/automake.in
+++ b/automake.in
@@ -6041,6 +6041,9 @@ sub lang_vala_finish_target ($$)
 
   my @vala_sources = grep { /\.vala$/ } ($var->value_as_list_recursive);
 
+  # For automake bug#11229.
+  return unless @vala_sources;
+
   foreach my $vala_file (@vala_sources)
     {
       (my $c_file = $vala_file) =~ s/(.*)\.vala$/$1.c/;
diff --git a/tests/vala-mix.test b/tests/vala-mix.test
index 012b36a..fe48f26 100755
--- a/tests/vala-mix.test
+++ b/tests/vala-mix.test
@@ -29,12 +29,13 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-bin_PROGRAMS = zardoz mu
+bin_PROGRAMS = zardoz mu baz
 AM_VALAFLAGS = --profile=posix
 zardoz_SOURCES = foo.vala bar.c
 mu_SOURCES = 1.vala 2.c
 mu_VALAFLAGS = $(AM_VALAFLAGS) --main=run
 mu_CFLAGS = -DHAVE_MU
+baz_SOURCES = baz.c
 END
 
 if cross_compiling; then :; else
@@ -74,6 +75,14 @@ chocke me
 #endif
 END
 
+# For automake bug#11229.
+cat > baz.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
+
 $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
-- 
1.7.9.5

>From c12161817a71b7ab5410896294ac44254e002d3b Mon Sep 17 00:00:00 2001
Message-Id: <c12161817[email-masked]>
From: Marc-Antoine Perennou <[email-masked]>
Date: Thu, 12 Apr 2012 13:32:58 +0200
Subject: [PATCH] vala: fix distcheck with c/vala mixed projects

Fixes automake bug#11229.

* automake.in (lang_vala_finish_target): Return early if the
current '_SOURCES' variable does not contain any '.vala' nor
'.vapi' source.  Otherwise, the vala compiler will be called
without arguments, causing an error.
* tests/vala-mix.test: Enhance to catch the fixed bug.

Copyright-paperwork-exempt: yes
Signed-off-by: Marc-Antoine Perennou <[email-masked]>
Signed-off-by: Stefano Lattarini <[email-masked]>
---
 automake.in         |    3 +++
 tests/vala-mix.test |   11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automake.in b/automake.in
index 08b3300..836680a 100644
--- a/automake.in
+++ b/automake.in
@@ -6041,6 +6041,9 @@ sub lang_vala_finish_target ($$)
 
   my @vala_sources = grep { /\.vala$/ } ($var->value_as_list_recursive);
 
+  # For automake bug#11229.
+  return unless @vala_sources;
+
   foreach my $vala_file (@vala_sources)
     {
       (my $c_file = $vala_file) =~ s/(.*)\.vala$/$1.c/;
diff --git a/tests/vala-mix.test b/tests/vala-mix.test
index 012b36a..fe48f26 100755
--- a/tests/vala-mix.test
+++ b/tests/vala-mix.test
@@ -29,12 +29,13 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-bin_PROGRAMS = zardoz mu
+bin_PROGRAMS = zardoz mu baz
 AM_VALAFLAGS = --profile=posix
 zardoz_SOURCES = foo.vala bar.c
 mu_SOURCES = 1.vala 2.c
 mu_VALAFLAGS = $(AM_VALAFLAGS) --main=run
 mu_CFLAGS = -DHAVE_MU
+baz_SOURCES = baz.c
 END
 
 if cross_compiling; then :; else
@@ -74,6 +75,14 @@ chocke me
 #endif
 END
 
+# For automake bug#11229.
+cat > baz.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
+
 $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
-- 
1.7.9.5