Commit Graph

233 Commits

Author SHA1 Message Date
Jussi Pakkanen 8396c4f3e6 Added VS support to simd detector. 2017-07-17 19:15:04 +03:00
Jussi Pakkanen d304aac504 Created simd module. 2017-07-17 19:06:16 +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
Laurent Carlier 0283a2fb41 pkgconfig: avoid appending slash at Cflags
otherwise it can break some compilations, see https://bugs.archlinux.org/task/54763
2017-07-13 16:28:32 +02:00
Jussi Pakkanen 917e12e4e7 Merge pull request #2017 from mesonbuild/fix2012
Do not pickle interpreter objects by accident
2017-07-02 16:33:49 -04:00
Jehan 2f691410fc Improve "Passed invalid keyword argument" warning.
I got this warning on a build:
> WARNING: Passed invalid keyword argument preset. This will become a hard error in the future.
I had to grep in meson code to understand that "preset" was the name of
the invalid argument. This is not obvious at all depending on the
argument name (here it looked like it was about argument presets).
Let's make it clearer by putting it in quotes.
2017-07-02 10:08:08 -04:00
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
Bruce Richardson f12ece4547 pkgconfig: add support for extra_cflags
Allow the user to pass in arbitrary cflags for putting into the generated
pkgconfig file.
2017-06-29 11:03:20 -04:00
Jussi Pakkanen 3262be23dc Fixed issues raised in review. 2017-06-26 23:29:42 +03:00
Jussi Pakkanen 4a37baf3c5 Fixed the remaining modules. 2017-06-26 21:10:27 +03:00
Jussi Pakkanen 80d665e8de Converted some modules. 2017-06-26 21:10:27 +03:00
Jussi Pakkanen 7f482824bb Add kwarg checker in module code. 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
Peter Hutterer 7ed19902be pkgconfig: add suppport for custom variables during generation
Usage:
    pkgconfig.generate(
      ...
      description : 'A library with custom variables.',
      variables : ['foo=bar', 'datadir=${prefix}/data']
      )

The variables 'prefix', 'libdir' and 'includedir' are reserved, meson will
fail with an error message.

Variables can reference each other with the pkgconfig notation, e.g.

   variables : ['datadir=${prefix}/data',
                'otherdatadir=${datadir}/other']

meson does not check this for correctness or that the referenced variable
exists, we merely keep the same order as specified.
2017-05-11 00:13:30 +03:00
Jussi Pakkanen 0e3aa5a348 Merge pull request #1587 from mesonbuild/tingping/msgfmt-datadir
i18n: Improve data_dirs support
2017-05-03 18:51:55 +03: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
Patrick Griffis 12504b2385 i18n: Fix handling relative data_dirs 2017-04-29 04:05:20 -04:00
Patrick Griffis 82492f5d76 i18n: Add data_dirs kwarg to merge_file()
For parity with gettext()

Fixes #1565
2017-04-29 04:05:20 -04: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 42d1661bd9 Merge pull request #1588 from absmall/method
Add an option to dependencies called 'method'.
2017-04-11 16:41:56 +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
Aaron Small 76c8491d77 Add an option to dependencies called 'method'. This can be used to
configure a detection method, for those types of dependencies that have
more than one means of detection.

The default detection methods are unchanged if 'method' is not
specified, and all dependencies support the method 'auto', which is the
same as not specifying a method.

The dependencies which do support multiple detection methods
additionally support other values, depending on the dependency.
2017-04-09 03:31:39 -04:00
Dylan Baker af820b77d8 Allow specifying windres binary in cross files
When cross compiling with mingw it's problematic to assume that there is
a binary called windres, and having to set it via an environment
variable seems wrong when there is a handy cross-file for just such a
situation.

This patch allows setting windres in the [binaries] section of the cross
file. If the build is a cross build, then the windows module will check
for windres being set in the cross file before checking the WINDRES
environment variable or looking for a windres binary.
2017-04-08 21:08:06 +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
Patrick Griffis a9c30ce8b5 python3: Add sysconfig_path() method
This returns the value of sysconfig paths, useful for
installing modules for example.
2017-03-30 09:13:01 -04:00
Patrick Griffis b6e06dd80b python3: Add language_version() method 2017-03-30 09:13:01 -04: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