[Adding automake-patches]

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

On 04/12/2012 12:17 AM, Marc-Antoine Perennou wrote:
>
> Attached is a patch which adds a minimal vapi file to the vala2 test which
> should be ok regarding copyrights.
> Vapi files are actually wrappers for vala to understand C headers.
> 
Thanks.  I've used your feedback to condense a new test case (instead of
editing the pre-existing vala2.test), and then applied your original
bug-fixing patch, and verified that it actually causes the new test to
pass.

The two resulting patches are attached; since you are listed as the main
author of one them and as a co-author of the other one, I'll wait for
your ACK before pushing.

Best regards,
  Stefano
>From 072071c7d1c20fc1c85ee1e09796a08f6504d1d0 Mon Sep 17 00:00:00 2001
Message-Id: <072071c7d1c20fc1c85ee1e09796a08f6504d1d0.1334228604.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Thu, 12 Apr 2012 00:40:34 +0200
Subject: [PATCH 1/2] vala: test vapi files handling (still failing)

Exposes automake bug#11222.

* tests/vala-vapi.test: New test, still failing.
* tests/list-of-tests.mk (handwritten_TESTS): Add it.
(XFAIL_TESTS): Likewise.
* THANKS: Update.

Copyright-paperwork-exempt: yes
Co-authored-by: Marc-Antoine Perennou <marc-anto...@perennou.com>
Signed-off-by: Marc-Antoine Perennou <marc-anto...@perennou.com>
Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 THANKS                 |    1 +
 tests/list-of-tests.mk |    2 ++
 tests/vala-vapi.test   |   91 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100755 tests/vala-vapi.test

diff --git a/THANKS b/THANKS
index a2091ab..e584fa7 100644
--- a/THANKS
+++ b/THANKS
@@ -215,6 +215,7 @@ Manu Rouat		emmanuel.ro...@wanadoo.fr
 Marcus Brinkmann	marcus.brinkm...@ruhr-uni-bochum.de
 Marcus G. Daniels	m...@ute.santafe.edu
 Marius Vollmer		m...@zagadka.ping.de
+Marc-Antoine Perennou	marc-anto...@perennou.com
 Mark D. Baushke		m...@cvshome.org
 Mark Eichin		eic...@cygnus.com
 Mark Elbrecht		snowba...@bigfoot.com
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 2548174..8367312 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -32,6 +32,7 @@ pr8365-remake-timing.test \
 lex-subobj-nodep.test \
 remake-am-pr10111.test \
 remake-m4-pr10111.test \
+vala-vapi.test \
 txinfo5.test
 
 perl_TESTS = \
@@ -929,6 +930,7 @@ vala2.test \
 vala3.test \
 vala4.test \
 vala5.test \
+vala-vapi.test \
 vala-vpath.test \
 vala-mix.test \
 vala-mix2.test \
diff --git a/tests/vala-vapi.test b/tests/vala-vapi.test
new file mode 100755
index 0000000..46e0dd4
--- /dev/null
+++ b/tests/vala-vapi.test
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test and that vapi files are correctly handled by Vala support.
+
+required='valac cc GNUmake'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_VALAC([0.7.3])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = zardoz
+AM_VALAFLAGS = --profile=posix
+zardoz_SOURCES = zardoz.vala foo.vapi foo.h
+END
+
+cat > zardoz.vala <<'END'
+int main ()
+{
+    stdout.printf (BARBAR);
+    return 0;
+}
+END
+
+echo '#define BARBAR "Zardoz!\n"' > foo.h
+
+cat > foo.vapi <<'END'
+[CCode (cprefix="", lower_case_cprefix="", cheader_filename="foo.h")]
+public const string BARBAR;
+END
+
+if cross_compiling; then :; else
+  unindent >> Makefile.am <<'END'
+    check-local: test2
+    .PHONY: test1 test2
+    test1:
+	./zardoz
+	./zardoz | grep 'Zardoz!'
+    test2:
+	./zardoz
+	./zardoz | grep 'Quux!'
+END
+fi
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure --enable-dependency-tracking
+
+$MAKE
+ls -l        # For debugging.
+cat zardoz.c # Likewise.
+grep 'BARBAR' zardoz.c
+$MAKE test1
+
+# Simple check on remake rules.
+$sleep
+echo '#define BAZBAZ "Quux!\n"' > foo.h
+sed 's/BARBAR/BAZBAZ/' zardoz.vala > t && mv -f t zardoz.vala || Exit 99
+$MAKE && Exit 1
+sed 's/BARBAR/BAZBAZ/' foo.vapi > t && mv -f t foo.vapi || Exit 99
+$MAKE
+cat zardoz.c # For debugging.
+grep 'BAZBAZ' zardoz.c
+$MAKE test2
+
+# Check the distribution.
+$MAKE distcheck
+
+:
-- 
1.7.9.5

>From 7b3199fb4bdcff7304223e0a20808ed7d5681f31 Mon Sep 17 00:00:00 2001
Message-Id: <7b3199fb4bdcff7304223e0a20808ed7d5681f31.1334228604.git.stefano.lattar...@gmail.com>
In-Reply-To: <072071c7d1c20fc1c85ee1e09796a08f6504d1d0.1334228604.git.stefano.lattar...@gmail.com>
References: <072071c7d1c20fc1c85ee1e09796a08f6504d1d0.1334228604.git.stefano.lattar...@gmail.com>
From: Marc-Antoine Perennou <marc-anto...@perennou.com>
Date: Wed, 11 Apr 2012 11:18:31 +0200
Subject: [PATCH 2/2] vala: fix vapi files handling

Fixes automake bug#11222.

Issue introduced in commit 'v1.11-696-g51f61df' of 27-02-2012,
"vala: fix 'valac' calls for projects with mixed Vala/C", which
fixed automake bug#10894.

* automake.in (lang_vala_finish_target): Also recognize '.vapi'
as an extension for vala input files.
* tests/list-of-tests.mk (XFAIL_TESTS): Remove 'vala-vapi.test'.

Copyright-paperwork-exempt: yes
Signed-off-by: Marc-Antoine Perennou <marc-anto...@perennou.com>
Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 automake.in            |    5 +++--
 tests/list-of-tests.mk |    1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/automake.in b/automake.in
index 08b3300..765a769 100644
--- a/automake.in
+++ b/automake.in
@@ -6039,16 +6039,17 @@ sub lang_vala_finish_target ($$)
   my $var = var "${derived}_SOURCES";
   return unless $var;
 
-  my @vala_sources = grep { /\.vala$/ } ($var->value_as_list_recursive);
+  my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive);
 
   foreach my $vala_file (@vala_sources)
     {
-      (my $c_file = $vala_file) =~ s/(.*)\.vala$/$1.c/;
+      my $c_file = $vala_file;
       $output_rules .= "\$(srcdir)/$c_file: \$(srcdir)/${derived}_vala.stamp\n"
         . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
         . "\t\@if test -f \$@; then :; else \\\n"
         . "\t  \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
         . "\tfi\n"
+        if $c_file =~ s/(.*)\.vala$/$1.c/;
     }
 
   # Add rebuild rules for generated header and vapi files
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 8367312..c344171 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -32,7 +32,6 @@ pr8365-remake-timing.test \
 lex-subobj-nodep.test \
 remake-am-pr10111.test \
 remake-m4-pr10111.test \
-vala-vapi.test \
 txinfo5.test
 
 perl_TESTS = \
-- 
1.7.9.5

Reply via email to