Subject: bug#8753: unable to build VALA project out-of-tree

From: Stefano Lattarini <[email-masked]>
Date: Fri, 2 Sep 2011 10:03:22 +0200

On Friday 02 September 2011, Zbigniew Jędrzejewski wrote:
> On 09/01/2011 09:35 PM, Stefano Lattarini wrote:
> > Hi Zbigniew, sorry for the shameful delay.
> No problem. Autotools are great anyway :)
>
Glad to hear that :-)

> > I'm quite ignorant about vala and also its support in automake,
> I think that the support is in general adequate -- systemd uses vala and 
> in general things get build like they are supposed too.
>
Again, glad to hear that.

> > but I do
> > think that VPATH builds are not really supported for vala.
> So it seems.
>
I mean, they are supported for distributed tarball (and this is checked in
the automake testsuite), but not for from-scratch builds, like e.g. from a
fresh git checkout.

> > Anyway, it would be nice to at least expose the problem in the Automake
> > testsuite, even if only as an XFAIL; do you have a minimal use case
> > exposing the issue?
> I've taken the hello world example from vala tutorial and wrapped it with
> Makefile.am and configure.ac.
> 
> It builds fine locally, and fails when build from an external directory:
> 
> /tmp/build % ~/src/vala_autotools_test/configure
> ...
> /tmp/build % make
> make: *** No rule to make target 
> `/home/zbyszek/src/vala_autotools_test/hello_vala.stamp', needed by 
> `/home/zbyszek/src/vala_autotools_test/src/hello.c'.  Stop.
> 
> The example is attached. Three files: configure.ac and Makefile.am go in 
> the root directory of the source tree, hello.vala goes into src/.
>
Thanks; I can reproduce the error, and I've managed to reduce your minimal
test case even more.  I've applied the attached patch to the 'maint' branch
in the automake repository.  The bug report remains open though, since for
closing it we should either fix the limitation or at least document it.

> Zbyszek

Thanks,
  Stefano
From eb59c423d7addf124d33f50ac920789db1304adb Mon Sep 17 00:00:00 2001
Message-Id: <eb59c423d[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Fri, 2 Sep 2011 09:56:20 +0200
Subject: [PATCH] coverage: vala support failing for VPATH from-scratch builds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* tests/vala-vpath.test: New test, xfailing.
* tests/Makefile.am (TESTS): Update.
* THANKS: Update.

From a report by Zbigniew Jędrzejewski-Szmek.

Related to automake bug#8753.
---
 ChangeLog             |    9 +++++++
 THANKS                |    1 +
 tests/Makefile.am     |    1 +
 tests/Makefile.in     |    1 +
 tests/vala-vpath.test |   58 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100755 tests/vala-vpath.test

diff --git a/ChangeLog b/ChangeLog
index 5d0eda1..f7514d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-09-02 Stefano Lattarini  <[email-masked]>
+
+	coverage: vala support failing for VPATH from-scratch builds
+	* tests/vala-vpath.test: New test, xfailing.
+	* tests/Makefile.am (TESTS): Update.
+	* THANKS: Update.
+	From a report by Zbigniew Jędrzejewski-Szmek.
+	Related to automake bug#8753.
+
 2011-09-01  Stefano Lattarini  <[email-masked]>
 
 	docs: report few more automake parsing limitations
diff --git a/THANKS b/THANKS
index d91c5bb..f83e1fc 100644
--- a/THANKS
+++ b/THANKS
@@ -365,6 +365,7 @@ William S Fulton	[email-masked]
 Yann Droneaud		[email-masked]
 Younes Younes		[email-masked]
 Zack Weinberg		[email-masked]
+Zbigniew Jędrzejewski-Szmek [email-masked]
 Zoltan Rado		[email-masked]
 
 ;; Local Variables:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6101460..4f8e0f6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -836,6 +836,7 @@ vala2.test \
 vala3.test \
 vala4.test \
 vala5.test \
+vala-vpath.test \
 vars.test \
 vars3.test \
 vartar.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 108672d..32e3297 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1114,6 +1114,7 @@ vala2.test \
 vala3.test \
 vala4.test \
 vala5.test \
+vala-vpath.test \
 vars.test \
 vars3.test \
 vartar.test \
diff --git a/tests/vala-vpath.test b/tests/vala-vpath.test
new file mode 100755
index 0000000..98e0f43
--- /dev/null
+++ b/tests/vala-vpath.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2011 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 to make sure vala support handles from-scratch VPATH builds.
+# See automake bug#8753.
+
+required="valac"
+. ./defs || Exit 1
+
+set -e
+
+mkdir src
+
+cat >> configure.in << 'END'
+AC_CONFIG_SRCDIR([hello.vala])
+AC_PROG_CC
+AM_PROG_VALAC([0.7])
+AC_OUTPUT
+END
+
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = hello.vala
+END
+
+cat > hello.vala <<'END'
+void main ()
+{
+  stdout.printf ("foo\n");
+  return 0;
+}
+END
+
+$ACLOCAL  || framework_failure_ "aclocal error"
+$AUTOCONF || framework_failure_ "autoconf error"
+$AUTOMAKE || framework_failure_ "automake error"
+
+mkdir build
+cd build
+../configure || Exit 77
+$MAKE
+$MAKE distcheck
+
+:
-- 
1.7.2.3