Commit Graph

277 Commits

Author SHA1 Message Date
Christoph Reiter 20eb948b97 gnome: make sure the target build directory is passed first for linking
determine_rpath_dirs() can return paths to external dependencies not
in the build dir and passing them first as a link path leads to
g-ir-scanner for example linking against the already installed library
instead of the just built one.

This was reported in g-i: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/272
and comes up quite often when a library adds some new symbols which aren't present in the
system library, which then makes linking fail.

The first place where the order is changed is _scan_gir_targets(), which looks like an unintentional
change in the refactoring in 8377ea45aa

The second place in _get_link_args() has always been that way and only the rpath order is changed,
but it looks to me as if the same rules should apply here too.
2019-05-28 20:25:37 +03:00
Federico Mena Quintero 60f34a1f51 gnome: use g_intern_static_string() for enum/flags type names
We are emitting a static string, so use that shortcut function to
intern it, which will save one allocation.
2019-05-21 21:53:15 +03:00
Score_Under 38b347ecd0 Do not filter out repeated cflags
Using a set breaks certain flags like `--param'.
2019-05-15 14:47:49 +03:00
Jussi Pakkanen 5dc613d618 Revert "gnome.compile_resources: Add ld binary method"
This reverts commit 59791fc569, reversing
changes made to e26b5a119e.
2019-03-28 23:23:01 +02:00
Ninja-Koala 1a986c90eb Fix #5046 2019-03-17 19:26:11 +02:00
Jussi Pakkanen 902aaf2ce6
Merge pull request #4626 from Ericson2314/consolidate-properties
Go through coreutils.compiler_options.{build.host.target}
2019-02-04 23:06:46 +01:00
Ninja-Koala 4775dd48a6
Fix required version 2019-02-03 13:14:36 +01:00
Ninja-Koala 0601895032
More robust name generation 2019-02-03 11:49:40 +01:00
Ninja-Koala b0832c8747
Move some additional functionality into the new function 2019-02-02 23:02:33 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Ninja-Koala 34191ec018
Use triple quote string for linkerscript 2019-02-02 19:46:32 +01:00
Ninja-Koala 83d78d7b6e
Move target generation in new function 2019-02-02 19:45:48 +01:00
Ninja-Koala b6a6076596
Disable for cross builds 2019-02-02 19:07:06 +01:00
Ninja-Koala 6026a35446
Handle minus sign correctly 2019-02-01 22:02:20 +01:00
Ninja-Koala 1f14a58d3b
Add second dependency file for c target 2019-02-01 22:02:20 +01:00
Ninja-Koala a6f09b9754
Remove dependency file from c target 2019-02-01 22:02:20 +01:00
Ninja-Koala 27edd112e2
Fix code formatting 2019-02-01 22:02:20 +01:00
Ninja-Koala b4f04a67de
gnome.compile_resources: Add ld binary method
Instead of generating a c file that gets compiled,
directly create object file with ld.

See https://gitlab.gnome.org/GNOME/glib/issues/1489
2019-02-01 22:02:19 +01:00
Elliott Sales de Andrade 52936e4a46 Add tsan and ubsan to g-ir-scanner workaround.
Both of these need to link to their respective libraries to build.
2019-01-31 22:11:18 +02:00
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
Thibault Saunier b4347ca4a9 gi: Handle new --source-top-dirs argument
This allows coherent relative paths in the gir "source-position"
2018-12-16 21:03:58 +02:00
Iñigo Martínez cecbbfab0e gnome.gtkdoc: Fix missing permitted `c_args` argument
Although `gtkdoc` function has support for `c_args` argument[0], it
produces warning messages due to missing string in the permitted
arguments list.

[0] https://github.com/mesonbuild/meson/pull/4192
2018-11-19 21:05:28 +02:00
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