[Vala] Vala update to handle other files in _SOURCES variable



Hello,

I ran into the issue/bug of having source files in my project that are
not supposed to be handled by the valac compiler but Automake tries to
pass them anyway. The attached patch now generates rules per file to
compile .vala to .c.  I think that some of the output rules can be
moved to vala.am, but I need feedback on the general patch
functionality before I make any further changes.  I since it still
passes all of the old tests and the new ones I created as well, I
think there should be minimal impact as is, but I don't know about the
other vala projects using Automake.  I've read the automake 2009
mailing list threads on how vala handles code, and I'm not sure I
understand why automake was trying to pass all the files at once and
create a stamp (maybe I'm using a newer version of valac that works
"correctly"?).

Basically, the patch takes code from yacc header output function, and
changes it to support vala header file generation in
lang_vala_target_hook.  The per-file rules for converting .vala to .c
are added at the end of lang_vala_target_hook as well.
Per-library/program header file and vapi generation is handled by
copying all of the vala specific source code to a temporary build
directory where valac is used to generate a whole target .h or .vapi
file.  The .h/.vapi is then copied to the output directory and the
temporary directory is removed.  This is the cleanest way I could
think of to do it and not have to worry about .c files being generated
in the source code directory if you are trying to do a split build.
Some other things to notice in the patch is the addition of the
no_unique_rename flag in the language settings.  I added this and some
code to handle_single_transform to ensure that the output c source
files were not renamed since that breaks the output rule generation
currently.  This rewrite may allow for renamed sources though, at
which point this extra language flag can be removed.  To generate
headers now, you can pass a general -H,-h,--header,--internal-header
flag in the AM_VALAFLAGS or <target>_VALAFLAGS and it will generate
per file headers.  It also allows a per-target header if you put one
of the header flags with a filename after it, but it will report an
error if you try to put a named header in the AM_VALAFLAGS or
VALAFLAGS varaible.  Same functionality goes for vapi generation.

Thanks,
Jason

Attachment: 0001-Update-Vala-support.patch
Description: Text Data



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