aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/gnome.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-25 04:20:46 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-09-28 18:20:18 -0400
commit2a8a0727fcf84fa0bb8d4b4eb095594976b30ef9 (patch)
tree2912ab3522b5882b682fabed7d0ba699fd42dc42 /mesonbuild/modules/gnome.py
parentab004ab1895b562af6dd16d396327b2ae2b52dd0 (diff)
downloadmeson-2a8a0727fcf84fa0bb8d4b4eb095594976b30ef9.zip
meson-2a8a0727fcf84fa0bb8d4b4eb095594976b30ef9.tar.gz
meson-2a8a0727fcf84fa0bb8d4b4eb095594976b30ef9.tar.bz2
Add support for glib-genmarshal to gnome module.
Diffstat (limited to 'mesonbuild/modules/gnome.py')
-rw-r--r--mesonbuild/modules/gnome.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6a190b7..5f0f737 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -519,6 +519,48 @@ class GnomeModule:
custom_kwargs[arg] = kwargs[arg]
return build.CustomTarget(output, state.subdir, custom_kwargs)
+ def genmarshal(self, state, args, kwargs):
+ if len(args) != 1:
+ raise MesonException(
+ 'Genmarshal requires one positional argument.')
+ output = args[0]
+
+ if 'sources' not in kwargs:
+ raise MesonException('Missing keyword argument "sources".')
+ sources = kwargs.pop('sources')
+ if isinstance(sources, str):
+ sources = [sources]
+ elif not isinstance(sources, list):
+ raise MesonException(
+ 'Sources keyword argument must be a string or array.')
+
+ cmd = ['glib-genmarshal']
+ known_kwargs = ['body', 'header', 'internal', 'nostdinc',
+ 'skip-source', 'stdinc', 'valist-marshallers']
+ known_custom_target_kwargs = ['install', 'install_dir', 'build_always',
+ 'depends', 'depend_files']
+ for arg, value in kwargs.items():
+ if arg == 'prefix':
+ cmd += ['--prefix', value]
+ elif arg in known_kwargs and value:
+ cmd += ['--' + arg]
+ elif arg not in known_custom_target_kwargs:
+ raise MesonException(
+ 'Genmarshal does not take a %s keyword argument.' % (
+ arg, ))
+ cmd += ['@INPUT@']
+
+ custom_kwargs = {
+ 'input': sources,
+ 'output': output,
+ 'capture': True,
+ 'command': cmd
+ }
+ for arg in known_custom_target_kwargs:
+ if arg in kwargs:
+ custom_kwargs[arg] = kwargs[arg]
+ return build.CustomTarget(output, state.subdir, custom_kwargs)
+
def initialize():
return GnomeModule()