aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-01-14 15:13:47 -0500
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2022-01-15 23:50:14 +0530
commit96d000574450ed0a7a0589a069938b0f0dc5c05b (patch)
treeeca1ee208de6670352a3fcacbbd36abc8c94bb7c
parentf3a8e5d3b26410a3492952487a17909be0bfb217 (diff)
downloadmeson-96d000574450ed0a7a0589a069938b0f0dc5c05b.zip
meson-96d000574450ed0a7a0589a069938b0f0dc5c05b.tar.gz
meson-96d000574450ed0a7a0589a069938b0f0dc5c05b.tar.bz2
gnome.genmarshal: restore the ability to pass sources as Files objects
It used to support: - a single string - an array of anything And as long as CustomTarget supported it too, everything worked fine. So, a `files('foo')` worked but a `files('foo')[0]` did not, which is silly... and it's not exactly terrible to use files() here, the input is literally a list of source files. Fixes building gnome-terminal Fixes #9827 Test updated by Nirbheek Chauhan <nirbheek@centricular.com>
-rw-r--r--docs/markdown/Gnome-module.md3
-rw-r--r--mesonbuild/modules/gnome.py4
-rw-r--r--test cases/frameworks/7 gnome/genmarshal/main.c.in (renamed from test cases/frameworks/7 gnome/genmarshal/main.c)8
-rw-r--r--test cases/frameworks/7 gnome/genmarshal/meson.build63
-rw-r--r--test cases/frameworks/7 gnome/test.json7
5 files changed, 64 insertions, 21 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 1bcf15d..616562a 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -133,8 +133,7 @@ argument is the basename of the output files.
* `nostdinc`: if true, don't include the standard marshallers from glib
* `prefix`: the prefix to use for symbols
* `skip_source`: if true, skip source location comments
-* `sources` []str *required*: List of string sources to consume
-* `sources`: the list of sources to use as inputs
+* `sources` [](str | File) *required*: the list of sources to use as inputs
* `stdinc`: if true, include the standard marshallers from glib
* `valist_marshallers`: if true, generate va_list marshallers
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 267c2d4..78e09e6 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -153,7 +153,7 @@ if T.TYPE_CHECKING:
nostdinc: bool
prefix: T.Optional[str]
skip_source: bool
- sources: T.List[str]
+ sources: T.List[FileOrString]
stdinc: bool
valist_marshallers: bool
@@ -1813,7 +1813,7 @@ class GnomeModule(ExtensionModule):
KwargInfo('nostdinc', bool, default=False),
KwargInfo('prefix', (str, NoneType)),
KwargInfo('skip_source', bool, default=False),
- KwargInfo('sources', ContainerTypeInfo(list, str, allow_empty=False), listify=True, required=True),
+ KwargInfo('sources', ContainerTypeInfo(list, (str, mesonlib.File), allow_empty=False), listify=True, required=True),
KwargInfo('stdinc', bool, default=False),
KwargInfo('valist_marshallers', bool, default=False),
)
diff --git a/test cases/frameworks/7 gnome/genmarshal/main.c b/test cases/frameworks/7 gnome/genmarshal/main.c.in
index 83b08af..8e3ca7a 100644
--- a/test cases/frameworks/7 gnome/genmarshal/main.c
+++ b/test cases/frameworks/7 gnome/genmarshal/main.c.in
@@ -1,7 +1,7 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include<glib-object.h>
-#include"marshaller.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib-object.h>
+#include @MARSHALLER_HEADER@
static int singleton = 42;
diff --git a/test cases/frameworks/7 gnome/genmarshal/meson.build b/test cases/frameworks/7 gnome/genmarshal/meson.build
index d7189f5..7686b4b 100644
--- a/test cases/frameworks/7 gnome/genmarshal/meson.build
+++ b/test cases/frameworks/7 gnome/genmarshal/meson.build
@@ -1,12 +1,51 @@
-marshallers = gnome.genmarshal('marshaller',
-sources : 'marshaller.list',
-install_header : true,
-install_dir : get_option('includedir'),
-extra_args : ['-UG_ENABLE_DEBUG', '--prototypes'])
-
-marshaller_c = marshallers[0]
-marshaller_h = marshallers[1]
-
-genmarshalexe = executable('genmarshalprog', 'main.c', marshaller_c, marshaller_h,
-dependencies : gobj)
-test('genmarshal test', genmarshalexe)
+m_list = configure_file(input: 'marshaller.list',
+ output: 'm.list',
+ copy: true)
+
+idx = 0
+mlists = ['marshaller.list', files('marshaller.list'), m_list]
+
+foreach mlist : mlists
+ marshallers = gnome.genmarshal('marshaller-@0@'.format(idx),
+ sources : mlist,
+ install_header : true,
+ install_dir : get_option('includedir') / 'subdir-@0@'.format(idx),
+ extra_args : ['-UG_ENABLE_DEBUG', '--prototypes'])
+
+ marshaller_c = marshallers[0]
+ marshaller_h = marshallers[1]
+
+ cdata = configuration_data()
+ cdata.set_quoted('MARSHALLER_HEADER', 'marshaller-@0@.h'.format(idx))
+
+ main_c = configure_file(input: 'main.c.in',
+ output: 'main-@0@.c'.format(idx),
+ configuration: cdata)
+
+ genmarshalexe = executable('genmarshalprog-@0@'.format(idx),
+ main_c, marshaller_c, marshaller_h,
+ dependencies : gobj)
+ test('genmarshal test @0@'.format(idx), genmarshalexe)
+ idx += 1
+endforeach
+
+foreach mlist : mlists
+ marshallers = gnome.genmarshal('marshaller-@0@'.format(idx),
+ sources : [mlist],
+ install_header : true,
+ install_dir : get_option('includedir') / 'subdir-@0@'.format(idx),
+ extra_args : ['-UG_ENABLE_DEBUG', '--prototypes'])
+
+ marshaller_c = marshallers[0]
+ marshaller_h = marshallers[1]
+
+ main_c = configure_file(input: 'main.c.in',
+ output: 'main-@0@.c'.format(idx),
+ configuration: cdata)
+
+ genmarshalexe = executable('genmarshalprog-@0@'.format(idx),
+ main_c, marshaller_c, marshaller_h,
+ dependencies : gobj)
+ test('genmarshal test @0@'.format(idx), genmarshalexe)
+ idx += 1
+endforeach
diff --git a/test cases/frameworks/7 gnome/test.json b/test cases/frameworks/7 gnome/test.json
index d243cff..0d17384 100644
--- a/test cases/frameworks/7 gnome/test.json
+++ b/test cases/frameworks/7 gnome/test.json
@@ -4,7 +4,12 @@
{"type": "file", "file": "usr/include/enums2.h"},
{"type": "file", "file": "usr/include/enums3.h"},
{"type": "file", "file": "usr/include/enums5.h"},
- {"type": "file", "file": "usr/include/marshaller.h"},
+ {"type": "file", "file": "usr/include/subdir-0/marshaller-0.h"},
+ {"type": "file", "file": "usr/include/subdir-1/marshaller-1.h"},
+ {"type": "file", "file": "usr/include/subdir-2/marshaller-2.h"},
+ {"type": "file", "file": "usr/include/subdir-3/marshaller-3.h"},
+ {"type": "file", "file": "usr/include/subdir-4/marshaller-4.h"},
+ {"type": "file", "file": "usr/include/subdir-5/marshaller-5.h"},
{"type": "expr", "file": "usr/lib/?libgir_lib.so"},
{"type": "file", "platform": "cygwin", "file": "usr/lib/libgir_lib.dll.a"},
{"type": "expr", "file": "usr/lib/?libgir_lib2.so"},