Commit Graph

214 Commits

Author SHA1 Message Date
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