]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
b7d31ccfb0c1831ec1ea3e4736e68267711acf79
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From effb1e09dee263cdac4ec593e8caf316e6f01fe2 Mon Sep 17 00:00:00 2001
2 From: Emmanuele Bassi <ebassi@gnome.org>
3 Date: Tue, 11 Jan 2022 15:51:10 +0000
4 Subject: [PATCH] build: Avoid the doctemplates hack
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The hack that copies the doctemplates directory into the build
10 directory has stopped working with newer versions of Meson; while it's
11 possible to copy files, custom_target() cannot depend on a directory.
12 Additionally, the dependency has always been broken.
13
14 Instead, we enumerate the template files—after all, it's not like they
15 change a lot—and then we list them as dependencies for the test targets.
16
17 Fixes: #414
18 Upstream-Status: Backport
19 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
20 ---
21 giscanner/doctemplates/devdocs/meson.build | 19 +++++++
22 giscanner/doctemplates/mallard/meson.build | 63 ++++++++++++++++++++++
23 giscanner/meson.build | 14 ++---
24 tests/scanner/meson.build | 24 +++++----
25 4 files changed, 98 insertions(+), 22 deletions(-)
26 create mode 100644 giscanner/doctemplates/devdocs/meson.build
27 create mode 100644 giscanner/doctemplates/mallard/meson.build
28
29 diff --git a/giscanner/doctemplates/devdocs/meson.build b/giscanner/doctemplates/devdocs/meson.build
30 new file mode 100644
31 index 00000000..2037182a
32 --- /dev/null
33 +++ b/giscanner/doctemplates/devdocs/meson.build
34 @@ -0,0 +1,19 @@
35 +doc_templates += files([
36 + 'Gjs/_doc.tmpl',
37 + 'Gjs/_index.tmpl',
38 + 'Gjs/_method.tmpl',
39 + 'Gjs/_methods.tmpl',
40 + 'Gjs/_properties.tmpl',
41 + 'Gjs/_signals.tmpl',
42 + 'Gjs/_staticmethods.tmpl',
43 + 'Gjs/_vfuncs.tmpl',
44 + 'Gjs/base.tmpl',
45 + 'Gjs/callback.tmpl',
46 + 'Gjs/class.tmpl',
47 + 'Gjs/default.tmpl',
48 + 'Gjs/enum.tmpl',
49 + 'Gjs/function.tmpl',
50 + 'Gjs/interface.tmpl',
51 + 'Gjs/method.tmpl',
52 + 'Gjs/namespace.tmpl',
53 +])
54 diff --git a/giscanner/doctemplates/mallard/meson.build b/giscanner/doctemplates/mallard/meson.build
55 new file mode 100644
56 index 00000000..5fe4e2af
57 --- /dev/null
58 +++ b/giscanner/doctemplates/mallard/meson.build
59 @@ -0,0 +1,63 @@
60 +base_templates = files([
61 + 'base.tmpl',
62 + 'class.tmpl',
63 + 'namespace.tmpl',
64 +])
65 +
66 +c_templates = files([
67 + 'C/callback.tmpl',
68 + 'C/class.tmpl',
69 + 'C/constructor.tmpl',
70 + 'C/default.tmpl',
71 + 'C/enum.tmpl',
72 + 'C/field.tmpl',
73 + 'C/function.tmpl',
74 + 'C/interface.tmpl',
75 + 'C/method.tmpl',
76 + 'C/namespace.tmpl',
77 + 'C/property.tmpl',
78 + 'C/record.tmpl',
79 + 'C/signal.tmpl',
80 + 'C/vfunc.tmpl',
81 +])
82 +
83 +gjs_templates = files([
84 + 'Gjs/callback.tmpl',
85 + 'Gjs/class.tmpl',
86 + 'Gjs/constructor.tmpl',
87 + 'Gjs/default.tmpl',
88 + 'Gjs/enum.tmpl',
89 + 'Gjs/field.tmpl',
90 + 'Gjs/function.tmpl',
91 + 'Gjs/interface.tmpl',
92 + 'Gjs/method.tmpl',
93 + 'Gjs/namespace.tmpl',
94 + 'Gjs/property.tmpl',
95 + 'Gjs/record.tmpl',
96 + 'Gjs/signal.tmpl',
97 + 'Gjs/vfunc.tmpl',
98 +])
99 +
100 +py_templates = files([
101 + 'Python/callback.tmpl',
102 + 'Python/class.tmpl',
103 + 'Python/constructor.tmpl',
104 + 'Python/default.tmpl',
105 + 'Python/enum.tmpl',
106 + 'Python/field.tmpl',
107 + 'Python/function.tmpl',
108 + 'Python/interface.tmpl',
109 + 'Python/method.tmpl',
110 + 'Python/namespace.tmpl',
111 + 'Python/property.tmpl',
112 + 'Python/record.tmpl',
113 + 'Python/signal.tmpl',
114 + 'Python/vfunc.tmpl',
115 +])
116 +
117 +doc_templates += [
118 + base_templates,
119 + c_templates,
120 + gjs_templates,
121 + py_templates,
122 +]
123 diff --git a/giscanner/meson.build b/giscanner/meson.build
124 index 41edcd44..3d7dc678 100644
125 --- a/giscanner/meson.build
126 +++ b/giscanner/meson.build
127 @@ -53,17 +53,9 @@ configure_file(input : '../girepository/gdump.c',
128
129 install_subdir('doctemplates', install_dir: giscannerdir)
130
131 -# XXX: this doesn't track the input, but there is nothing to copy many files
132 -# in meson.
133 -doc_templates = custom_target('copy-templates',
134 - input : 'doctemplates',
135 - output : 'doctemplates',
136 - command : [
137 - python, '-c',
138 - 'import sys, shutil;' +
139 - 'shutil.rmtree(sys.argv[2], ignore_errors=True);' +
140 - 'shutil.copytree(sys.argv[1], sys.argv[2])',
141 - '@INPUT@', '@OUTPUT@'])
142 +doc_templates = []
143 +subdir('doctemplates/devdocs')
144 +subdir('doctemplates/mallard')
145
146 flex = find_program('flex', 'win_flex')
147 bison = find_program('bison', 'win_bison')
148 diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
149 index 5176b957..b81b3fd5 100644
150 --- a/tests/scanner/meson.build
151 +++ b/tests/scanner/meson.build
152 @@ -525,19 +525,26 @@ foreach gir : test_girs
153 endforeach
154
155 if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
156 + doctool_env = environment()
157 + doctool_env.set('srcdir', meson.current_source_dir())
158 + doctool_env.set('builddir', meson.current_build_dir())
159 +
160 foreach language : ['C', 'Python', 'Gjs']
161 regress_docs = custom_target(
162 'generate-docs-' + language,
163 input: regress_gir,
164 - depends: [doc_templates],
165 + depend_files: doc_templates,
166 build_by_default: not cairo_deps_found,
167 + env: doctool_env,
168 output: 'Regress-1.0-' + language,
169 command: [
170 python, girdoctool,
171 '--add-include-path=' + join_paths(build_root, 'gir'),
172 '--add-include-path=' + meson.current_build_dir(),
173 '--language', language,
174 - '@INPUT@', '-o', '@OUTPUT@'],
175 + '--templates-dir=' + join_paths(meson.current_source_dir(), '../../giscanner/doctemplates'),
176 + '@INPUT@', '-o', '@OUTPUT@',
177 + ],
178 )
179
180 if cairo_deps_found
181 @@ -546,10 +553,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
182 python,
183 args: [gi_tester, 'Regress-1.0-' + language],
184 depends: [regress_docs],
185 - env: [
186 - 'srcdir=' + meson.current_source_dir(),
187 - 'builddir=' + meson.current_build_dir(),
188 - ],
189 + env: doctool_env,
190 )
191 endif
192 endforeach
193 @@ -557,9 +561,10 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
194 regress_sections = custom_target(
195 'generate-docs-sections',
196 input: regress_gir,
197 - depends: [doc_templates],
198 + depend_files: [doc_templates],
199 build_by_default: not cairo_deps_found,
200 output: 'Regress-1.0-sections.txt',
201 + env: doctool_env,
202 command: [
203 python, girdoctool,
204 '--add-include-path=' + join_paths(build_root, 'gir'),
205 @@ -574,10 +579,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
206 python,
207 args: [gi_tester, 'Regress-1.0-sections.txt'],
208 depends: [regress_sections],
209 - env: [
210 - 'srcdir=' + meson.current_source_dir(),
211 - 'builddir=' + meson.current_build_dir(),
212 - ],
213 + env: doctool_env,
214 )
215 endif
216 endif
217 --
218 2.20.1
219