Currently, run_target does not get namespaced for each subproject,
unlike executable and others. This means that two subprojects sharing
the same run_target name cause meson to crash.
Fix this by moving the subproject namespacing logic from the BuildTarget
class to the Target class.
This allows a CustomTarget to be indexed, and the resulting indexed
value (a CustomTargetIndex type), to be used as a source in other
targets. This will confer a dependency on the original target, but only
inserts the source file returning by index the original target's
outputs. This can allow a CustomTarget that creates both a header and a
code file to have it's outputs split, for example.
Fixes#1470
This also adds a "# noqa: F401" comment on an unused "import lzma",
which we are using it in a try/except block that is being used to
check if the lzma module is importable; of course it is unused.
v2: This turned out to be a little tricky.
mesonbuild/modules/__init__.py had the "unused" import:
from ..interpreterbase import permittedKwargs, noKwargs
However, that meant that the various modules could do things like:
from . import noKwargs # "." is "mesonbuild.modules"
Which breaks when you remove __init__.py's "unused" import. I
could have tagged that import with "# noqa: F401", but instead I
chose to have each of the module import directly from
"..interpreterbase" instead of ".".
Add new 'docbook' argument which generates Docbook documentation for
each D-Bus interface. The docbook argument will be used as prefix
in `PREFIX`-NAME.xml pattern, and NAME will be replaced by the D-Bus
interfaces.
If we don't do that, the traversal of the sources list to generate the
sources file for g-ir-scanner is going to explode with a Python
backtrace like this one:
File "/usr/lib/python3.5/site-packages/mesonbuild/modules/gnome.py", line 463, in generate_gir
gir_filelist.write(os.path.join(srcdir, s) + '\n')
File "/usr/lib/python3.5/posixpath.py", line 89, in join
genericpath._check_arg_types('join', a, *p)
File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
(funcname, s.__class__.__name__)) from None
if the sources list contains a list.
On Windows, one will face the issue of the 8192-character limit for each
command line, so this will cause an issue when one is building items
like GTK+ with introspection, because the g-ir-scanner command line will
likely get too long, which will clearly break the build. This will
affect all Windows builds.
Make use of the --filelist option that is already in g-ir-scanner, and
generate such a file list from the sources that are fed to
generate_gir(), named as
$(builddir)/$(target_id)/<NameSpace>_<NameSpaceVersion>_gir_filelist
and using it during the build.
99% of all mkenums uses in C libraries use the same basic template,
so add a mkenums_simple() function that takes care of everything for
us based on that template.
Features:
- optional function declaration decorator such as GLIB_AVAILABLE
- optional extra header prefix (e.g. for include needed for decorator)
- optional extra body prefix (e.g. for additional includes)
- optional function name prefix (e.g. to add leading underscores)
Fixes issue #1384
gnome.compile_resources() was not parsing custom target sources
properly. It was using the custom target name as the output of the
custom target instead of looking at the list of outputs.
Also modify the GNOME framework test to expose this.
We prefer to use the --extra-library parameter for passing -l arguments
to g-ir-scanner, however we need to be careful to only replace the first
'-l' occurrence to not translate
'-lfoo-lib'
to
'--extra-library=foo--extra-library=ib'
The glib-genmarshal tool was rewritten in GLib 2.53.3, and now supports
more command line arguments, such as:
"--pragma-once": emits a "#pragma once" instead of the old header
guards when generating the header file
"--prototypes": emits the marshallers prototype when generating the
source file
"-D,-U": defines and undefines pre-processor symbols
"--include-header": emits an "#include" directive when generating the
source file for the specified header file
Meson should take advantage of these new options, as they can be used to
replace most of the ad hoc build rules that projects are currently using
to implement the same thing.
Instead of mapping each option to a named argument, I used the same
approach as the compile_resources() and generate_gir() methods; the
genmarshal() method now has an 'extra_args' argument that can be used to
pass extra arguments to the glib-genmarshal tool.
When dealing with the SharedLibrary or StaticLibrary include
directories, we where not taking into acount that path are relative to
the source tree. With proper helper, this works now. This fixues issue
where the gir may be generated bug from headers found in the prefix.
While g-ir-scanner's compatible -I and -D flags cover what most dependencies
use, there's no guarantee that a dependency's cflags don't include more
exotic flags that conflict with the tool's own options.
For a real world example, mozjs-38 has '-include some-header-file.h', which
translates to '--include nclude another-file-to-scan.h' for the scanner;
unless for some reason there's an 'nclude' GIR available on the system,
the target will thus fail.
For this purpose, g-ir-scanner allows explicitly marking some flags as
preprocessor/compiler flags by guarding them with --cflags-begin and
--cflags-end. Make sure it is used this for all cflags, not only for
global and project flags.