Blame 8757.patch

Kalev Lember d58ca0
From 8ab822a8e5a05607a6afc6a5d860a8b8a76bca23 Mon Sep 17 00:00:00 2001
Kalev Lember d58ca0
From: Xavier Claessens <xavier.claessens@collabora.com>
Kalev Lember d58ca0
Date: Tue, 11 May 2021 09:18:47 -0400
Kalev Lember d58ca0
Subject: [PATCH] gnome: Fix gtkdoc generation
Kalev Lember d58ca0
Kalev Lember d58ca0
install_scripts used to replace @BUILD_ROOT@ and @SOURCE_ROOT@ but it
Kalev Lember d58ca0
was not documented and got removed in Meson 0.58.0. gnome.gtkdoc() was
Kalev Lember d58ca0
relying on that behaviour, but it has always been broken in the case the
Kalev Lember d58ca0
source or build directory contains spaces.
Kalev Lember d58ca0
Kalev Lember d58ca0
Fix this by changing get_include_args() to substitue paths directly
Kalev Lember d58ca0
which will then get escaped correctly.
Kalev Lember d58ca0
Kalev Lember d58ca0
Add a unit test that builds GObject documentation which is where this
Kalev Lember d58ca0
issue has been spotted.
Kalev Lember d58ca0
Kalev Lember d58ca0
Fixes: #8744
Kalev Lember d58ca0
---
Kalev Lember d58ca0
 mesonbuild/modules/__init__.py                | 54 +++++++++----------
Kalev Lember d58ca0
 mesonbuild/modules/gnome.py                   | 15 +++---
Kalev Lember d58ca0
 mesonbuild/modules/hotdoc.py                  |  3 +-
Kalev Lember d58ca0
 mesonbuild/modules/qt.py                      |  4 +-
Kalev Lember d58ca0
 mesonbuild/modules/windows.py                 |  5 +-
Kalev Lember d58ca0
 .../10 gtk-doc/doc/foobar1/foobar-docs.sgml   |  2 +-
Kalev Lember d58ca0
 .../doc/foobar1/foobar-sections.txt           | 16 ++++++
Kalev Lember d58ca0
 .../10 gtk-doc/doc/foobar1/foobar.types       |  4 ++
Kalev Lember d58ca0
 .../10 gtk-doc/doc/foobar1/meson.build        |  6 ++-
Kalev Lember d58ca0
 test cases/frameworks/10 gtk-doc/foo.c        | 30 +++++++++++
Kalev Lember d58ca0
 .../frameworks/10 gtk-doc/include/foo.h       | 18 +++++++
Kalev Lember d58ca0
 test cases/frameworks/10 gtk-doc/meson.build  | 12 +++++
Kalev Lember d58ca0
 test cases/frameworks/10 gtk-doc/test.json    |  4 +-
Kalev Lember d58ca0
 13 files changed, 127 insertions(+), 46 deletions(-)
Kalev Lember d58ca0
 create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt
Kalev Lember d58ca0
 create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types
Kalev Lember d58ca0
 create mode 100644 test cases/frameworks/10 gtk-doc/foo.c
Kalev Lember d58ca0
Kalev Lember d58ca0
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
Kalev Lember d58ca0
index ddb5e3e6cf3..c0970294c34 100644
Kalev Lember d58ca0
--- a/mesonbuild/modules/__init__.py
Kalev Lember d58ca0
+++ b/mesonbuild/modules/__init__.py
Kalev Lember d58ca0
@@ -56,6 +56,33 @@ def __init__(self, interpreter: 'Interpreter') -> None:
Kalev Lember d58ca0
         self.target_machine = interpreter.builtin['target_machine'].held_object
Kalev Lember d58ca0
         self.current_node = interpreter.current_node
Kalev Lember d58ca0
 
Kalev Lember d58ca0
+    def get_include_args(self, include_dirs, prefix='-I'):
Kalev Lember d58ca0
+        if not include_dirs:
Kalev Lember d58ca0
+            return []
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+        srcdir = self.environment.get_source_dir()
Kalev Lember d58ca0
+        builddir = self.environment.get_build_dir()
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+        dirs_str = []
Kalev Lember d58ca0
+        for dirs in unholder(include_dirs):
Kalev Lember d58ca0
+            if isinstance(dirs, str):
Kalev Lember d58ca0
+                dirs_str += [f'{prefix}{dirs}']
Kalev Lember d58ca0
+                continue
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+            # Should be build.IncludeDirs object.
Kalev Lember d58ca0
+            basedir = dirs.get_curdir()
Kalev Lember d58ca0
+            for d in dirs.get_incdirs():
Kalev Lember d58ca0
+                expdir = os.path.join(basedir, d)
Kalev Lember d58ca0
+                srctreedir = os.path.join(srcdir, expdir)
Kalev Lember d58ca0
+                buildtreedir = os.path.join(builddir, expdir)
Kalev Lember d58ca0
+                dirs_str += [f'{prefix}{buildtreedir}',
Kalev Lember d58ca0
+                             f'{prefix}{srctreedir}']
Kalev Lember d58ca0
+            for d in dirs.get_extra_build_dirs():
Kalev Lember d58ca0
+                dirs_str += [f'{prefix}{d}']
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+        return dirs_str
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+
Kalev Lember d58ca0
 class ModuleObject:
Kalev Lember d58ca0
     """Base class for all objects returned by modules
Kalev Lember d58ca0
     """
Kalev Lember d58ca0
@@ -71,33 +98,6 @@ def __init__(self, interpreter: T.Optional['Interpreter'] = None) -> None:
Kalev Lember d58ca0
 class ExtensionModule(ModuleObject):
Kalev Lember d58ca0
     pass
Kalev Lember d58ca0
 
Kalev Lember d58ca0
-def get_include_args(include_dirs, prefix='-I'):
Kalev Lember d58ca0
-    '''
Kalev Lember d58ca0
-    Expand include arguments to refer to the source and build dirs
Kalev Lember d58ca0
-    by using @SOURCE_ROOT@ and @BUILD_ROOT@ for later substitution
Kalev Lember d58ca0
-    '''
Kalev Lember d58ca0
-    if not include_dirs:
Kalev Lember d58ca0
-        return []
Kalev Lember d58ca0
-
Kalev Lember d58ca0
-    dirs_str = []
Kalev Lember d58ca0
-    for dirs in unholder(include_dirs):
Kalev Lember d58ca0
-        if isinstance(dirs, str):
Kalev Lember d58ca0
-            dirs_str += [f'{prefix}{dirs}']
Kalev Lember d58ca0
-            continue
Kalev Lember d58ca0
-
Kalev Lember d58ca0
-        # Should be build.IncludeDirs object.
Kalev Lember d58ca0
-        basedir = dirs.get_curdir()
Kalev Lember d58ca0
-        for d in dirs.get_incdirs():
Kalev Lember d58ca0
-            expdir = os.path.join(basedir, d)
Kalev Lember d58ca0
-            srctreedir = os.path.join('@SOURCE_ROOT@', expdir)
Kalev Lember d58ca0
-            buildtreedir = os.path.join('@BUILD_ROOT@', expdir)
Kalev Lember d58ca0
-            dirs_str += [f'{prefix}{buildtreedir}',
Kalev Lember d58ca0
-                         f'{prefix}{srctreedir}']
Kalev Lember d58ca0
-        for d in dirs.get_extra_build_dirs():
Kalev Lember d58ca0
-            dirs_str += [f'{prefix}{d}']
Kalev Lember d58ca0
-
Kalev Lember d58ca0
-    return dirs_str
Kalev Lember d58ca0
-
Kalev Lember d58ca0
 def is_module_library(fname):
Kalev Lember d58ca0
     '''
Kalev Lember d58ca0
     Check if the file is a library-like file generated by a module-specific
Kalev Lember d58ca0
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
Kalev Lember d58ca0
index d0b053d4f76..c91cda66f8b 100644
Kalev Lember d58ca0
--- a/mesonbuild/modules/gnome.py
Kalev Lember d58ca0
+++ b/mesonbuild/modules/gnome.py
Kalev Lember d58ca0
@@ -26,7 +26,6 @@
Kalev Lember d58ca0
 from .. import mesonlib
Kalev Lember d58ca0
 from .. import interpreter
Kalev Lember d58ca0
 from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget
Kalev Lember d58ca0
-from . import get_include_args
Kalev Lember d58ca0
 from . import ExtensionModule
Kalev Lember d58ca0
 from . import ModuleReturnValue
Kalev Lember d58ca0
 from ..mesonlib import (
Kalev Lember d58ca0
@@ -394,7 +393,7 @@ def _get_dependencies_flags(self, deps, state, depends, include_rpath=False,
Kalev Lember d58ca0
                     gi_includes.update([girdir])
Kalev Lember d58ca0
             if isinstance(dep, InternalDependency):
Kalev Lember d58ca0
                 cflags.update(dep.get_compile_args())
Kalev Lember d58ca0
-                cflags.update(get_include_args(dep.include_directories))
Kalev Lember d58ca0
+                cflags.update(state.get_include_args(dep.include_directories))
Kalev Lember d58ca0
                 for lib in unholder(dep.libraries):
Kalev Lember d58ca0
                     if isinstance(lib, build.SharedLibrary):
Kalev Lember d58ca0
                         internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
Kalev Lember d58ca0
@@ -443,7 +442,7 @@ def _get_dependencies_flags(self, deps, state, depends, include_rpath=False,
Kalev Lember d58ca0
                     else:
Kalev Lember d58ca0
                         external_ldflags.update([lib])
Kalev Lember d58ca0
             elif isinstance(dep, (build.StaticLibrary, build.SharedLibrary)):
Kalev Lember d58ca0
-                cflags.update(get_include_args(dep.get_include_dirs()))
Kalev Lember d58ca0
+                cflags.update(state.get_include_args(dep.get_include_dirs()))
Kalev Lember d58ca0
                 depends.append(dep)
Kalev Lember d58ca0
             else:
Kalev Lember d58ca0
                 mlog.log(f'dependency {dep!r} not handled to build gir files')
Kalev Lember d58ca0
@@ -853,7 +852,7 @@ def generate_gir(self, state, args, kwargs):
Kalev Lember d58ca0
         scan_command += self._scan_header(kwargs)
Kalev Lember d58ca0
         scan_command += self._scan_extra_args(kwargs)
Kalev Lember d58ca0
         scan_command += ['-I' + srcdir, '-I' + builddir]
Kalev Lember d58ca0
-        scan_command += get_include_args(girtargets_inc_dirs)
Kalev Lember d58ca0
+        scan_command += state.get_include_args(girtargets_inc_dirs)
Kalev Lember d58ca0
         scan_command += ['--filelist=' + self._make_gir_filelist(state, srcdir, ns, nsversion, girtargets, libsources)]
Kalev Lember d58ca0
         scan_command += self._scan_link_withs(state, depends, kwargs)
Kalev Lember d58ca0
         scan_command += self._scan_include(state, depends, gir_inc_dirs, kwargs)
Kalev Lember d58ca0
@@ -863,8 +862,8 @@ def generate_gir(self, state, args, kwargs):
Kalev Lember d58ca0
         scan_command += ['--cflags-begin']
Kalev Lember d58ca0
         scan_command += cflags
Kalev Lember d58ca0
         scan_command += ['--cflags-end']
Kalev Lember d58ca0
-        scan_command += get_include_args(inc_dirs)
Kalev Lember d58ca0
-        scan_command += get_include_args(list(gi_includes) + gir_inc_dirs + inc_dirs, prefix='--add-include-path=')
Kalev Lember d58ca0
+        scan_command += state.get_include_args(inc_dirs)
Kalev Lember d58ca0
+        scan_command += state.get_include_args(list(gi_includes) + gir_inc_dirs + inc_dirs, prefix='--add-include-path=')
Kalev Lember d58ca0
         scan_command += list(internal_ldflags)
Kalev Lember d58ca0
         scan_command += self._scan_gir_targets(state, girtargets)
Kalev Lember d58ca0
         scan_command += self._scan_langs(state, [lc[0] for lc in langs_compilers])
Kalev Lember d58ca0
@@ -886,7 +885,7 @@ def generate_gir(self, state, args, kwargs):
Kalev Lember d58ca0
 
Kalev Lember d58ca0
         typelib_output = f'{ns}-{nsversion}.typelib'
Kalev Lember d58ca0
         typelib_cmd = [gicompiler, scan_target, '--output', '@OUTPUT@']
Kalev Lember d58ca0
-        typelib_cmd += get_include_args(gir_inc_dirs, prefix='--includedir=')
Kalev Lember d58ca0
+        typelib_cmd += state.get_include_args(gir_inc_dirs, prefix='--includedir=')
Kalev Lember d58ca0
 
Kalev Lember d58ca0
         for incdir in typelib_includes:
Kalev Lember d58ca0
             typelib_cmd += ["--includedir=" + incdir]
Kalev Lember d58ca0
@@ -1127,7 +1126,7 @@ def _get_build_args(self, kwargs, state, depends):
Kalev Lember d58ca0
                     'Gir include dirs should be include_directories().')
Kalev Lember d58ca0
 
Kalev Lember d58ca0
         cflags.extend(deps_cflags)
Kalev Lember d58ca0
-        cflags.extend(get_include_args(inc_dirs))
Kalev Lember d58ca0
+        cflags.extend(state.get_include_args(inc_dirs))
Kalev Lember d58ca0
         ldflags = []
Kalev Lember d58ca0
         ldflags.extend(internal_ldflags)
Kalev Lember d58ca0
         ldflags.extend(external_ldflags)
Kalev Lember d58ca0
diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py
Kalev Lember d58ca0
index bf8cd229c0d..89a5d938ea7 100644
Kalev Lember d58ca0
--- a/mesonbuild/modules/hotdoc.py
Kalev Lember d58ca0
+++ b/mesonbuild/modules/hotdoc.py
Kalev Lember d58ca0
@@ -22,7 +22,6 @@
Kalev Lember d58ca0
 from mesonbuild.coredata import MesonException
Kalev Lember d58ca0
 from . import ModuleReturnValue
Kalev Lember d58ca0
 from . import ExtensionModule
Kalev Lember d58ca0
-from . import get_include_args
Kalev Lember d58ca0
 from ..dependencies import Dependency, InternalDependency
Kalev Lember d58ca0
 from ..interpreterbase import FeatureNew, InvalidArguments, noPosargs, noKwargs
Kalev Lember d58ca0
 from ..interpreter import CustomTargetHolder
Kalev Lember d58ca0
@@ -191,7 +190,7 @@ def process_dependencies(self, deps):
Kalev Lember d58ca0
         for dep in mesonlib.listify(ensure_list(deps)):
Kalev Lember d58ca0
             dep = getattr(dep, "held_object", dep)
Kalev Lember d58ca0
             if isinstance(dep, InternalDependency):
Kalev Lember d58ca0
-                inc_args = get_include_args(dep.include_directories)
Kalev Lember d58ca0
+                inc_args = self.state.get_include_args(dep.include_directories)
Kalev Lember d58ca0
                 cflags.update([self.replace_dirs_in_string(x)
Kalev Lember d58ca0
                                for x in inc_args])
Kalev Lember d58ca0
                 cflags.update(self.process_dependencies(dep.libraries))
Kalev Lember d58ca0
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
Kalev Lember d58ca0
index b7389bd59af..1bf0099d1df 100644
Kalev Lember d58ca0
--- a/mesonbuild/modules/qt.py
Kalev Lember d58ca0
+++ b/mesonbuild/modules/qt.py
Kalev Lember d58ca0
@@ -23,7 +23,7 @@
Kalev Lember d58ca0
 from ..mesonlib import MesonException, extract_as_list, File, unholder, version_compare
Kalev Lember d58ca0
 from ..dependencies import Dependency
Kalev Lember d58ca0
 import xml.etree.ElementTree as ET
Kalev Lember d58ca0
-from . import ModuleReturnValue, get_include_args, ExtensionModule
Kalev Lember d58ca0
+from . import ModuleReturnValue, ExtensionModule
Kalev Lember d58ca0
 from ..interpreterbase import noPosargs, permittedKwargs, FeatureNew, FeatureNewKwargs
Kalev Lember d58ca0
 from ..interpreter import extract_required_kwarg
Kalev Lember d58ca0
 from ..programs import NonExistingExternalProgram
Kalev Lember d58ca0
@@ -239,7 +239,7 @@ def preprocess(self, state, args, kwargs):
Kalev Lember d58ca0
             ui_gen = build.Generator([self.uic], ui_kwargs)
Kalev Lember d58ca0
             ui_output = ui_gen.process_files(f'Qt{self.qt_version} ui', ui_files, state)
Kalev Lember d58ca0
             sources.append(ui_output)
Kalev Lember d58ca0
-        inc = get_include_args(include_dirs=include_directories)
Kalev Lember d58ca0
+        inc = state.get_include_args(include_dirs=include_directories)
Kalev Lember d58ca0
         compile_args = []
Kalev Lember d58ca0
         for dep in unholder(dependencies):
Kalev Lember d58ca0
             if isinstance(dep, Dependency):
Kalev Lember d58ca0
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
Kalev Lember d58ca0
index d7a86380885..c4fdc196681 100644
Kalev Lember d58ca0
--- a/mesonbuild/modules/windows.py
Kalev Lember d58ca0
+++ b/mesonbuild/modules/windows.py
Kalev Lember d58ca0
@@ -19,7 +19,6 @@
Kalev Lember d58ca0
 from .. import mlog
Kalev Lember d58ca0
 from .. import mesonlib, build
Kalev Lember d58ca0
 from ..mesonlib import MachineChoice, MesonException, extract_as_list, unholder
Kalev Lember d58ca0
-from . import get_include_args
Kalev Lember d58ca0
 from . import ModuleReturnValue
Kalev Lember d58ca0
 from . import ExtensionModule
Kalev Lember d58ca0
 from ..interpreter import CustomTargetHolder
Kalev Lember d58ca0
@@ -83,12 +82,12 @@ def compile_resources(self, state, args, kwargs):
Kalev Lember d58ca0
         wrc_depends = extract_as_list(kwargs, 'depends', pop = True)
Kalev Lember d58ca0
         for d in wrc_depends:
Kalev Lember d58ca0
             if isinstance(d, CustomTargetHolder):
Kalev Lember d58ca0
-                extra_args += get_include_args([d.outdir_include()])
Kalev Lember d58ca0
+                extra_args += state.get_include_args([d.outdir_include()])
Kalev Lember d58ca0
         inc_dirs = extract_as_list(kwargs, 'include_directories', pop = True)
Kalev Lember d58ca0
         for incd in inc_dirs:
Kalev Lember d58ca0
             if not isinstance(incd.held_object, (str, build.IncludeDirs)):
Kalev Lember d58ca0
                 raise MesonException('Resource include dirs should be include_directories().')
Kalev Lember d58ca0
-        extra_args += get_include_args(inc_dirs)
Kalev Lember d58ca0
+        extra_args += state.get_include_args(inc_dirs)
Kalev Lember d58ca0
 
Kalev Lember d58ca0
         rescomp, rescomp_type = self._find_resource_compiler(state)
Kalev Lember d58ca0
         if rescomp_type == ResourceCompilerType.rc:
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml
Kalev Lember d58ca0
index 95f73efdf45..6ccd087dc18 100644
Kalev Lember d58ca0
--- a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml	
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml	
Kalev Lember d58ca0
@@ -35,7 +35,7 @@
Kalev Lember d58ca0
     </partintro>
Kalev Lember d58ca0
     <xi:include href="xml/foo.xml"/>
Kalev Lember d58ca0
     <xi:include href="../../include/bar.xml"/>
Kalev Lember d58ca0
-    <xi:include href="xml/foo-version.xml"/>
Kalev Lember d58ca0
+    <xi:include href="xml/version.xml"/>
Kalev Lember d58ca0
   </reference>
Kalev Lember d58ca0
 
Kalev Lember d58ca0
 </book>
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt
Kalev Lember d58ca0
new file mode 100644
Kalev Lember d58ca0
index 00000000000..d14c8dab010
Kalev Lember d58ca0
--- /dev/null
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt	
Kalev Lember d58ca0
@@ -0,0 +1,16 @@
Kalev Lember d58ca0
+<SECTION>
Kalev Lember d58ca0
+<FILE>foo</FILE>
Kalev Lember d58ca0
+<TITLE>FooObj</TITLE>
Kalev Lember d58ca0
+FooObj
Kalev Lember d58ca0
+FooObjClass
Kalev Lember d58ca0
+foo_do_something
Kalev Lember d58ca0
+</SECTION>
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+<SECTION>
Kalev Lember d58ca0
+<FILE>version</FILE>
Kalev Lember d58ca0
+<TITLE>version</TITLE>
Kalev Lember d58ca0
+FOO_MAJOR_VERSION
Kalev Lember d58ca0
+FOO_MINOR_VERSION
Kalev Lember d58ca0
+FOO_MICRO_VERSION
Kalev Lember d58ca0
+</SECTION>
Kalev Lember d58ca0
+
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types
Kalev Lember d58ca0
new file mode 100644
Kalev Lember d58ca0
index 00000000000..0a9c046f3ed
Kalev Lember d58ca0
--- /dev/null
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types	
Kalev Lember d58ca0
@@ -0,0 +1,4 @@
Kalev Lember d58ca0
+% This include is useless it's a regression test for https://github.com/mesonbuild/meson/issues/8744
Kalev Lember d58ca0
+#include <foo.h>
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+foo_obj_get_type
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build b/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build
Kalev Lember d58ca0
index 149c6e956aa..f4b3724dbae 100644
Kalev Lember d58ca0
--- a/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build	
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build	
Kalev Lember d58ca0
@@ -1,5 +1,9 @@
Kalev Lember d58ca0
 gnome.gtkdoc('foobar',
Kalev Lember d58ca0
-  src_dir : inc,
Kalev Lember d58ca0
+  src_dir : [inc, '.'],
Kalev Lember d58ca0
   main_sgml : 'foobar-docs.sgml',
Kalev Lember d58ca0
   content_files : [docbook, version_xml],
Kalev Lember d58ca0
+  dependencies: foo_dep,
Kalev Lember d58ca0
+  # Manually written types file for regression test:
Kalev Lember d58ca0
+  # https://github.com/mesonbuild/meson/issues/8744
Kalev Lember d58ca0
+  gobject_typesfile: 'foobar.types',
Kalev Lember d58ca0
   install : true)
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/foo.c b/test cases/frameworks/10 gtk-doc/foo.c
Kalev Lember d58ca0
new file mode 100644
Kalev Lember d58ca0
index 00000000000..36c0639ec08
Kalev Lember d58ca0
--- /dev/null
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/foo.c	
Kalev Lember d58ca0
@@ -0,0 +1,30 @@
Kalev Lember d58ca0
+#include <foo.h>
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+struct _FooObj {
Kalev Lember d58ca0
+  GObject parent;
Kalev Lember d58ca0
+  int dummy;
Kalev Lember d58ca0
+};
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+G_DEFINE_TYPE(FooObj, foo_obj, G_TYPE_OBJECT)
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+static void foo_obj_init (FooObj *self)
Kalev Lember d58ca0
+{
Kalev Lember d58ca0
+}
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+static void foo_obj_class_init (FooObjClass *klass)
Kalev Lember d58ca0
+{
Kalev Lember d58ca0
+}
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+/**
Kalev Lember d58ca0
+ * foo_do_something:
Kalev Lember d58ca0
+ * @self: self
Kalev Lember d58ca0
+ *
Kalev Lember d58ca0
+ * Useless function.
Kalev Lember d58ca0
+ *
Kalev Lember d58ca0
+ * Returns: 0.
Kalev Lember d58ca0
+ */
Kalev Lember d58ca0
+int foo_do_something(FooObj *self)
Kalev Lember d58ca0
+{
Kalev Lember d58ca0
+  return 0;
Kalev Lember d58ca0
+}
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/include/foo.h b/test cases/frameworks/10 gtk-doc/include/foo.h
Kalev Lember d58ca0
index 7b8946b6a86..510f3d1ecb5 100644
Kalev Lember d58ca0
--- a/test cases/frameworks/10 gtk-doc/include/foo.h	
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/include/foo.h	
Kalev Lember d58ca0
@@ -1,5 +1,7 @@
Kalev Lember d58ca0
 #pragma once
Kalev Lember d58ca0
 
Kalev Lember d58ca0
+#include <glib-object.h>
Kalev Lember d58ca0
+
Kalev Lember d58ca0
 /**
Kalev Lember d58ca0
  * FooIndecision:
Kalev Lember d58ca0
  * @FOO_MAYBE:     Something maybe
Kalev Lember d58ca0
@@ -13,3 +15,19 @@ typedef enum {
Kalev Lember d58ca0
     FOO_POSSIBLY,
Kalev Lember d58ca0
 } FooIndecision;
Kalev Lember d58ca0
 
Kalev Lember d58ca0
+/**
Kalev Lember d58ca0
+ * FooObjClass:
Kalev Lember d58ca0
+ *
Kalev Lember d58ca0
+ * The class
Kalev Lember d58ca0
+ */
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+/**
Kalev Lember d58ca0
+ * FooObj:
Kalev Lember d58ca0
+ *
Kalev Lember d58ca0
+ * The instance
Kalev Lember d58ca0
+ */
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+#define FOO_TYPE_OBJ foo_obj_get_type()
Kalev Lember d58ca0
+G_DECLARE_FINAL_TYPE(FooObj, foo_obj, FOO, OBJ, GObject)
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+int foo_do_something(FooObj *self);
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/meson.build b/test cases/frameworks/10 gtk-doc/meson.build
Kalev Lember d58ca0
index 5c22ad0afa4..292980fafa7 100644
Kalev Lember d58ca0
--- a/test cases/frameworks/10 gtk-doc/meson.build	
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/meson.build	
Kalev Lember d58ca0
@@ -24,4 +24,16 @@ if gtkdoc_ver.version_compare('<1.26')
Kalev Lember d58ca0
   error('MESON_SKIP_TEST gtk-doc test requires gtkdoc >= 1.26.')
Kalev Lember d58ca0
 endif
Kalev Lember d58ca0
 
Kalev Lember d58ca0
+gobject = dependency('gobject-2.0')
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+libfoo = library('foo', 'foo.c',
Kalev Lember d58ca0
+  include_directories: inc,
Kalev Lember d58ca0
+  dependencies: gobject,
Kalev Lember d58ca0
+)
Kalev Lember d58ca0
+
Kalev Lember d58ca0
+foo_dep = declare_dependency(
Kalev Lember d58ca0
+  link_with: libfoo,
Kalev Lember d58ca0
+  include_directories: inc,
Kalev Lember d58ca0
+)
Kalev Lember d58ca0
+
Kalev Lember d58ca0
 subdir('doc')
Kalev Lember d58ca0
diff --git a/test cases/frameworks/10 gtk-doc/test.json b/test cases/frameworks/10 gtk-doc/test.json
Kalev Lember d58ca0
index c44126cc741..03ad0595817 100644
Kalev Lember d58ca0
--- a/test cases/frameworks/10 gtk-doc/test.json	
Kalev Lember d58ca0
+++ b/test cases/frameworks/10 gtk-doc/test.json	
Kalev Lember d58ca0
@@ -4,8 +4,8 @@
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/BAR.html"},
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar.devhelp2"},
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar.html"},
Kalev Lember d58ca0
-    {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar-foo.html"},
Kalev Lember d58ca0
-    {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar-foo-version.html"},
Kalev Lember d58ca0
+    {"type": "file", "file": "usr/share/gtk-doc/html/foobar/FooObj.html"},
Kalev Lember d58ca0
+    {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foo-version.html"},
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/home.png"},
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/index.html"},
Kalev Lember d58ca0
     {"type": "file", "file": "usr/share/gtk-doc/html/foobar/left.png"},