Commit Graph

345 Commits

Author SHA1 Message Date
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
TingPing 5b34e560e5 gnome: Print useful error if missing compile_resource arg (#811) 2016-09-25 19:02:41 +03:00
Elliott Sales de Andrade 28e1f3ba13 Fix pkgconfig libraries passed to GIR targets. 2016-09-14 16:59:53 -04:00
Elliott Sales de Andrade 7a6534e054 GIR: Handle all dependencies and internal libraries. 2016-09-14 16:57:40 -04:00
Elliott Sales de Andrade 68a2e5c9c9 Also add GIR include_directories to header search path. 2016-09-14 16:57:40 -04:00
Elliott Sales de Andrade 9009f8267e Allow GirTargets as includes for another GirTarget. 2016-09-14 16:57:40 -04:00
Elliott Sales de Andrade 3ae327a2ac Pull dependency directly from GIR's target library. 2016-09-14 16:57:38 -04:00
Elliott Sales de Andrade d0b6f0b7a4 Add dependency's include paths to GIR generation. 2016-09-14 16:55:07 -04:00
Elliott Sales de Andrade f2ccad64fc Determine GIR include paths like targets.
These paths are now generated similar to
NinjaBackend.generate_single_compile where IncludeDirs create includes
of both the build directory path and the source directory path.

This also fixes a bug with include_directories, where the path string
supplied to the IncludeDirs initializer was used for the search path,
instead of the actual location to which it referred. Often, this was a
'.', and not a really useful path.
2016-09-14 16:55:07 -04:00
Thibault Saunier 6c6c706bb8 gnome: Handle internal dependencies to generate gir files 2016-08-29 10:11:27 -03:00
Jussi Pakkanen fae8ad90a4 Consistent kwarg popping. 2016-08-21 15:04:44 +03:00
Jussi Pakkanen 4b3414cba0 Add extra_args kwarg to glib-compile-resources. Closes #698. 2016-08-21 15:00:02 +03:00
Igor Gnatenko bde123d70c Merge pull request #629 from wtay/master
gnome.py: typelib files should be installed in libdir
2016-08-14 20:07:43 +02:00
Nirbheek Chauhan e6c927d8ac gnome: Update RunTarget usage to new syntax
This was broken in 0733c0f9a1
2016-07-21 13:39:42 +05:30
Wim Taymans 660c872422 gnome.py: typelib files should be installed in libdir
The typelib files should be installed in libdir, even on debian (which
has them in /usr/lib/x86_64-linux-gnu/girepository-1.0/).
2016-07-04 12:29:56 +02:00
Jussi Pakkanen d8e08224da Helper function to get the install dir of a gtkdoc module. Closes #551. 2016-05-25 22:55:02 +03:00
Emmanuele Bassi 8998e44cd9 Support passing extra arguments to gtkdoc-fixxref
The extra arguments are typically used to specified the location of
installed API references that gtk-doc can use to create cross links
for symbols.

Fixes #555
2016-05-25 11:36:33 +01:00
Tim-Philipp Müller 3b5dcdbd42 gnome: only print warning when gresource-related functionality is used (#510)
It's confusing to print this when using stuff that works just fine.
2016-04-07 20:23:46 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen 352b5badd2 Handle resources that come in files(). Closes #424. 2016-02-29 21:04:16 +02:00
Damián Nohales 8bcd25f5b4 Simplify target generation in GnomeModule.compile_resources 2016-02-09 19:41:26 -03:00
Damián Nohales b91662a903 Allow multiple source_dir in GResource
There are use case where one may want to specify --sourcedir option
multiple times to glib-compile-resources, which will look for
resources in every specified directory.

By doing this, we also need to get rid of the manual GResource XML
parsing and we opted to use the glib-compile-resources command with
the --generate-dependencies option. This command will solve the
multiple source_dir case for us.
2016-02-09 19:41:26 -03:00
Jussi Pakkanen 5586dcf5c0 Text clarification. 2016-01-31 00:19:50 +11:00
Jussi Pakkanen d6e176f455 Made gtkdoc and run targets work. 2016-01-16 18:04:59 +02:00
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00