Implement full Vala language support using a two-stage compilation
approach: Vala source files are first transpiled to C code using valac
--ccode, then the generated C code is compiled to object files using the
C compiler.
Changes:
- Add Vala to exposed compiler languages in toolchains.h
- Configure valac in toolchains.meson with compile_only and output
handlers
- Implement write_vala_two_stage_compilation() helper in build_target.c
- Register both Vala and C compilers for Vala source files
- Add .vala and .vapi file extension handling
- Add VALAC environment variable support
- Include test case
closes#209
json parser now parses directly into meson objects with minimal
intermediate allocations. It also now reports parse error locations. A
new internal module was added to facilitate testing.
A few simplifications were made such as only caring about posix rules.
Additionally the shell_escape() function was re-evaluated based on posix
quoting rules.
To support some of the newer both libraries features, namely
dep.as_shared, dep.as_static, and:
> When default_both_libraries is 'auto', both_libraries() with
> dependencies that are both_libs themselves will link with the same kind
> of library.
A partial refactor was required. The main complication is that muon
preprocesses all dependencies into flat arrays of their components (e.g.
link_with, compile_args, etc.) at the time the dependency is created.
This includes flattening both_libs into a single path pointing to either
the shared or static lib. There was already a crude system to track the
original dependency inputs when they were occasionally needed, but now
that system has been much more fleshed out. Dependency objects should
now contain all the information needed to recreate them with different
options.
A few other changes were required as part of this refactor such as
supporting an option matrix in the project tests.
We should be extra strict on these scripts, particularly ones in the
runtime directory which are always executed and can cause unfixable
warnings to appear in user-level muon analyze calls. We could just hide
warnings from embedded scripts but that seems like a poor solution.
The path to muon may contain spaces, so a simple split(' ') is
insufficient. One approach would be to split on a different character
but we are already passing muon's path to the runner so just use a
special name for this case instead.
Thanks to @kzc for identifying this in github #127
Managing envvars is annoying on windows. run_cmd uses
SetEnvironmentVariable to build up the environment which converts all
variables to uppercase. Apparently this is because environment
variables are case-insensitive on windows. Python has a similar
behavior where all envvar accesses on windows are uppercased.
It should be possible to support lowercase envvars by manually
constructing the environment but I'm going to defer that work until it
breaks a project since it seems that technically that is "undefined
behavior".