Subject: bug#70557: Fix compilation of Vala files conditionally added to _SOURCES

From: Reuben Thomas <[email-masked]>
Date: Wed, 24 Apr 2024 23:53:33 +0200

On Wed, 24 Apr 2024 at 23:38, Reuben Thomas <[email-masked]> wrote:

> Apologies, I should have run the tests before posting the patch. Indeed, I
> have broken things. So, please consider the documentation patch, and I'll
> take another look at the bug-fix (which in any case I have also realised
> does not solve my problem; it is the wrong approach!).
>

Attached, an updated patch that passes the tests. It uses GNU Make
functionality, but this is already required by the Vala support.

-- 
https://rrt.sc3d.org
From 93790078f509a4266da6bb436d1841feb7d66660 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Wed, 24 Apr 2024 22:41:48 +0200
Subject: [PATCH 2/2] vala: do not build Vala sources excluded by automake
 conditionals
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* bin/automake.in: make the _vala.stamp file depend on the relevant _SOURCES
variable’s value, not the fully-expanded list of all possible sources. This
means that source files added conditionally to a _SOURCES variable will only
be added when the condition is true.
---
 bin/automake.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/automake.in b/bin/automake.in
index 112730269..5c5afa0b2 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -5887,7 +5887,7 @@ sub lang_vala_finish_target
   my $stampfile = "\$(builddir)/${derived}_vala.stamp";
 
   $output_rules .=
-    "\$(builddir)/${derived}_vala.stamp: @vala_sources\n".
+    "\$(builddir)/${derived}_vala.stamp: \$(filter %.vala %.vapi,\$(${derived}_SOURCES))\n".
 # Since the C files generated from the vala sources depend on the
 # ${derived}_vala.stamp file, we must ensure its timestamp is older than
 # those of the C files generated by the valac invocation below (this is
-- 
2.34.1