| 1 | https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/827494d6415b696a98fa195cbd883b50cc893bfc.patch |
| 2 | https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/effb1e09dee263cdac4ec593e8caf316e6f01fe2.patch |
| 3 | https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/7c1178069f1c58a05ec56a94ca6ba124215a947b.patch |
| 4 | |
| 5 | From 827494d6415b696a98fa195cbd883b50cc893bfc Mon Sep 17 00:00:00 2001 |
| 6 | From: Emmanuele Bassi <ebassi@gnome.org> |
| 7 | Date: Tue, 11 Jan 2022 15:47:50 +0000 |
| 8 | Subject: [PATCH] doctool: Add templates_dir CLI argument |
| 9 | |
| 10 | We can find the templates directory using the module file once |
| 11 | installed, but when running uninstalled we need to have a way to specify |
| 12 | where the templates can be found in the sources directory. |
| 13 | --- |
| 14 | giscanner/docmain.py | 4 +++- |
| 15 | giscanner/docwriter.py | 14 ++++++++------ |
| 16 | 2 files changed, 11 insertions(+), 7 deletions(-) |
| 17 | |
| 18 | diff --git a/giscanner/docmain.py b/giscanner/docmain.py |
| 19 | index dab063ef..88430f05 100644 |
| 20 | --- a/giscanner/docmain.py |
| 21 | +++ b/giscanner/docmain.py |
| 22 | @@ -51,6 +51,8 @@ def doc_main(args): |
| 23 | parser.add_argument("-s", "--write-sections-file", |
| 24 | action="store_const", dest="format", const="sections", |
| 25 | help="Backwards-compatible equivalent to -f sections") |
| 26 | + parser.add_argument("--templates-dir", |
| 27 | + action="store") |
| 28 | |
| 29 | args = parser.parse_args(args[1:]) |
| 30 | if not args.output: |
| 31 | @@ -74,7 +76,7 @@ def doc_main(args): |
| 32 | with open(args.output, 'w', encoding='utf-8') as fp: |
| 33 | write_sections_file(fp, sections_file) |
| 34 | else: |
| 35 | - writer = DocWriter(transformer, args.language, args.format) |
| 36 | + writer = DocWriter(transformer, args.language, args.format, args.templates_dir) |
| 37 | writer.write(args.output) |
| 38 | |
| 39 | return 0 |
| 40 | diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py |
| 41 | index d0cd610f..b72ab2ac 100644 |
| 42 | --- a/giscanner/docwriter.py |
| 43 | +++ b/giscanner/docwriter.py |
| 44 | @@ -1288,7 +1288,7 @@ LANGUAGES = { |
| 45 | |
| 46 | |
| 47 | class DocWriter(object): |
| 48 | - def __init__(self, transformer, language, output_format): |
| 49 | + def __init__(self, transformer, language, output_format, templates_dir=None): |
| 50 | self._transformer = transformer |
| 51 | |
| 52 | try: |
| 53 | @@ -1300,18 +1300,20 @@ class DocWriter(object): |
| 54 | self._formatter = formatter_class(self._transformer) |
| 55 | self._language = self._formatter.language |
| 56 | self._output_format = output_format |
| 57 | + self._templates_dir = templates_dir |
| 58 | |
| 59 | self._lookup = self._get_template_lookup() |
| 60 | |
| 61 | def _get_template_lookup(self): |
| 62 | - if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ: |
| 63 | + if self._templates_dir is not None: |
| 64 | + srcdir = self._templates_dir |
| 65 | + elif 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ: |
| 66 | top_srcdir = os.environ['UNINSTALLED_INTROSPECTION_SRCDIR'] |
| 67 | - srcdir = os.path.join(top_srcdir, 'giscanner') |
| 68 | + srcdir = os.path.join(top_srcdir, 'giscanner', 'doctemplates') |
| 69 | else: |
| 70 | - srcdir = os.path.dirname(__file__) |
| 71 | + srcdir = os.path.join(os.path.dirname(__file__), 'doctemplates') |
| 72 | |
| 73 | - template_dir = os.path.join(srcdir, 'doctemplates', |
| 74 | - self._formatter.output_format) |
| 75 | + template_dir = os.path.join(srcdir, self._formatter.output_format) |
| 76 | |
| 77 | return TemplateLookup(directories=[template_dir], |
| 78 | module_directory=tempfile.mkdtemp(), |
| 79 | -- |
| 80 | GitLab |
| 81 | |
| 82 | From effb1e09dee263cdac4ec593e8caf316e6f01fe2 Mon Sep 17 00:00:00 2001 |
| 83 | From: Emmanuele Bassi <ebassi@gnome.org> |
| 84 | Date: Tue, 11 Jan 2022 15:51:10 +0000 |
| 85 | Subject: [PATCH] build: Avoid the doctemplates hack |
| 86 | MIME-Version: 1.0 |
| 87 | Content-Type: text/plain; charset=UTF-8 |
| 88 | Content-Transfer-Encoding: 8bit |
| 89 | |
| 90 | The hack that copies the doctemplates directory into the build |
| 91 | directory has stopped working with newer versions of Meson; while it's |
| 92 | possible to copy files, custom_target() cannot depend on a directory. |
| 93 | Additionally, the dependency has always been broken. |
| 94 | |
| 95 | Instead, we enumerate the template files—after all, it's not like they |
| 96 | change a lot—and then we list them as dependencies for the test targets. |
| 97 | |
| 98 | Fixes: #414 |
| 99 | --- |
| 100 | giscanner/doctemplates/devdocs/meson.build | 19 +++++++ |
| 101 | giscanner/doctemplates/mallard/meson.build | 63 ++++++++++++++++++++++ |
| 102 | giscanner/meson.build | 14 ++--- |
| 103 | tests/scanner/meson.build | 24 +++++---- |
| 104 | 4 files changed, 98 insertions(+), 22 deletions(-) |
| 105 | create mode 100644 giscanner/doctemplates/devdocs/meson.build |
| 106 | create mode 100644 giscanner/doctemplates/mallard/meson.build |
| 107 | |
| 108 | diff --git a/giscanner/doctemplates/devdocs/meson.build b/giscanner/doctemplates/devdocs/meson.build |
| 109 | new file mode 100644 |
| 110 | index 00000000..2037182a |
| 111 | --- /dev/null |
| 112 | +++ b/giscanner/doctemplates/devdocs/meson.build |
| 113 | @@ -0,0 +1,19 @@ |
| 114 | +doc_templates += files([ |
| 115 | + 'Gjs/_doc.tmpl', |
| 116 | + 'Gjs/_index.tmpl', |
| 117 | + 'Gjs/_method.tmpl', |
| 118 | + 'Gjs/_methods.tmpl', |
| 119 | + 'Gjs/_properties.tmpl', |
| 120 | + 'Gjs/_signals.tmpl', |
| 121 | + 'Gjs/_staticmethods.tmpl', |
| 122 | + 'Gjs/_vfuncs.tmpl', |
| 123 | + 'Gjs/base.tmpl', |
| 124 | + 'Gjs/callback.tmpl', |
| 125 | + 'Gjs/class.tmpl', |
| 126 | + 'Gjs/default.tmpl', |
| 127 | + 'Gjs/enum.tmpl', |
| 128 | + 'Gjs/function.tmpl', |
| 129 | + 'Gjs/interface.tmpl', |
| 130 | + 'Gjs/method.tmpl', |
| 131 | + 'Gjs/namespace.tmpl', |
| 132 | +]) |
| 133 | diff --git a/giscanner/doctemplates/mallard/meson.build b/giscanner/doctemplates/mallard/meson.build |
| 134 | new file mode 100644 |
| 135 | index 00000000..5fe4e2af |
| 136 | --- /dev/null |
| 137 | +++ b/giscanner/doctemplates/mallard/meson.build |
| 138 | @@ -0,0 +1,63 @@ |
| 139 | +base_templates = files([ |
| 140 | + 'base.tmpl', |
| 141 | + 'class.tmpl', |
| 142 | + 'namespace.tmpl', |
| 143 | +]) |
| 144 | + |
| 145 | +c_templates = files([ |
| 146 | + 'C/callback.tmpl', |
| 147 | + 'C/class.tmpl', |
| 148 | + 'C/constructor.tmpl', |
| 149 | + 'C/default.tmpl', |
| 150 | + 'C/enum.tmpl', |
| 151 | + 'C/field.tmpl', |
| 152 | + 'C/function.tmpl', |
| 153 | + 'C/interface.tmpl', |
| 154 | + 'C/method.tmpl', |
| 155 | + 'C/namespace.tmpl', |
| 156 | + 'C/property.tmpl', |
| 157 | + 'C/record.tmpl', |
| 158 | + 'C/signal.tmpl', |
| 159 | + 'C/vfunc.tmpl', |
| 160 | +]) |
| 161 | + |
| 162 | +gjs_templates = files([ |
| 163 | + 'Gjs/callback.tmpl', |
| 164 | + 'Gjs/class.tmpl', |
| 165 | + 'Gjs/constructor.tmpl', |
| 166 | + 'Gjs/default.tmpl', |
| 167 | + 'Gjs/enum.tmpl', |
| 168 | + 'Gjs/field.tmpl', |
| 169 | + 'Gjs/function.tmpl', |
| 170 | + 'Gjs/interface.tmpl', |
| 171 | + 'Gjs/method.tmpl', |
| 172 | + 'Gjs/namespace.tmpl', |
| 173 | + 'Gjs/property.tmpl', |
| 174 | + 'Gjs/record.tmpl', |
| 175 | + 'Gjs/signal.tmpl', |
| 176 | + 'Gjs/vfunc.tmpl', |
| 177 | +]) |
| 178 | + |
| 179 | +py_templates = files([ |
| 180 | + 'Python/callback.tmpl', |
| 181 | + 'Python/class.tmpl', |
| 182 | + 'Python/constructor.tmpl', |
| 183 | + 'Python/default.tmpl', |
| 184 | + 'Python/enum.tmpl', |
| 185 | + 'Python/field.tmpl', |
| 186 | + 'Python/function.tmpl', |
| 187 | + 'Python/interface.tmpl', |
| 188 | + 'Python/method.tmpl', |
| 189 | + 'Python/namespace.tmpl', |
| 190 | + 'Python/property.tmpl', |
| 191 | + 'Python/record.tmpl', |
| 192 | + 'Python/signal.tmpl', |
| 193 | + 'Python/vfunc.tmpl', |
| 194 | +]) |
| 195 | + |
| 196 | +doc_templates += [ |
| 197 | + base_templates, |
| 198 | + c_templates, |
| 199 | + gjs_templates, |
| 200 | + py_templates, |
| 201 | +] |
| 202 | diff --git a/giscanner/meson.build b/giscanner/meson.build |
| 203 | index 41edcd44..3d7dc678 100644 |
| 204 | --- a/giscanner/meson.build |
| 205 | +++ b/giscanner/meson.build |
| 206 | @@ -53,17 +53,9 @@ configure_file(input : '../girepository/gdump.c', |
| 207 | |
| 208 | install_subdir('doctemplates', install_dir: giscannerdir) |
| 209 | |
| 210 | -# XXX: this doesn't track the input, but there is nothing to copy many files |
| 211 | -# in meson. |
| 212 | -doc_templates = custom_target('copy-templates', |
| 213 | - input : 'doctemplates', |
| 214 | - output : 'doctemplates', |
| 215 | - command : [ |
| 216 | - python, '-c', |
| 217 | - 'import sys, shutil;' + |
| 218 | - 'shutil.rmtree(sys.argv[2], ignore_errors=True);' + |
| 219 | - 'shutil.copytree(sys.argv[1], sys.argv[2])', |
| 220 | - '@INPUT@', '@OUTPUT@']) |
| 221 | +doc_templates = [] |
| 222 | +subdir('doctemplates/devdocs') |
| 223 | +subdir('doctemplates/mallard') |
| 224 | |
| 225 | flex = find_program('flex', 'win_flex') |
| 226 | bison = find_program('bison', 'win_bison') |
| 227 | diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build |
| 228 | index 5176b957..b81b3fd5 100644 |
| 229 | --- a/tests/scanner/meson.build |
| 230 | +++ b/tests/scanner/meson.build |
| 231 | @@ -525,19 +525,26 @@ foreach gir : test_girs |
| 232 | endforeach |
| 233 | |
| 234 | if has_girdoctool and glib_dep.type_name() == 'pkgconfig' |
| 235 | + doctool_env = environment() |
| 236 | + doctool_env.set('srcdir', meson.current_source_dir()) |
| 237 | + doctool_env.set('builddir', meson.current_build_dir()) |
| 238 | + |
| 239 | foreach language : ['C', 'Python', 'Gjs'] |
| 240 | regress_docs = custom_target( |
| 241 | 'generate-docs-' + language, |
| 242 | input: regress_gir, |
| 243 | - depends: [doc_templates], |
| 244 | + depend_files: doc_templates, |
| 245 | build_by_default: not cairo_deps_found, |
| 246 | + env: doctool_env, |
| 247 | output: 'Regress-1.0-' + language, |
| 248 | command: [ |
| 249 | python, girdoctool, |
| 250 | '--add-include-path=' + join_paths(build_root, 'gir'), |
| 251 | '--add-include-path=' + meson.current_build_dir(), |
| 252 | '--language', language, |
| 253 | - '@INPUT@', '-o', '@OUTPUT@'], |
| 254 | + '--templates-dir=' + join_paths(meson.current_source_dir(), '../../giscanner/doctemplates'), |
| 255 | + '@INPUT@', '-o', '@OUTPUT@', |
| 256 | + ], |
| 257 | ) |
| 258 | |
| 259 | if cairo_deps_found |
| 260 | @@ -546,10 +553,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig' |
| 261 | python, |
| 262 | args: [gi_tester, 'Regress-1.0-' + language], |
| 263 | depends: [regress_docs], |
| 264 | - env: [ |
| 265 | - 'srcdir=' + meson.current_source_dir(), |
| 266 | - 'builddir=' + meson.current_build_dir(), |
| 267 | - ], |
| 268 | + env: doctool_env, |
| 269 | ) |
| 270 | endif |
| 271 | endforeach |
| 272 | @@ -557,9 +561,10 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig' |
| 273 | regress_sections = custom_target( |
| 274 | 'generate-docs-sections', |
| 275 | input: regress_gir, |
| 276 | - depends: [doc_templates], |
| 277 | + depend_files: [doc_templates], |
| 278 | build_by_default: not cairo_deps_found, |
| 279 | output: 'Regress-1.0-sections.txt', |
| 280 | + env: doctool_env, |
| 281 | command: [ |
| 282 | python, girdoctool, |
| 283 | '--add-include-path=' + join_paths(build_root, 'gir'), |
| 284 | @@ -574,10 +579,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig' |
| 285 | python, |
| 286 | args: [gi_tester, 'Regress-1.0-sections.txt'], |
| 287 | depends: [regress_sections], |
| 288 | - env: [ |
| 289 | - 'srcdir=' + meson.current_source_dir(), |
| 290 | - 'builddir=' + meson.current_build_dir(), |
| 291 | - ], |
| 292 | + env: doctool_env, |
| 293 | ) |
| 294 | endif |
| 295 | endif |
| 296 | -- |
| 297 | GitLab |
| 298 | |
| 299 | From 7c1178069f1c58a05ec56a94ca6ba124215a947b Mon Sep 17 00:00:00 2001 |
| 300 | From: Emmanuele Bassi <ebassi@gnome.org> |
| 301 | Date: Tue, 11 Jan 2022 15:57:37 +0000 |
| 302 | Subject: [PATCH] build: Do not use deprecated API |
| 303 | |
| 304 | --- |
| 305 | gir/meson.build | 18 +++++++++--------- |
| 306 | tests/meson.build | 4 ++-- |
| 307 | 2 files changed, 11 insertions(+), 11 deletions(-) |
| 308 | |
| 309 | diff --git a/gir/meson.build b/gir/meson.build |
| 310 | index 5d646335..93b7e77d 100644 |
| 311 | --- a/gir/meson.build |
| 312 | +++ b/gir/meson.build |
| 313 | @@ -98,8 +98,8 @@ glib_command = scanner_command + [ |
| 314 | |
| 315 | if dep_type == 'pkgconfig' |
| 316 | glib_command += ['--external-library', '--pkg=glib-2.0'] |
| 317 | - glib_libdir = get_option('gi_cross_pkgconfig_sysroot_path') + glib_dep.get_pkgconfig_variable('libdir') |
| 318 | - glib_incdir = get_option('gi_cross_pkgconfig_sysroot_path') + join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0') |
| 319 | + glib_libdir = get_option('gi_cross_pkgconfig_sysroot_path') + glib_dep.get_variable(pkgconfig: 'libdir') |
| 320 | + glib_incdir = get_option('gi_cross_pkgconfig_sysroot_path') + join_paths(glib_dep.get_variable(pkgconfig: 'includedir'), 'glib-2.0') |
| 321 | glib_libincdir = join_paths(glib_libdir, 'glib-2.0', 'include') |
| 322 | glib_files += join_paths(glib_incdir, 'gobject', 'glib-types.h') |
| 323 | glib_files += join_paths(glib_libincdir, 'glibconfig.h') |
| 324 | @@ -133,8 +133,8 @@ elif dep_type == 'internal' |
| 325 | # We know exactly what headers will be installed, so just fetch that |
| 326 | glib_subproject = subproject('glib') |
| 327 | |
| 328 | - glibproj_sourcedir = join_paths(meson.source_root(), subprojdir, 'glib') |
| 329 | - glibproj_builddir = join_paths(meson.build_root(), subprojdir, 'glib') |
| 330 | + glibproj_sourcedir = join_paths(meson.project_source_root(), subprojdir, 'glib') |
| 331 | + glibproj_builddir = join_paths(meson.project_build_root(), subprojdir, 'glib') |
| 332 | |
| 333 | glib_files += join_paths(glibproj_sourcedir, 'gobject', 'glib-types.h') |
| 334 | |
| 335 | @@ -184,13 +184,13 @@ elif dep_type == 'internal' |
| 336 | # XXX: We need include paths to all glib dependencies too. We assume that the |
| 337 | # dependencies are only libffi and proxy-libintl, and that they are used as |
| 338 | # subprojects. In the worst case we add paths to non-existent directories. |
| 339 | - ffi_incdir = join_paths(meson.build_root(), subprojdir, 'libffi', 'include') |
| 340 | + ffi_incdir = join_paths(meson.project_build_root(), subprojdir, 'libffi', 'include') |
| 341 | glib_includes += ['-I' + ffi_incdir] |
| 342 | - intl_incdir = join_paths(meson.source_root(), subprojdir, 'proxy-libintl') |
| 343 | + intl_incdir = join_paths(meson.project_source_root(), subprojdir, 'proxy-libintl') |
| 344 | glib_includes += ['-I' + intl_incdir] |
| 345 | |
| 346 | - ffi_libdir = join_paths(meson.build_root(), subprojdir, 'libffi', 'src') |
| 347 | - intl_libdir = join_paths(meson.build_root(), subprojdir, 'proxy-libintl') |
| 348 | + ffi_libdir = join_paths(meson.project_build_root(), subprojdir, 'libffi', 'src') |
| 349 | + intl_libdir = join_paths(meson.project_build_root(), subprojdir, 'proxy-libintl') |
| 350 | glib_libpaths = [ |
| 351 | '-L' + ffi_libdir, |
| 352 | '-L' + intl_libdir, |
| 353 | @@ -412,7 +412,7 @@ if giounix_dep.found() |
| 354 | dep_type = giounix_dep.type_name() |
| 355 | if dep_type == 'pkgconfig' |
| 356 | gio_command += ['--pkg=gio-unix-2.0'] |
| 357 | - giounix_includedir = get_option('gi_cross_pkgconfig_sysroot_path') + join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0') |
| 358 | + giounix_includedir = get_option('gi_cross_pkgconfig_sysroot_path') + join_paths(giounix_dep.get_variable(pkgconfig: 'includedir'), 'gio-unix-2.0') |
| 359 | # Get the installed gio-unix header list |
| 360 | ret = run_command(python, '-c', globber.format(join_paths(giounix_includedir, 'gio', '*.h'))) |
| 361 | if ret.returncode() != 0 |
| 362 | diff --git a/tests/meson.build b/tests/meson.build |
| 363 | index 48981c60..abb51f58 100644 |
| 364 | --- a/tests/meson.build |
| 365 | +++ b/tests/meson.build |
| 366 | @@ -1,4 +1,4 @@ |
| 367 | -sub_build_root = join_paths(meson.build_root(), 'subprojects') |
| 368 | +sub_build_root = join_paths(meson.project_build_root(), 'subprojects') |
| 369 | test_env_common_path = [] |
| 370 | if glib_dep.type_name() == 'internal' and host_system == 'windows' |
| 371 | test_env_common_path += [ |
| 372 | @@ -13,7 +13,7 @@ endif |
| 373 | if libffi_dep.type_name() == 'internal' and host_system == 'windows' |
| 374 | test_env_common_path += [join_paths(sub_build_root, 'libffi', 'src')] |
| 375 | endif |
| 376 | -test_env_common_pypath = [meson.build_root()] |
| 377 | +test_env_common_pypath = [meson.project_build_root()] |
| 378 | |
| 379 | |
| 380 | test_regress_sources = files('scanner/regress.c') |
| 381 | -- |
| 382 | GitLab |
| 383 | |