GNU bug report logs - #70557
Fix compilation of Vala files conditionally added to _SOURCES

Previous Next

Package: automake;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Wed, 24 Apr 2024 20:59:06 UTC

Severity: normal

Done: Karl Berry <karl <at> freefriends.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70557 in the body.
You can then email your comments to 70557 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Wed, 24 Apr 2024 20:59:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Wed, 24 Apr 2024 20:59:09 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-automake <bug-automake <at> gnu.org>
Subject: Fix compilation of Vala files conditionally added to _SOURCES
Date: Wed, 24 Apr 2024 22:57:17 +0200
[Message part 1 (text/plain, inline)]
I attach two patches. The first is a trivial documentation fix. The second
fixes a bug I ran into recently with Vala compilation.

I just needed to add some Vala source files to my program that are added to
the relevant _SOURCES variable conditionally:

if OS_WIN32
libenchant_la_SOURCES += api-windows.vala
else
libenchant_la_SOURCES += api-posix.vala
endif

(Motivation: the reason I have to add the files conditionally is two-fold:
first, api-windows.vala and api-posix.vala call APIs that are only
available on Windows and POSIX systems respectively. In itself, this does
not require conditional inclusion; I can use Vala preprocessor directives,
just as I would in C. But the Vala compiler generates C files, and I want
the user of my package not to need a Vala compiler. Therefore, the
generated C code must be independent of build-time configuration. Since the
Vala compiler does not generate C preprocessor directives, I have to do
conditional inclusion at build time some other way. So, I am doing it by
using automake conditionals.)

With current automake, something like the following Makefile line is
generated:

$(builddir)/libenchant_la_vala.stamp: api-windows.vala api-posix.vala…

With my patch, the following line is generated instead:

$(builddir)/libenchant_la_vala.stamp: $(libenchant_la_SOURCES)

Of course, $(libenchant_la_SOURCES) expands to the actual sources.

The patch is trivial, so hopefully it's obvious if there's a problem for
some reason! I hope I explained well enough what problem I'm trying to
solve.

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]
[0002-vala-do-not-build-Vala-sources-excluded-by-automake-.patch (text/x-patch, attachment)]
[0001-doc-add-missing-close-parenthesis-in-comment.patch (text/x-patch, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Wed, 24 Apr 2024 21:40:05 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-automake <bug-automake <at> gnu.org>
Subject: Re: Fix compilation of Vala files conditionally added to _SOURCES
Date: Wed, 24 Apr 2024 23:38:13 +0200
[Message part 1 (text/plain, inline)]
On Wed, 24 Apr 2024 at 22:57, Reuben Thomas <rrt <at> sc3d.org> wrote:

>
> The patch is trivial, so hopefully it's obvious if there's a problem for
> some reason! I hope I explained well enough what problem I'm trying to
> solve.
>

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!).

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Wed, 24 Apr 2024 21:55:04 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-automake <bug-automake <at> gnu.org>
Subject: Re: Fix compilation of Vala files conditionally added to _SOURCES
Date: Wed, 24 Apr 2024 23:53:33 +0200
[Message part 1 (text/plain, inline)]
On Wed, 24 Apr 2024 at 23:38, Reuben Thomas <rrt <at> sc3d.org> 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
[Message part 2 (text/html, inline)]
[0002-vala-do-not-build-Vala-sources-excluded-by-automake-.patch (text/x-patch, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Thu, 25 Apr 2024 22:37:07 GMT) Full text and rfc822 format available.

Message #14 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: rrt <at> sc3d.org
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Thu, 25 Apr 2024 16:35:43 -0600
    Attached, an updated patch that passes the tests. It uses GNU Make
    functionality, but this is already required by the Vala support.

Thanks Ruben. I will peruse as soon as I have a chance, if no one else
gets there first ... -k




Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Fri, 26 Apr 2024 22:54:08 GMT) Full text and rfc822 format available.

Message #17 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: rrt <at> sc3d.org
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Fri, 26 Apr 2024 16:53:23 -0600
Reuben, any chance you can whomp up a test for this patch?

I don't see a problem with the change, but it's always better to add a
test against future regressions, etc. --thanks, karl.




Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Sat, 27 Apr 2024 18:38:02 GMT) Full text and rfc822 format available.

Message #20 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Karl Berry <karl <at> freefriends.org>
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Sat, 27 Apr 2024 20:36:42 +0200
[Message part 1 (text/plain, inline)]
On Sat, 27 Apr 2024 at 00:53, Karl Berry <karl <at> freefriends.org> wrote:

> Reuben, any chance you can whomp up a test for this patch?
>

No problem, I will do this when I can find a moment. Since I don't actually
need this fix after all, it may not be quick!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Sun, 28 Apr 2024 22:08:01 GMT) Full text and rfc822 format available.

Message #23 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Karl Berry <karl <at> freefriends.org>
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Mon, 29 Apr 2024 00:06:31 +0200
[Message part 1 (text/plain, inline)]
On Sat, 27 Apr 2024 at 20:36, Reuben Thomas <rrt <at> sc3d.org> wrote:

> On Sat, 27 Apr 2024 at 00:53, Karl Berry <karl <at> freefriends.org> wrote:
>
>> Reuben, any chance you can whomp up a test for this patch?
>>
>
> No problem, I will do this when I can find a moment. Since I don't
> actually need this fix after all, it may not be quick!
>

I found a moment, but not a fix. In fact, a fix is not in general possible
(or at least, not without a considerable amount of messing around). The
problem is that the Vala compiler needs to be able to see all the symbols
in the program, so you have to give it all the source files at once, so you
can't give it source files that contain alternative (duplicate) definitions
of the same symbol.

Hence, having conditionally-added sources like this is not compatible with
shipping all C sources in the tarball, or to put it another way, with
making the Vala compiler optional. But I think this is a great feature of
Automake's Vala support! (Certainly, I believe it is unique.)

So if Automake had in future a mode where it shipped only Vala sources,
then in that mode it would make sense to conditionally-include Vala
sources, and that would work.

As a consolation, I attach another patch that fixes some English in
comments in one of the Vala tests.

I guess it is worth documenting this limitation of the current Vala
support. If you agree with my reasoning above, then I will prepare a
documentation patch based on it.

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]
[0002-vala-fix-some-English-in-test-comments.patch (text/x-patch, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Mon, 29 Apr 2024 21:30:02 GMT) Full text and rfc822 format available.

Message #26 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: rrt <at> sc3d.org
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Mon, 29 Apr 2024 15:29:23 -0600
    so you have to give it all the source files at once, 

Wow.

    I guess it is worth documenting this limitation of the current Vala
    support. If you agree with my reasoning above, then I will prepare a
    documentation patch based on it.

All I know about Vala is what you've written, but given that, I do agree
it would be useful to document it. So a doc patch would be most welcome.

(The doc fixes in the test comments are fine, of course. I will apply
as soon as I have a chance.)

Thanks Reuben. -k




Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Tue, 30 Apr 2024 08:06:01 GMT) Full text and rfc822 format available.

Message #29 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Karl Berry <karl <at> freefriends.org>
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Tue, 30 Apr 2024 10:04:27 +0200
[Message part 1 (text/plain, inline)]
On Mon, 29 Apr 2024 at 23:29, Karl Berry <karl <at> freefriends.org> wrote:

>
> All I know about Vala is what you've written, but given that, I do agree
> it would be useful to document it. So a doc patch would be most welcome.
>

Attached.

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]
[0001-doc-update-Vala-documentation.patch (text/x-patch, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#70557; Package automake. (Mon, 06 May 2024 15:18:02 GMT) Full text and rfc822 format available.

Message #32 received at 70557 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: rrt <at> sc3d.org
Cc: 70557 <at> debbugs.gnu.org
Subject: Re: bug#70557: Fix compilation of Vala files conditionally added to
 _SOURCES
Date: Mon, 6 May 2024 09:17:01 -0600
Thanks for the Vala doc patch, Reuben. Installed and closing. --best, karl.




Reply sent to Karl Berry <karl <at> freefriends.org>:
You have taken responsibility. (Mon, 06 May 2024 15:18:02 GMT) Full text and rfc822 format available.

Notification sent to Reuben Thomas <rrt <at> sc3d.org>:
bug acknowledged by developer. (Mon, 06 May 2024 15:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 04 Jun 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.