Commit Graph

255 Commits

Author SHA1 Message Date
Olivier Crête 46d3ec2e05 gnome: Require GObject-Introspection 1.58.1 for static libraries
Introspecting non-libtool static libraries requires a gir-scanner fix
which is only in 1.58.1 or later.
2018-11-06 13:09:32 -05:00
Olivier Crête a2a979cf43 gnome: Use full path for static libraries
Makes it a bit safer.
2018-11-05 21:33:07 -05:00
Olivier Crête 9da0c6af98 gnome: GIR works fine for static libraries
g-ir-scanner works as well with static libraries as with dynamic
2018-11-05 21:33:07 -05:00
TingPing 08216a3a86 gnome.compile_resources: Put dependency directories before current source dir
This avoids the problem of generated files with the same name as something in source
existing and using the wrong file.
2018-10-10 19:42:20 +03:00
Ting-Wei Lan bb9f60624b gnome: Quote arguments passed to gtkdoc-scangobj
It is possible for compiler flags to include special characters, such as
double quotes which are needed to define macros with -D options. Since
gtkdoc-scangobj uses shlex.split to split arguments passed to --cc,
--ld, --cflags, --ldflags into lists, we can safely use shlex.quote to
properly quote arguments for these options.
2018-10-08 23:12:51 +03:00
Iñigo Martínez ee80620f65 gnome.gtkdoc: Fix static library ldflags
When passing static libraries to gtkdoc, they are also appended as
shared libraries to ldflags, which makes the process to fail.

This has been changed to only append shared libraries to ldflags.

Fixes #3935
2018-09-28 13:02:13 -07:00
Ross Burton fe981b0231 gnome: use target c_args/c_link_args for g-ir-scanner when cross-compiling
When cross-compiling we shouldn't be passing the native c_args/c_link_args to
g-ir-scanner.
2018-09-28 17:18:24 +01:00
Ross Burton 47d115f6a8 gnome: add missing cflags/ldflags to gtk-doc when cross-compiling
When cross-compiling the gtk-doc calls were missing the configured c_args and
c_link_args.
2018-09-28 17:18:24 +01:00
Marco Trevisan (Treviño) 8a5671c017 gnome: use project compiler flags in gtkdoc
If add_project_arguments is used, gtkdoc will ignore it, so make sure we
pick these flags for the compiler too.

Fixes #2901
2018-09-25 15:03:09 +02:00
Marco Trevisan (Treviño) 5bec6c28e7 gnome: add support for `module_version`
gtk-doc for autotools has the concept of module version, that is used to define
the module install path and the devhelp2 basename.

Add a `module_version` parameter to gnome.gtkdoc to replicate the same behavior.
Updated the test checking that the install_dir is properly computed (if not
passed), and that the .devhelp2 file has proper name.

https://gitlab.gnome.org/GNOME/gtk-doc/blob/GTK_DOC_1_29/buildsystems/autotools/gtk-doc.make#L269
2018-09-21 09:13:21 +02:00
Iñigo Martínez eb7ed4dafb gnome.gtkdoc: Add new c_args parameter
gtkdoc-scangobj also accepts compiler arguments. In the same way
that include_directories includes directories, the new c_args
parameter also appends compiler arguments.
2018-09-17 21:27:02 +03:00
Iñigo Martínez d0a7ea5e6e gnome.gtkdoc: Fix dependencies compile_args in gtkdoc
One of the gtkdoc's steps calls to gtkdoc-scangobj that also accepts
compiler arguments by using the cflags option.

Compiler arguments from dependencies are also appended now.
2018-09-17 21:27:02 +03:00
Mathieu Duponchelle b2f92ea689 gnome: fix generate_gir when linking with libasan
The regression was introduced in my recent refactoring of
that method (8377ea4).

This commit simply restores the ordering of the generated
scan_command, ensuring `-lasan` and other internal linker
flags come before `--library` or `--program`
2018-08-31 08:09:28 -07:00
Nirbheek Chauhan ab1dbfe57f gnome: Filter LDFLAGS passed to g-ir-scanner
g-ir-scanner is very picky about the flags that it can accept, so the
build fails on macOS if you have Framework external dependencies,
which add -F and -framework arguments.

Also fix incorrect de-duping of -framework arguments for gtkdoc.
2018-08-15 06:16:35 -07:00
Nirbheek Chauhan d16dca7677 gnome: Filter CFLAGS that are passed to g-ir-scanner
g-ir-scanner barfs on any flags other than -D -I and -U
2018-08-15 06:16:35 -07:00
Mathieu Duponchelle 6ea939dd5f gnome.generate_gir: support generating gir for multiple libraries
Fixes #3688
2018-08-09 17:34:55 +02:00
Mathieu Duponchelle 8377ea45aa gnome.generate_gir: refactoring
The method was getting too long and difficult to make sense
of, this should make maintaining and updating it a bit easier.
2018-08-09 16:42:19 +02:00
Jussi Pakkanen 543a49a29c
Merge pull request #3799 from rossburton/gtkdoc
scripts/gtkdochelper: add support for --run
2018-07-31 19:37:00 +03:00
TingPing bd21987685 gnome: Fix building gir with asan again
asan must be first in ldflags and this order was lost in cb36add970

So this is the most simple solution of just putting it first in internal_ldflags

See https://github.com/mesonbuild/meson/issues/2117#issuecomment-408560838
2018-07-29 21:04:04 +03:00
Nirbheek Chauhan 43f7a75060 gnome.gdbus_codegen: Handle XML docbook in subdirs
Closes https://github.com/mesonbuild/meson/issues/3870
2018-07-11 22:47:12 +03:00
Ross Burton 49e97fb704 gtkdoc: pass the cross compiler if cross compiling
When cross-compiling, tell gtkdoc to use the cross compile instead of the target
compiler.
2018-07-09 23:44:35 +01:00
Nirbheek Chauhan 4fb00ee1d8 Add new method: mlog.deprecation()
Instead of constructing it manually, use a helper.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan f2b008f874 gnome.gtkdoc: Don't treat install_dir as a file option
Causes the value to be expanded to current source directory.

Fixes https://github.com/mesonbuild/meson/issues/3829
2018-07-06 05:44:02 +00:00
Jon Turney b387ab1ee1 Fix flake8 issues (#3834)
* Fix flake8 whitespace reports

$ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)'
./mesonbuild/coredata.py:337:5: E303 too many blank lines (2)

* Fix flake8 'variable assigned value but unused' reports

$ flake8 | grep -E F841
./mesonbuild/modules/gnome.py:922:9: F841 local variable 'target_name' is assigned to but never used

* Fix flake8 'imported but unused' reports

$ flake8 | grep F401
./mesonbuild/compilers/__init__.py:128:1: F401 '.c.ArmclangCCompiler' imported but unused
./mesonbuild/compilers/__init__.py:138:1: F401 '.cpp.ArmclangCPPCompiler' imported but unused
./mesonbuild/modules/__init__.py:4:1: F401 '..mlog' imported but unused

PR #3717 imports ARMCLANG compilers in __init__, but does not add them to
__all__, so they are not re-exported by the compilers package like
everything else.

* More details about flake8 in Contributing.md

Mention that Sider runs flake8
Suggest seting flake8 as a pre-commit hook
2018-07-05 18:08:04 +00:00
Nirbheek Chauhan 5113eb14b9 gnome: Use raw link arguments with g-ir and gtk-doc
Those tools use our arguments to build a file and execute it to
introspect it at runtime. However, they do not know that you can pass
the full path to the library to use, and ignore the arguments.

The long-term fix for this is to have them output a .c file that Meson
will build for them, which they can then run, but that will require
upstream changes:
https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/1

Closes https://github.com/mesonbuild/meson/issues/3774
2018-07-01 21:54:09 +00:00
Ting-Wei Lan cb36add970 gnome: Distinguish between internal and external linker flags
When an older version of the library being built is installed in the
same prefix as external dependencies, we have to be careful to construct
the linker or compiler command line. If a -L flag from external
dependencoes comes before a -L flag pointing to builddir, it is possible
for the linker to load older libraries from the installation prefix
instead of the newly built ones, which is likely to cause undefined
reference error.

Since the order of dependencies is not significant, we cannot expect
internal dependencies to appear before external dependencies when
recursively iterating the list of dependencies. To make it harder to
make mistakes, linker flags come from internal and external
dependencies are now stored in different order sets. Code using
_get_dependencies_flags are expected to follow the order when
constructing linker command line:

  1. Internal linker flags
  2. LDFLAGS set by users
  3. External linker flags

It is similar to what automake and libtool do for autotools projects.
2018-07-01 21:54:09 +00:00
Nirbheek Chauhan 59696234da gdbus_codegen: Only add autocleanup args if glib is new enough
Fixes https://github.com/mesonbuild/meson/issues/3766
2018-06-20 13:27:23 +00:00
Xavier Claessens 737f61792c gtkdoc: Fix dependencies not being built before invoking gtkdoc
In GLib when running "ninja gio-doc" without doing a full build first,
it won't build libraries and the generated gio-scan.c gets linked
against system libgio instead.

This fix 2 bugs: gtkdoc() was not passing 'depends' variable down to
_get_dependencies_flags(), and many places had 'if depends' which is
False when 'depends' is an empty list and not only when it's None. There
is no reason for that argument to be optional, we always want to collect
dependencies.
2018-06-19 12:06:43 +00:00
Corentin Noël 4aa848d5d6 Properly name the targets 2018-06-19 03:22:18 +00:00
Corentin Noël b58f71cd73 gdbus_codegen: Keep the same behavior for all GLib versions
previous version duplicated the outputs disallowing to select only the .c files or the .h files
The docbook output files weren't listed too.
2018-06-19 03:22:18 +00:00
Corentin Noël 551f99ffff generate_gir: Add all the files provided by the CustomTarget 2018-06-18 12:00:28 +00:00
Xavier Claessens c5cb65eb7c gtkdoc: Run gtkdoc-scangobj command from build directory
All paths in CFLAGS are relative to build_root, so current directory
must be there we invoking gtkdoc-scangobj.

Closes: #3379
2018-06-17 15:38:30 +03:00
Robert Ancell 375dcd546a gdbus_codegen: Support --c-generate-autocleanup 2018-06-08 12:36:50 +00:00
Robert Ancell 83665a482a gdbus_codegen: Support arbitrary extra arguments 2018-06-07 15:14:07 +00:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Xavier Claessens b7d442150d Move <lang>_args to coredata.compiler_options 2018-06-06 20:02:37 +00:00
Salamandar 2fb6018763 Add 0.46.0 features 2018-06-01 14:23:24 +02:00
Salamandar 4741f1e243 Add 0.42.0 features 2018-06-01 14:23:24 +02:00
Salamandar fa6550b277 Add 0.40.0 features 2018-06-01 14:23:24 +02:00
Salamandar accea4889b Add 0.37.0 features 2018-06-01 14:23:24 +02:00
Mathieu Duponchelle 6dd896d001 gnome/mkenums: allow passing generated files as templates 2018-05-23 23:23:08 +02:00
Nirbheek Chauhan 86cc4f2707 gdbus_codegen: Guess the output list for docbook generation
We were setting it to a file list that would always be wrong, and
always out of date since it would never exist.

However, the output list is not predictable. It usually has a 1-1
relationship with the input XML files, but it may not.

This must be fixed later with API for users to provide the output
names.

See: https://github.com/mesonbuild/meson/pull/3539
2018-05-09 21:04:55 +05:30
Nirbheek Chauhan 7ca2b8caca gtkdoc: Fix typo that made xml_files an array of arrays 2018-05-09 21:04:19 +05:30
Nirbheek Chauhan c1f275bfa6 gnome.gtkdoc: Allow passing file objects as xml_files
If we pass a source files() object, we will look for it in the build
directory, which is wrong. If we pass a build files() object (from
configure_file()), we will find it in the build directory, and then
try to copy it on top of itself in gtkdochelper.py getting a
SameFileError.

Add a test for it, and also properly iterate custom target outputs
when adding to content files.
2018-05-06 20:25:16 +05:30
Nirbheek Chauhan c5865c50c4 gnome: Use the header basename for #include in mkenums_simple
Otherwise, when you use a File target, the value will be the full path
to the header from the build root, which is not what anyone wants.
2018-05-05 17:33:29 +02:00
Nirbheek Chauhan 45aa57f660 gnome: Update minimum glib version for gdbus-codegen
The fix has landed upstream, and will be in the next glib stable
release. I have verified that it fixes the problem described in #3488
and that the 'frameworks/7 gnome' test passes now.
2018-05-05 11:36:46 +03:00
Nirbheek Chauhan 2e0485bb9b gnome: Disable usage of new --body and --header args
The new --body and --header args are broken because they do not allow
the use of --output-directory to set the correct `#include "foo.h"`
line in `foo.c`. The changes in the gdbus test case show this.

Disabled till this can be fixed in glib.

Closes https://github.com/mesonbuild/meson/issues/3488
2018-05-04 23:00:23 +03:00
Jussi Pakkanen ccaf5711cd Install generated gdbus header with old glib version too. 2018-04-28 00:19:29 +03:00
Nirbheek Chauhan 74404db469 gnome: If pkg-config is not found, assume glib is 2.54 (#3443)
* gnome: If pkg-config is not found, assume glib is 2.0

Checking the pkg-config file to confirm tool versions is a hack, and
should eventually be replaced with checking the actual versions of the
tools.

* gnome: Actually assume glib version is 2.54 if not found

It is actually not possible to build most projects with the GNOME
module if your glib is older, particularly genmarshal and
gdbus-codegen generate unusable output without newer arguments that
were added for Meson.
2018-04-21 17:05:31 +03:00
Nirbheek Chauhan b5c919ebfe gnome: gdbus-codegen add a `sources:` kwarg
It accepts multiple XML files, not just one. For example, glib uses
it that way.
2018-04-20 18:24:18 +00:00