bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Reuben Thomas
Subject: bug#70557: Fix compilation of Vala files conditionally added to _SOURCES
Date: Wed, 24 Apr 2024 22:57:17 +0200

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

Attachment: 0002-vala-do-not-build-Vala-sources-excluded-by-automake-.patch
Description: Text Data

Attachment: 0001-doc-add-missing-close-parenthesis-in-comment.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]