Commit Graph

474 Commits

Author SHA1 Message Date
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
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
Iñigo Martínez a52543cd1e gdbus_codegen: Fix install_dir parameter
The `install` parameter that is present in the `permittedKwargs`
annotation is wrong. The correct parameter name, which is also
consistent with the rest of functions in the `gnome` module, is
`install_dir`.
2018-04-18 21:15:52 +03:00
Nirbheek Chauhan 6cdd14fc4e find_program: Don't spam when called from a module
The user doesn't need to know whether or not the program was found,
especially not when it's spammed for every gnome.foo() function
2018-04-15 14:13:35 +05:30
Jussi Pakkanen 998892ed29 Updated all modules to work with the new API. 2018-04-15 13:32:38 +05:30
Jussi Pakkanen bdb57cf62a Convert Gnome module to use find_program from interpreter. 2018-04-15 13:32:38 +05:30
Iñigo Martínez 435cd8c922 gdbus_codegen: Fix new generated objects
The `ct` variable used in the ModuleReturnValue is created only for
versions earlier than 2.55.2. However, in newer versions that
variable does not exist.
2018-04-12 08:18:07 +02:00
Iñigo Martínez e656b9c819 gdbus_codegen: Fix custom target name
The namebase which is used as the target name, also holds part of
the file names. This used in combination generates files with wrong
names.
2018-04-12 08:10:13 +02:00
Nirbheek Chauhan d7b401f7d7 gdbus_codegen: Return 2 targets when docbook is disabled
Also document this behaviour, test it, and fix the return value from
the module -- we create one target and return it thrice to the build
file
2018-04-11 21:30:47 +05:30
Iñigo Martínez b2636ceef9 gnome: Validate docbook parameter is a string
The `docbook` parameter used in `gdbus_codegen` should contain
the prefix string in `PREFIX-NAME.xml`. Therefore it has to be
validated as a string.
2018-04-11 17:22:20 +02:00
Iñigo Martínez 351b59f03a gnome: Split header and code targets in gdbus_codegen()
The development version of `glib` (2.55.2) has acquired support for
generating gdbus header and source code files separately. This
allows dependencies to be more fine grained on those targets
depending only on the header.
2018-04-11 17:22:12 +02:00
Emmanuele Bassi e103675a39 Never install the glib-mkenums generated C source (#3374)
* Never install the glib-mkenums generated C source

When using gnome.mkenums_simple() we end up installing the generated
C source file alongside the C header file, if `install_header` is set
to True. This is caused by mkenums_simple() acting as a wrapper for
mkenums() without template files; mkenums() won't be able to know if
we're generating the header or the source, and will use the presence
of `install_header` as the deciding factor as to whether the generated
file should be installed.

When generating the C source file, we should always unset the
`install_header` option to False, just like mkenums() expects.

Closes #3373

* Verify that mkenums_simple() does not install C sources

When asked to installed the generated C header file.
2018-04-09 23:35:57 +03:00
Iñigo Martínez c1fcc8ab3e gnome.gtkdoc: Fix generated files used as content files
The `gtkdoc` function in the `gnome` module is able to use generated
files as content files, but the path to these is wrong in the used
command line.
2018-04-04 22:47:10 +03:00
Aleksey Filippov 077d59daa4 Add link_whole argument to declare_dependency() 2018-03-06 01:44:26 +00:00
Nirbheek Chauhan 0c1c387703 gnome: Fix depend_files listing for compile_resources
Also add a unit test that will test all codepaths for old Glib tools
versions.

Closes https://github.com/mesonbuild/meson/issues/2860
2018-02-20 19:26:16 +02:00
Jon Turney 7bfcf68777 Add get_pkgconfig_variable(default:)
Also use that to squelch the warning for internal uses which handle the
variable missing case (just gnome at the moment)

A follow up to PR #2914
2018-02-08 00:35:38 +02:00
Ting-Wei Lan 7b4bcdf21e gnome: Always use an ordered set to store LDFLAGS
The order of -L flags in LDFLAGS is critical to the build. Any
unexpected reordering can cause undefined reference error when linking.
2018-01-07 01:56:05 +08:00
Ting-Wei Lan ab2f68ec9c gnome.generate_gir: Pass *FLAGS set in the environment to g-ir-scanner
The reason for this change is the same as the previous commit. Although
g-ir-scanner can pick arguments from CFLAGS, CPPFLAGS, LDFLAGS
environment variables by itself, it is still better for build systems
to put them on the command line instead of relying on users to setup
the same environment.

Since g-ir-scanner doesn't provide a way to set arbitrary linker flags
on the command line, arguments in LDFLAGS that are not started with -L
are not passed.
2018-01-07 01:56:00 +08:00
Ting-Wei Lan 08113da388 gnome.gtkdoc: Pass *FLAGS set in the environment to gtkdoc-scangobj
GLib-based libraries and applications require gettext library to compile
and link. On non-GNU systems such as FreeBSD, gettext is not included in
libc and it is required to pass '-L/usr/local/lib -lintl' to the linker
to satisfy the dependency on gettext. The pkg-config file provided by
GLib already has '-lintl', but users still have to remember to put
'-L/usr/local/lib' into LDFLAGS. If we don't pass LDFLAGS to
gtkdoc-scangobj, the linker will not be able to find '-lintl' when no
dependencies of the project provides '-L/usr/local/lib'.

Since all *FLAGS are commonly used in many build systems, this commit
adds support for not only LDFLAGS but also CFLAGS and CPPFLAGS.

Fixes #1724
2018-01-07 01:45:47 +08:00
Iñigo Martínez f022cb3a40 gnome.gtkdoc: Add dependencies over generated targets
The gtkdoc function can also use generated targets to create
documentation. However, the dependencies over these generated files
are missing, so these must be also included in the run target.
2017-12-22 20:58:13 +01:00
Iñigo Martínez f92d117bec gnome.gtkdoc: Add support for non string based content files
gnome's gtkdoc function does not support content files which are
not strings. However, there are situations where files generated
by other targets might be needed.
2017-12-19 17:45:58 +01:00
Michael James Gratton 93c988b453 Enable re-compilation of GNOME gschema files if they have changed.
* mesonbuild/modules/gnome.py (GnomeModule.compile_schemas): Allow the
  depend_files kwarg.

* docs/markdown/Gnome-module.md: Add docs for new kwarg (and the only
  other one that is permitted).
2017-12-13 21:31:32 +02:00
Jussi Pakkanen 018deb48fe
Merge pull request #2663 from inigomartinez/pkg-config-define-variable
dependencies: Allow pkg-config to define variables
2017-12-03 22:53:44 +02:00
Iñigo Martínez 44dd429ee5 dependencies: Fix pkg-config variable definition
In a previous commit variable definition was added in pkg-config.
However, this commit was not complete.

This fixes the missing parts of that commit.
2017-12-01 13:49:01 +01:00
Nirbheek Chauhan e1bdc098ca gnome.compile_resources: Prefer generated files over source files
We should always prefer generated files over onces in the source tree
else if the same file also exists in the source tree we get strange
behaviour where we ignore dependencies and the project has to be
built twice to be fully up-to-date.

See: https://bugzilla.gnome.org/show_bug.cgi?id=787677

Closes https://github.com/mesonbuild/meson/issues/2686
2017-11-30 23:15:19 +02:00
Patrick Griffis 643d3a4976 gnome.gtkdoc: Fix missing permitted kwargs
Found by https://bugzilla.gnome.org/show_bug.cgi?id=790998
2017-11-29 12:36:11 -05:00
Xavier Claessens 9e2d078948 gnome: Add include_directories parameter to gtkdoc() 2017-11-10 18:23:47 +02:00
Martin Kelly 02bea7d5bf namespace run_targets by subproject
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.
2017-10-31 01:04:38 +02:00
Patrick Griffis f220a5dd86 gnome: Fix compile_schemas() using path sep in target name 2017-10-25 21:01:16 +03:00
Corentin Noël fd860482e5 Allow to give source files to GtkDoc by respecting the File class 2017-10-18 00:39:39 +03:00
Rico Tzschichholz 8b8e1ee620 gnome: g-ir-scanner accepts multiple symbol-prefix arguments 2017-10-08 14:04:34 +03:00
Jussi Pakkanen 357b34f915 Merge pull request #2375 from centricular/gnome-gir-fixes
Fix GNOME gir generation with lists of dependency lists
2017-10-02 00:04:18 +03:00
Patrick Griffis 893d101fff gnome: Add header kwarg to generate_gir()
This is a commonly used flag so lets make it more obvious.
2017-10-01 20:15:21 +03:00
Nirbheek Chauhan bb0e18b738 Use listify and extract_as_list everywhere
They now flatten by default and unhold objects if required

Includes unit tests.
2017-10-01 22:27:48 +05:30
Nirbheek Chauhan 26dada3797 gnome: Flatten and unholder all dependencies
Otherwise lists-of-lists get ignored instead
2017-10-01 12:07:04 +05:30
Dylan Baker dda5e8cadb Allow CustomTarget's to be indexed
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
2017-09-27 22:01:24 +03:00
Luke Shumaker 4dbbb4884c flake8: Clean up complained-about unused imports
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 ".".
2017-09-21 13:41:03 -04:00
Luke Shumaker bb25260f00 flake8: Perform suggested whitespace/formatting changes
This only touches newlines, spaces, and (occaisionally) commas.  Anything
else is left for another commit.
2017-09-21 11:59:03 -04:00
Alexis Jeandet e553d0807b Last round with listify function refactoring.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:25:34 +02:00
Alexis Jeandet bf64cf569b Gnome, pkgconfig, Qt4, Qt5 and windows modules slightly refactored.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Jussi Pakkanen 19e22ac88a Merge pull request #2216 from ebassi/yelp-linguas
Support LINGUAS for gnome.yelp() languages
2017-09-14 21:35:50 +03:00
Emmanuele Bassi 6f1d7e3d0a Add deprecation warning for gnome.yelp() argument
The 'languages' argument is deprecated; the LINGUAS file supercedes it
as the canonical source of translations.
2017-09-12 21:45:04 +01:00
Iñigo Martínez 540c928e30 gnome: Docbook generation for gdbus_codegen()
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.
2017-09-12 20:29:24 +03:00
Emmanuele Bassi 2cabcb39c9 gnome: Flatten the sources for generate_gir()
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.
2017-09-04 23:26:53 +03:00
Patrick Griffis 04b2c67b7d gnome.gdbus_codegen(): Add annotations keyword
Fixes #2123
2017-09-04 19:26:04 +03:00
Elliott Sales de Andrade 7fb1973cac Use include-uninstalled for internal gir deps.
This stops g-ir-scanner from trying to search for the pkg-config file
for an internal gir, which won't be available.
2017-08-31 22:15:15 +03:00
Chun-wei Fan aeaefce81e modules/gnome.py: Use a filelist for generate_gir()
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.
2017-08-31 21:39:47 +03:00
Matthias Klumpp 5275548b5c gnome: Ensure gir always works with asan, even if used together with ubsan
This really resolves #1910 by making it also work in cases where asan
and ubsan are used together via "-Db_sanitize=address,undefined".
2017-08-29 18:38:51 +03:00
Matthias Klumpp d49eeb243f gnome: Fix typo in gtkdoc_html_dir, so it returns the correct path 2017-08-29 18:38:07 +03:00
Thibault Saunier f2a60b87cb gnome: Fix g-ir-scanner linking args for all code paths
We were fixing them up only in the dependency code path and not
in the InternalDependency one. Just make sure to do it once for all.
2017-08-23 15:00:19 -03:00
Jussi Pakkanen 50fb7d37ab Make all functionality invokable via the main Meson binary,
which can be a Windows .exe file.
2017-08-18 12:08:20 +03:00
Marinus Schraal c8e61f112d gnome: use VAPIGEN from the environment if set
Allow setting the vapigen binary by passing it as an environment
variable.
2017-08-14 20:28:53 +03:00
Tim-Philipp Müller 4e476c82f3 gnome: add mkenums_simple()
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
2017-08-14 19:40:36 +03:00
Nirbheek Chauhan 556966003e gnome: Allow passing build_by_default: to some functions
Closes https://github.com/mesonbuild/meson/issues/2174
2017-08-13 21:17:47 +03:00
Tim-Philipp Müller 60b83a5f0a gnome: add 'ignore_headers' to permitted kwarg list for gnome.gtkdoc() 2017-08-13 21:17:04 +03:00
Nirbheek Chauhan 7aed29e2c3 gnome: Fix parsing of resource custom target files
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.
2017-08-13 21:13:28 +03:00
Florian Müllner 691ad706ad gnome: Only translate -l flags to --extra-library
Other linker arguments may contain '-l' as well, for instance
'-L/usr/lib/x86_64-linux-gnu/foo' with Debian-style multiarch.
2017-08-13 21:12:43 +03:00
Jussi Pakkanen d335a84b9e A few more lgtm fixes. 2017-08-04 12:54:31 +03:00
Florian Müllner 00a3d1ac4f gnome: Fix translation of -l to --extra-library args
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'
2017-08-02 21:45:50 +03:00
Emmanuele Bassi de45352d9d gnome: Support new glib-genmarshal arguments
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.
2017-07-23 16:30:34 +01:00
Nicolas Dufresne 12be4b6644 gnome: Fix wrong include path
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.
2017-07-21 20:16:50 +03:00
Patrick Griffis 9683082c4c gnome.genmarshal(): Include generated header in generated source
This silences any strict-prototype warnings if enabled.
2017-07-20 12:27:38 +03:00
Nirbheek Chauhan a0bd896b2f gnome module: Add -lfoo after -Lbar LDFLAGS
Otherwise they won't take effect
2017-07-17 12:41:54 +05:30
Jussi Pakkanen 9c02e57f88 Qapla' 2017-07-02 16:55:12 +03:00
Jussi Pakkanen ecde592b86 Fix custom target sources 2017-07-01 01:13:45 +03:00
Elliott Sales de Andrade 241790f72d Fix typo in generate_gir keyword name. 2017-06-30 11:16:49 -04:00
Jussi Pakkanen 3262be23dc Fixed issues raised in review. 2017-06-26 23:29:42 +03:00
Jussi Pakkanen 80d665e8de Converted some modules. 2017-06-26 21:10:27 +03:00
Jussi Pakkanen 080307dd71 Merge pull request #1948 from mesonbuild/tingping/gnome-sanitize-fixes
Fix gnome.generate_gir() with address sanitizer
2017-06-22 06:19:29 -04:00
Jussi Pakkanen a48a9217e4 Merge pull request #1966 from QuLogic/gtkdoc-libraries
Small gtkdoc improvements
2017-06-22 06:00:04 -04:00
Jussi Pakkanen 2d659b649b Merge pull request #1924 from mesonbuild/tingping/yelp-fixes
Various yelp fixes
2017-06-21 04:36:30 -04:00
Elliott Sales de Andrade 70776cda98 Add build include directory to gtkdoc source paths.
This enables gtkdoc to produce documentation on files that were
generated, using configure_file, for example.
2017-06-19 20:52:12 -04:00
Elliott Sales de Andrade ca798e1538 Add all internal dep rpaths to gnome module builds.
Running gtkdoc on a shared library that depends on another shared
library would fail otherwise.
2017-06-19 19:07:09 -04:00
Elliott Sales de Andrade 6bc14424b4 Use absolute path to target dir within gnome module.
Stuff like gtkdoc may not be run in the top-level build directory, so
these paths need to be absolute.

Fixes #1950.
2017-06-19 19:05:42 -04:00
Patrick Griffis ccb253189a gnome.generate_gir(): Fix linking to libasan if sanitizer enabled
This is a bit of a workaround linking directly to it but it is
at least functional unlike before.

Fixes #1910
2017-06-17 07:08:31 -04:00
Patrick Griffis 604adce33f gnome: Fix getting sanitize cflags for gir
There was an API break somewhere and this wasn't kept in sync.

Part of #1910
2017-06-15 22:40:00 -04:00
Florian Müllner a3dda095bc gnome: Guard all cflags passed to g-ir-scanner
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.
2017-06-11 21:48:15 +02:00
Florian Müllner 4b8dc3b746 gnome: Fix includedir cflags
Include directories are passed with the -I flag to both the compiler
and g-ir-scanner, not as input files.
2017-06-11 21:40:14 +02:00
Jussi Pakkanen f792641b34 Merge pull request #1927 from centricular/gir-rpath-link
Work around GNU ld bug with -rpath,$ORIGIN
2017-06-11 14:54:10 +03:00
Nirbheek Chauhan 1e42241ef3 gnome: Don't assume that a C compiler is being used 2017-06-11 14:36:33 +05:30
Nirbheek Chauhan d38f3deaed gnome: Work around GNU ld bug with -rpath,$ORIGIN
g-ir-scanner doesn't understand -rpath, so we use -L instead which
has the same effect.

Closes https://github.com/mesonbuild/meson/issues/1911
2017-06-11 14:32:39 +05:30
Patrick Griffis a88ad9173a gnome.yelp(): Default symlink_media to true 2017-06-10 12:42:28 -04:00
Nirbheek Chauhan 0c83f8352d dependencies: Add a new class ExternalDependency
This class now consolidates a lot of the logic that each external
dependency was duplicating in its class definition.

All external dependencies now set:

* self.version
* self.compile_args and self.link_args
* self.is_found (if found)
* self.sources
* etc

And the abstract ExternalDependency class defines the methods that
will fetch those properties. Some classes still override that for
various reasons, but those should also be migrated to properties as
far as possible.

Next step is to consolidate and standardize the way in which we call
'configuration binaries' such as sdl2-config, llvm-config, pkg-config,
etc. Currently each class has to duplicate code involved with that
even though the format is very similar.

Currently only pkg-config supports multiple version requirements, and
some classes don't even properly check the version requirement. That
will also become easier now.
2017-06-09 20:21:01 +05:30
Emmanuele Bassi f3aa309fa1 Add mkdb_args support to gnome.gtkdoc()
There are cases where we need to specify arguments to gtkdoc-mkdb, like
telling it to scan extensions that are not '.h' and '.c'. Let's add a
new named argument to gnome.gtkdoc(), as well as the plumbing needed for
the gtk-doc helper script.
2017-05-28 23:58:54 +01:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Dylan Baker a8173630ea Don't use len() to test emptiness vs not emptiness
Meson has a common pattern of using 'if len(foo) == 0:' or
'if len(foo) != 0:', however, this is a common anti-pattern in python.
Instead tests for emptiness/non-emptiness should be done with a simple
'if foo:' or 'if not foo:'

Consider the following:
>>> import timeit
>>> timeit.timeit('if len([]) == 0: pass')
0.10730923599840025
>>> timeit.timeit('if not []: pass')
0.030033907998586074
>>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass')
0.1154778649979562
>>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass")
0.08259823200205574
>>> timeit.timeit('if len("") == 0: pass')
0.089759664999292
>>> timeit.timeit('if not "": pass')
0.02340641999762738
>>> timeit.timeit('if len("foo") == 0: pass')
0.08848102600313723
>>> timeit.timeit('if not "foo": pass')
0.04032287199879647

And for the one additional case of 'if len(foo.strip()) == 0', which can
be replaced with 'if not foo.isspace()'
>>> timeit.timeit('if len("   ".strip()) == 0: pass')
0.15294511600222904
>>> timeit.timeit('if "   ".isspace(): pass')
0.09413968399894657
>>> timeit.timeit('if len("   abc".strip()) == 0: pass')
0.2023209120015963
>>> timeit.timeit('if "   abc".isspace(): pass')
0.09571301700270851

In other words, it's always a win to not use len(), when you don't
actually want to check the length.
2017-05-02 21:57:26 +03:00
Jussi Pakkanen 1c8e9fc7ae Stricter evaluation of deps. Closes #1648. 2017-04-21 13:01:36 +03:00
Jussi Pakkanen b951e60f06 Merge pull request #1548 from ssssam/sam/stable-ordering
Stable ordering of some commandlines generated by 'gnome' module
2017-04-13 23:59:48 +03:00
Jussi Pakkanen 1652dccea2 Merge pull request #1469 from centricular/install-secondary-outputs
Support multiple install dirs for built/custom targets
2017-04-09 21:57:46 +03:00
Richard Hughes 0e8eba7f64 gnome: Allow modules to optionally generate ObjectManager boilerplate
Fixes: https://github.com/mesonbuild/meson/issues/1539
2017-04-09 18:56:26 +03:00
Nirbheek Chauhan 57cb1f9aad Support multiple install dirs for built/custom targets
You can now pass a list of strings to the install_dir: kwarg to
build_target and custom_target.

Custom Targets:
===============
Allows you to specify the installation directory for each
corresponding output. For example:

    custom_target('different-install-dirs',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : ['somedir', 'otherdir])

This would install first.file to somedir and second.file to otherdir.

If only one install_dir is provided, all outputs are installed there
(same behaviour as before).

To only install some outputs, pass `false` for the outputs that you
don't want installed. For example:

    custom_target('only-install-second',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : [false, 'otherdir])

This would install second.file to otherdir and not install first.file.

Build Targets:
==============
With build_target() (which includes executable(), library(), etc),
usually there is only one primary output. However some types of
targets have multiple outputs.

For example, while generating Vala libraries, valac also generates
a header and a .vapi file both of which often need to be installed.
This allows you to specify installation directories for those too.

    # This will only install the library (same as before)
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true)

    # This will install the library, the header, and the vapi into the
    # respective directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : ['libdir', 'incdir', 'vapidir'])

    # This will install the library into the default libdir and
    # everything else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [true, 'incdir', 'vapidir'])

    # This will NOT install the library, and will install everything
    # else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [false, 'incdir', 'vapidir'])

true/false can also be used for secondary outputs in the same way.

Valac can also generate a GIR file for libraries when the `vala_gir:`
keyword argument is passed to library(). In that case, `install_dir:`
must be given a list with four elements, one for each output.

Includes tests for all these.

Closes https://github.com/mesonbuild/meson/issues/705
Closes https://github.com/mesonbuild/meson/issues/891
Closes https://github.com/mesonbuild/meson/issues/892
Closes https://github.com/mesonbuild/meson/issues/1178
Closes https://github.com/mesonbuild/meson/issues/1193
2017-04-04 14:59:13 +05:30
Sam Thursfield c408bd6a8e gnome: Preserve ordering of flags passed to tools
This avoids unnecessary rebuilds occuring when Meson regenerates the
build.ninja file. Previously, if the ordering of the commandline
arguments changed then Ninja would consider the outputs dirty and
rebuild them.
2017-04-03 17:02:45 +01:00
Nirbheek Chauhan 976c9abcd0 modules: Start using @SOURCE_ROOT@ and @BUILD_ROOT@
First step in fixing https://github.com/mesonbuild/meson/issues/1419

Also works around an issue in the MinGW windres.exe that causes it to
fail if any of the arguments passed to it contain a space. There seems
to be no way to quote or escape the spaces in the path to make windres
parse the path correctly, so we just warn about it instead.

https://sourceware.org/bugzilla/show_bug.cgi?id=4933
https://github.com/mesonbuild/meson/pull/1346
2017-03-28 14:49:32 +05:30
Patrick Griffis dd828e3fd7 gnome.gdbus_codegen: Use --output-directory when available
Fixes #1387
2017-03-21 17:13:42 -04:00
Tim-Philipp Müller 80f870c4bb gnome: fix genmarshal .c file generation
The .c file shouldn't contain the header bits as well.
2017-03-20 19:19:12 -04:00
Patrick Griffis a795ea3cd4 gnome.genmarshal: Use --output when available
This is just cleaner and works around #1417
2017-03-03 14:11:44 -05:00
Nirbheek Chauhan 438f219864 gnome: Pass ExternalProgram objects to CustomTarget
There is no need to do obj.get_command() and in fact it's wrong
because the VS backends need to resolve each object to absolute paths
and get_command() does not do that.

This should fix invocation of GNOME module helpers with the VS backends

For the record, absolute paths for programs are needed because the
same PATH environment won't necessarily be available to Visual Studio
when it builds the generated solution.

Related to https://github.com/mesonbuild/meson/issues/1419
2017-02-26 07:42:47 -05:00
Elliott Sales de Andrade 7c5de87656 Raise if gobject-introspection is not found.
This used to produce a warning, but then would crash anyway. It's
simpler if we just error out and have the user disable gir generation or
install gobject-introspection.
2017-02-26 07:28:54 -05:00
Jussi Pakkanen 98af711ca6 Merge pull request #1403 from centricular/compile_resources
Make configure_file() great again
2017-02-20 14:27:06 -05:00
Nirbheek Chauhan dabf0c1882 gnome: Support configure_file() output in compile_resources
We can't support generated XML files with custom_target() because the
dependency scanning happens at configure time, but we *can* support
generating them with configure_file().

Closes https://github.com/mesonbuild/meson/issues/1380
2017-02-20 23:32:04 +05:30
Nirbheek Chauhan 1f0319c288 gnome: Document why we need absolute paths for mkenums
I forgot why this was needed and had to dig through the git logs.
Link to the GitHub issue for future reference.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan a6c71c62c8 gnome: Print an error message when generated files are passed to compile_resources 2017-02-20 23:32:03 +05:30
Nirbheek Chauhan af85d0e65e gnome: Fix minimum gresource dependency required
This is the latest release of glib that exists and has the required
dependency-generation fixes.

Without this GNOME Recipes cannot even configure.
2017-02-19 03:59:26 +05:30
Nirbheek Chauhan 577a3591c9 gnome: Only check gresource version with CustomTargets
We don't need dependencies to work correctly to use the output of
configure_file in the dependencies: kwarg.

This allows GNOME Recipes to built without the latest glib git.
2017-02-19 03:59:26 +05:30
Thibault Saunier 00251f16b6 gnome: Do not use gir specific `--extra-lib` to generate gtkdoc args
Fixes 1372
2017-02-09 23:02:21 +02:00
Mike Sinkovsky 77515ee541 style: [E303] too many blank lines (2) 2017-01-11 12:33:27 -05:00
Jussi Pakkanen fbabe8ad85 There are two different kinds of extensions: modules that create new
objects directly and snippets that just call into interpreter methods.
2017-01-09 21:11:48 +02:00
Jussi Pakkanen 340781c515 Fix Gnome module. 2017-01-09 20:04:52 +02:00
Igor Gnatenko ef3cc6b3fa style: fix E127 violations
E127: continuation line over-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-02 19:16:56 +01:00
Igor Gnatenko 969dc7e995 style: fix E124 violations
E124: closing bracket does not match visual indentation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 2017d8578a style: fix E226 violations
E226: missing whitespace around arithmetic operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko f0b30baa39 style: fix E225 violations
E225: missing whitespace around operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Jussi Pakkanen b55235dfbd Fix space before :. 2016-12-31 16:28:15 +02:00
Elliott Sales de Andrade 24b3585318 Move _get_include_args from gnome to modules. 2016-12-28 17:18:14 -05:00
Jussi Pakkanen a2528a8816 Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Nirbheek Chauhan 589a56e78f Cache the scripts used for postconf and install phases
Cache the absolute dir that the script is searched in and the name of
the script. These are the only two things that change.

Update the test to test for both #1235 and the case when a script of the
same name is in a different directory (which also covers the subproject
case).

Closes #1235
2016-12-20 00:09:02 +02:00
Nirbheek Chauhan 9bc07a0941 Fix several more lint errors
Found by Igor Gnatenko

************* Module mesonbuild.interpreter
E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter)
************* Module mesonbuild.dependencies
E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden)
************* Module mesonbuild.environment
E: 26, 0: class already defined line 19 (function-redefined)
E: 68,18: Undefined variable 'InterpreterException' (undefined-variable)
E:641,39: Undefined variable 'want_cross' (undefined-variable)
E:850,94: Undefined variable 'varname' (undefined-variable)
E:854,94: Undefined variable 'varname' (undefined-variable)
E:860,102: Undefined variable 'varname' (undefined-variable)
E:863,94: Undefined variable 'varname' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:438,26: Undefined variable 'compilers' (undefined-variable)
2016-12-20 00:07:00 +02:00
Igor Gnatenko 139e020ede tree-wide: use proper 'not in' notation
Let's be more pythonic and 'not is' seems really weird.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 21:48:35 +01:00
Igor Gnatenko d5ccd20aac fix some of pylint's undefined-variable
************* Module mesonbuild.modules.rpm
E:106,29: Unsupported format character '{' (0x7b) at index 16 (bad-format-character)
************* Module mesonbuild.modules
E: 12,14: Undefined variable 'MesonException' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:699,69: Undefined variable 'sargs' (undefined-variable)
************* Module mesonbuild.wrap.wrap
E:103,25: Undefined variable 'checkoutdir' (undefined-variable)
************* Module mesonbuild.backend.backends
E: 83,16: Undefined variable 'mlog' (undefined-variable)
************* Module mesonbuild.backend.ninjabackend
E:254,105: Undefined variable 't' (undefined-variable)

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 17:09:35 +02:00
Nirbheek Chauhan c693bd9bb4 Allow passing arguments to install scripts
Closes #1213
2016-12-18 18:30:47 +02:00
Nirbheek Chauhan 59b8f11e7e gnome: Re-use gobject-introspection-1.0 pkg-config dependency
Also don't use `dependencies` as a module name since it is commonly used
as a variable name too. Instead, directly import the classes that we use
from that module.
2016-12-17 17:53:52 +02:00
Nirbheek Chauhan 5e5b3f00d8 modules: Cache programs found by find_program
This avoids printing several 'Found:' messages during configure, and
also avoids doing several searches for the same binary. This is already
done by the interpreter for `find_program` calls from build files.

Also move it to the module-wide __init__.py file so it can be used by
other modules as-needed.

Also use it for g-ir-scanner where it was missed in one place, also fix
exception name in the same place.
2016-12-16 00:04:38 +05:30
Nirbheek Chauhan d5f7ba862b gnome.mkenums: Use absolute paths for all commandline args
Closes #973

test cases/vala/8 generated sources/ tests this.
2016-12-15 14:58:43 +05:30
Nirbheek Chauhan e6f48a03fc Allow all code to access module target classes
It is often useful to be able to check if a specific object is of a type
defined in a module. To that end, define all such targets in
modules/__init__.py so that everyone can refer to them without poking
into module-specific code.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan 79f6626867 Pass --gresources to valac for each compiled gresource
Without this, the user has to both compile the resource with
gnome.compile_resources, pass that to the target sources, and also
pass --gresources=/path/to/gres.xml to vala_args in the target.

With this, we will do that automatically.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan 7b3d00fee4 Use dict for self.build.compilers instead of list
Everywhere we use this object, we end up iterating over it and comparing
compiler.get_language() with something. Using a dict is the obvious
choice and simplifies a lot of code.
2016-12-13 09:20:34 +05:30
Patrick Griffis c42167dc6f gnome.gtkdoc(): Include builddir variant of include dirs also
This avoids the need for users to constantly join paths themselves
as this is commonly included.
2016-12-12 21:01:49 +02:00
Nirbheek Chauhan 60716fcd6d Use universal_newlines=True for all Popen calls
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.

This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.

Closes #1079
2016-12-11 01:59:58 +02:00
Patrick Griffis c75b5886da gnome.gtkdoc(): Include -rpath for gtkdoc-scangobj
Without libtool it is our job to ensure local libraries are picked up.
2016-12-10 01:05:26 +02:00
Jussi Pakkanen d1501e39d5 Merge pull request #1086 from Keruspe/master
Allow specifying some toolchain executables using env
2016-12-06 23:43:36 +02:00
Patrick Griffis e265887ac3 gnome.gtkdoc(): Add keyword to override the mode
I'm not entirely sure if you ever want to mix and match but
I can say that glib required none of them to be passed so
this allows for that.
2016-12-06 14:07:45 -05:00
Patrick Griffis d764c7dc91 gnome.gtkdoc(): Add namespace keyword 2016-12-06 13:23:58 -05:00
Patrick Griffis a626d1a7bc gnome.gtkdoc(): Allow passing multiple source dirs
This is valid and used by glib for example.
2016-12-06 12:23:29 -05:00
Marc-Antoine Perennou bb3b45a0ec gnome: use PkgConfigDependency to find gobject-introspection cflags
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-12-05 10:57:10 +01:00
Thibault Saunier 9c0997dafd gnome: Use g-ir-scanner --extra-library option when avalaible
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
2016-12-03 23:07:00 +02:00
Jussi Pakkanen 8e8f75005d Merge pull request #1076 from mesonbuild/tingping/gresource-export
gnome.compile_resources(): Add export and install_header kwargs
2016-12-03 22:59:27 +02:00
Thibault Saunier e933bdd872 gnome: Properly search for programs
Otherwise it might just fail on windows and this way
we report a proper error message when not found.
2016-12-02 23:01:19 +02:00
Patrick Griffis 9a6db2eb2f gnome.compile_resources(): Add export and install_header kwargs
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.
2016-11-20 17:39:57 -05:00
Patrick Griffis 8dd32506f4 gnome.compile_resources(): Add ability to output gresource bundles
Closes #1061
2016-11-20 23:36:21 +01:00
Patrick Griffis 587a0bb3d1 gnome: Update required version for glib-compile-resources depfile fixes
Note that this version is not yet released
2016-11-20 23:01:26 +01:00
Jussi Pakkanen a01919976e Always specify installed data with a File object. Closes #858. 2016-11-18 17:37:35 -05:00
Elliott Sales de Andrade 996f4d89f3 Disallow some keyword arguments to gnome.mkenums.
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.
2016-11-18 15:30:56 -05:00
Jussi Pakkanen 8b05990c13 Disable gresource dependency generation as it breaks Ninja. 2016-11-14 11:43:24 -05:00
Jussi Pakkanen 59a414283c Merge pull request #1022 from centricular/fix-girtarget-deps-includes
gnome.generate_gir: Add gir deps and includes recursively
2016-11-12 18:01:28 -05:00
Jussi Pakkanen e1ecb95d1d Merged generate_gir fix. 2016-11-13 00:43:06 +02:00
Thibault Saunier 85a0cd7635 Add new add_project_[link]_args functions
Fixes 979
2016-11-12 17:34:06 -05:00
Nirbheek Chauhan 69dcbb6ec9 gnome.generate_gir: Add gir deps and includes recursively
Earlier, we were never adding dependencies on other GirTargets that we
need. The dependency would only be added indirectly through other
BuildTargets such as SharedLibrary. Now we add all GirTargets specified
in the `dependencies :` kwarg to the list of dependencies of the
GirTarget that we generate.

Also, we weren't adding include directories for the typelib generation
command recursively. We were only adding it for the GirTargets listed
under the `dependencies :` kwarg to gnome.generate_gir. Now we search
all link targets, find GirTargets, extract the include dir, and use it.

In summation, dependencies were completely broken.
2016-11-13 03:57:58 +05:30
Patrick Griffis c7226462a2 gnome: Improve dependency handling of compile_resources()
- Use depfile support on recent glib-compile-resources
- Don't pass dep files to header ever
- Pass depends for generated deps
- Avoid duplicate --sourcedir args
- Include correct subdir of generated deps
2016-11-09 17:40:42 +01:00
Nirbheek Chauhan a2262103fb Implement mlog.warning and use it everywhere for warnings
Prepends the string with 'WARNING:' in ANSI yellow.

Closes https://github.com/mesonbuild/meson/issues/961
2016-11-08 17:43:24 -05:00
Patrick Griffis fb7d9c7aef gnome: Mark helper functions as private 2016-11-06 00:02:53 -04:00
Matthew Waters b6971f2007 gnome: make generate_gir use the correct shared library
If building in a prefix with a version of the library that's already
installed with other dependencies already installed in that prefix,
then the installed library was being picked up to link with
for gir generation instead of the newly built library.
2016-11-04 01:35:29 +11:00
Jussi Pakkanen f1c909c41a Merge pull request #980 from ebassi/gtkdoc-fixes
Improvements for gnome.gtkdoc
2016-11-02 13:49:05 -07:00
Jussi Pakkanen 36a0d162cb Merge pull request #895 from mesonbuild/wip/tingping/gnome-vapi
gnome: Add generate_vapi function
2016-11-02 11:41:58 -07:00
Emmanuele Bassi e226d702bc gtkdoc: Add `ignore_headers` positional argument
Not all headers are public, or contain public types. GTK-Doc allows
adding headers to be ignored during the "scan" phase, by passing the
`--ignore-headers` command line argument to gtkdoc-scan.

Currently, you can do something like:

  ignored_headers = [ 'foo-private.h', 'bar-private.h', ]

  gnome.gtkdoc(...
               scan_args: [
                 '--ignore-headers=' + ' '.join(ignored_headers),
               ],
               ...)

But it does not guarantee escaping rules and it's definitely not nice.

We can add a simpler version of that mechanism through a new positional
argument, `ignore_headers`, which behaves like `content_files` or
`html_assets`, and takes an array of header files to ignore:

  gnome.gtkdoc(...
               ignore_headers: ignored_headers,
               ...)
2016-11-01 14:11:48 +00:00
Jussi Pakkanen 3c48bd2d88 Revert d9473095f2 because it broke GStreamer. 2016-10-24 12:16:28 -07:00
Patrick Griffis d9473095f2 gnome: Don't pass ldflags to g-ir-scanner
In this context -l refers to shared libraries that the gir
provides so you end up with a dozen unecessary libs in your
gir file.
2016-10-23 08:53:27 -07:00
Jussi Pakkanen b50f3e6976 Merge pull request #934 from mesonbuild/wip/tingping/gnome-yelp
gnome: Add yelp() function
2016-10-23 04:39:15 -07:00
Patrick Griffis ed3cc537cb gnome: Fix building gobject-introspection with sanitizer
Fixes #922
2016-10-22 15:04:16 -07:00
Patrick Griffis bae7d7b3d7 gnome: Add generate_vapi() function
This allows C projects to generate vapi bindings from
gir files and returns a dependency that can be used by
Vala.
2016-10-21 02:23:54 -04:00
Patrick Griffis 1781129740 gnome: Add yelp() function
Fixes #881
Mentioned in #295
2016-10-19 18:44:19 -04:00
Jussi Pakkanen e908910187 Can query pkg-config variables from the system. Closes #726. 2016-10-19 22:36:34 +03:00
Patrick Griffis 22debf6ffc gnome: Fix gresource warning incorrectly being shown on 2.50+ 2016-10-19 21:15:05 +03:00
Jussi Pakkanen a417efdf24 Merge pull request #793 from ssssam/sam/gresource-dependencies
gnome: allow use of generated files with compile_resources()
2016-10-16 17:47:39 +03:00
Patrick Griffis d7fdeb4d15 gnome: Avoid unhandled exception 2016-10-16 17:38:54 +03:00
Sam Thursfield 25f13067c2 gnome: allow use of generated files with compile_resources()
This commit adds a 'dependencies' keyword to the
gnome.compile_resources() function, which allows your resource blob
to depend on files generated at build-time from custom_target() or
configure_file() targets.

My current use case for this is source data that gets processed with Gettext
translation tools before being compiled into the resource blob.

This feature only works with GLib version 2.48.2 and above. So the
compile_resources() function now detects GLib version and raises an
error if the version of GLib being used is too old.

The compile_resources() test case is now split into two, so that the
existing one can continue to run on systems with old GLib versions (such
as Ubuntu Xenial, which the automated tests on travisci.org use), but
where new enough GLib is available we also test generating gresource
content.

The existing warning about glib-compile-resources is now only printed
if GLib version is older than 2.50.0 because
<https://bugzilla.gnome.org/show_bug.cgi?id=745754> is fixed in the
2.50.0 release.
2016-10-13 21:18:14 +01:00
Patrick Griffis 94b7b59546 gnome.generate_gir(): Also include current build dir
Continuation of 084b854ce0
2016-10-08 12:34:30 +02:00
Jussi Pakkanen f73c0a1098 Merge pull request #843 from mesonbuild/tingping/gir-dir
gnome.generate_gir(): Fix install_dir and add install_dir_gir and install_dir_typelib
2016-10-03 21:27:54 +03:00
Jussi Pakkanen 7256e109bf Merge pull request #718 from QuLogic/glib-mkenums-genmarshal
glib-mkenums and glib-genmarshal support
2016-10-03 19:07:42 +03:00
Patrick Griffis dd9dfa77fb gnome.generate_gir(): Add install_dir_gir and install_dir_typelib
A generic `install_dir` is less useful and didn't work so just ignore it
2016-10-03 02:34:33 -04:00
Patrick Griffis 084b854ce0 gnome: Consistently include current source dir
This is a common pattern so avoid the duplication
2016-10-02 12:16:22 -04:00
Elliott Sales de Andrade 2840539a08 Don't overwrite mkenums C file dependencies. 2016-09-28 18:32:56 -04:00
Elliott Sales de Andrade 8f024c0697 Allow running mkenums without templates. 2016-09-28 18:32:46 -04:00
Jussi Pakkanen d61b71fdc2 Converted mkenums to be single invocation. 2016-09-28 18:21:42 -04:00
Elliott Sales de Andrade 1033728c85 Fix mkenums and genmarshal argument names.
Dashes aren't allowed in keyword argument names.
2016-09-28 18:20:18 -04:00
Elliott Sales de Andrade ceee8bc6b2 Generate genmarshal header and body simultaneously.
This follows the same style as gnome.compile_resources, which produces
both files from one invocation.
2016-09-28 18:20:18 -04:00
Elliott Sales de Andrade 2a8a0727fc Add support for glib-genmarshal to gnome module. 2016-09-28 18:20:18 -04:00
Elliott Sales de Andrade ab004ab189 Add support for glib-mkenums to gnome module. 2016-09-28 18:20:17 -04:00
Thibault Saunier bb3823e6f4 gnome: Allow specifying gtkdoc where to install directory 2016-09-26 15:25:59 -03:00
Thibault Saunier f86fbf6ebf gnome: Run gtkdoc-scanobjs and add a way to get assets working
Allowing the object tree to be generated.

We need to add options to allow copying the ncesseary sources and
assets so the HTML generator can work with them (everything is
relative so we need to copy them in the build directory).

Until now the documentation was not generated from the user provided
main sgml file but it was using a generated one, which lead to a broken
documentation. Starting using it revealed the other bugs fixed in that
commit.
2016-09-26 15:25:59 -03:00
Thibault Saunier 68ae8e1ad0 gnome: Factor out a get_dependencies_flags method
And recurse to make sure that we build against all internal
dependencies dependencies.
2016-09-26 15:25:59 -03:00
Thibault Saunier 52a4b3302e gnome: Make all include paths absolute
The relative computation was broken when using
subprojects.
2016-09-26 15:25:59 -03:00
Jussi Pakkanen 8ab62a27b4 Merge pull request #739 from QuLogic/gir-include-paths
Update GIR include paths
2016-09-26 20:56:02 +03:00