When generating the .gir file we need g-ir-scanner to link the
introspector binary against the right dependencies, for that
we used to use the --library option but this has a special meaning
and the libs passed in there end up being the ones in the .gir file
itself, which is not what we want.
A new --extra-library option is beeing added in goject-introspection
(https://bugzilla.gnome.org/show_bug.cgi?id=774625) to handle our use case
(ie. not using libtool which allows g-ir-scanner to know about those)
and we should make use of it.
Closes#981
Otherwise trying to introspect tests might lead to:
Traceback (most recent call last):
File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonintrospect.py", line 20, in <module>
sys.exit(mintro.run(sys.argv[1:]))
File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/mintro.py", line 213, in run
list_tests(testdata)
File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/mintro.py", line 178, in list_tests
print(json.dumps(result))
File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.5/json/encoder.py", line 179, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <mesonbuild.build.EnvironmentVariables object at 0x7f83e8fa8c18> is not JSON serializable
Sometimes we want to restrict the acceptable versions to a list of
versions, or a smallest-version + largest-version, or both. For
instance, GStreamer's opencv plugin is only compatible with
3.1.0 >= opencv >= 2.3.0
We want compiler check arguments (-O0, -fpermissive, etc) to override
all other arguments, and we want extra_args passed in by the build file
to always override everything.
To do this properly, we must split include arguments out, append them
first, append all other arguments as usual, and then append the rest.
As part of this, we also add the compiler check flags to the
cc.compiles() and cc.links() helper functions since they also most
likely need them.
Also includes a unit test for all this.
Many frameworks, such as glib, provide translation functions and
functions that take format strings. As such every application using
these must duplicate the gettext arguments to function properly.
This reduces that duplication and improves correctness so they are
not left out.
Fixes#1123
I hit an issue when building gtk-doc documentation. The issue is
my fault, but the error output from Meson makes it look like an
internal error:
[0/1] 'Running external command libtracker-sparql-doc.'
Building documentation for libtracker-sparql
Traceback (most recent call last):
File "/home/sam/meson/meson.py", line 26, in <module>
sys.exit(main())
File "/home/sam/meson/meson.py", line 23, in main
return mesonmain.run(launcher, sys.argv[1:])
File "/home/sam/meson/mesonbuild/mesonmain.py", line 249, in run
sys.exit(run_script_command(args[1:]))
File "/home/sam/meson/mesonbuild/mesonmain.py", line 239, in run_script_command
return cmdfunc(cmdargs)
File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 183, in run
options.ignore_headers.split('@@') if options.ignore_headers else [])
File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 133, in build_gtkdoc
gtkdoc_run_check(mkhtml_cmd, os.path.join(abs_out, 'html'))
File "/home/sam/meson/mesonbuild/scripts/gtkdochelper.py", line 55, in gtkdoc_run_check
raise MesonException('\n'.join(err_msg))
mesonbuild.mesonlib.MesonException: 'gtkdoc-mkhtml' failed with status 6
warning: failed to load external entity "../overview.sgml"
../libtracker-sparql-docs.sgml:20: element include: XInclude error :
could not load ../overview.sgml, and no fallback was found
warning: failed to load external entity "../examples.sgml"
../libtracker-sparql-docs.sgml:41: element include: XInclude error :
could not load ../examples.sgml, and no fallback was found
FAILED: libtracker-sparql-doc
After this patch, the output is much clearer:
[0/1] 'Running external command libtracker-sparql-doc.'
Building documentation for libtracker-sparql
Error in gtkdoc helper script:
'gtkdoc-mkhtml' failed with status 6
warning: failed to load external entity "../overview.sgml"
../libtracker-sparql-docs.sgml:20: element include: XInclude error :
could not load ../overview.sgml, and no fallback was found
warning: failed to load external entity "../examples.sgml"
../libtracker-sparql-docs.sgml:41: element include: XInclude error :
could not load ../examples.sgml, and no fallback was found
Note the actual errors from xsltproc are swallowed by gtkdoc-mkhtml
1.25.1, they're only displayed in the example above because I made a
patch: <https://bugzilla.gnome.org/show_bug.cgi?id=774812>
This defaults to not exporting resources as that is generally what
you want but that does make this a breaking change. Along with that
if you export your resources you would want to install the header.
The install argument is allowed for CustomTargets, but we use
install_header as the setting now. Also, setting a generic template when
specifying the more specific source or header template shouldn't be
allowed.