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
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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.
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.
18 Upstream-Status: Backport
19 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
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
29 diff --git a/giscanner/doctemplates/devdocs/meson.build b/giscanner/doctemplates/devdocs/meson.build
31 index 00000000..2037182a
33 +++ b/giscanner/doctemplates/devdocs/meson.build
35 +doc_templates += files([
39 + 'Gjs/_methods.tmpl',
40 + 'Gjs/_properties.tmpl',
41 + 'Gjs/_signals.tmpl',
42 + 'Gjs/_staticmethods.tmpl',
45 + 'Gjs/callback.tmpl',
49 + 'Gjs/function.tmpl',
50 + 'Gjs/interface.tmpl',
52 + 'Gjs/namespace.tmpl',
54 diff --git a/giscanner/doctemplates/mallard/meson.build b/giscanner/doctemplates/mallard/meson.build
56 index 00000000..5fe4e2af
58 +++ b/giscanner/doctemplates/mallard/meson.build
60 +base_templates = files([
66 +c_templates = files([
69 + 'C/constructor.tmpl',
83 +gjs_templates = files([
84 + 'Gjs/callback.tmpl',
86 + 'Gjs/constructor.tmpl',
90 + 'Gjs/function.tmpl',
91 + 'Gjs/interface.tmpl',
93 + 'Gjs/namespace.tmpl',
94 + 'Gjs/property.tmpl',
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',
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',
129 install_subdir('doctemplates', install_dir: giscannerdir)
131 -# XXX: this doesn't track the input, but there is nothing to copy many files
133 -doc_templates = custom_target('copy-templates',
134 - input : 'doctemplates',
135 - output : 'doctemplates',
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@'])
143 +subdir('doctemplates/devdocs')
144 +subdir('doctemplates/mallard')
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
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())
160 foreach language : ['C', 'Python', 'Gjs']
161 regress_docs = custom_target(
162 'generate-docs-' + language,
164 - depends: [doc_templates],
165 + depend_files: doc_templates,
166 build_by_default: not cairo_deps_found,
168 output: 'Regress-1.0-' + language,
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@',
181 @@ -546,10 +553,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
183 args: [gi_tester, 'Regress-1.0-' + language],
184 depends: [regress_docs],
186 - 'srcdir=' + meson.current_source_dir(),
187 - 'builddir=' + meson.current_build_dir(),
193 @@ -557,9 +561,10 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
194 regress_sections = custom_target(
195 'generate-docs-sections',
197 - depends: [doc_templates],
198 + depend_files: [doc_templates],
199 build_by_default: not cairo_deps_found,
200 output: 'Regress-1.0-sections.txt',
204 '--add-include-path=' + join_paths(build_root, 'gir'),
205 @@ -574,10 +579,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
207 args: [gi_tester, 'Regress-1.0-sections.txt'],
208 depends: [regress_sections],
210 - 'srcdir=' + meson.current_source_dir(),
211 - 'builddir=' + meson.current_build_dir(),