[gobject-introspection/subproject-fixes] Clean up the subproject rules for GLib
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/subproject-fixes] Clean up the subproject rules for GLib
- Date: Tue, 27 Jul 2021 23:53:56 +0000 (UTC)
commit ca59a76bc6f7a765137ed4b46bf9dbdccace07d3
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jul 28 00:45:32 2021 +0100
Clean up the subproject rules for GLib
Make the variable names intelligible, and include a bunch of built files
that are necessary to ensure that the generated GIR data actually
matches the GLib API.
gir/meson.build | 93 ++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 66 insertions(+), 27 deletions(-)
---
diff --git a/gir/meson.build b/gir/meson.build
index 61fbdfb1..833a8486 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -119,35 +119,62 @@ if dep_type == 'pkgconfig'
endif
glib_includes = ['-I' + glib_incdir, '-I' + glib_libincdir]
elif dep_type == 'internal'
- glib_command += ['--pkg-export=glib-2.0']
- # XXX: Assumes that the builddir layout is 'mirror'
- glib_libdir = join_paths(meson.build_root(), subprojdir, 'glib', 'glib')
- # XXX: Assumes the location of the glib subproject dir
- # We should add API to meson to get a specific file from a specific subproject
- glibproj_incdir = join_paths(meson.source_root(), subprojdir, 'glib')
- glib_incdir = join_paths(glibproj_incdir, 'glib')
- glib_libincdir = glib_libdir
- glib_files += join_paths(glibproj_incdir, 'gobject', 'glib-types.h')
- glib_files += join_paths(glib_libincdir, 'glibconfig.h')
+ # XXX: This is a pile of hacks to allow gobject-introspection to parse the
+ # GLib source files when GLib is used as a subproject
+ # Assumes that the builddir layout is 'mirror'
+ # Assumes the location of the glib subproject dir
+ # We should add API to meson to get a specific file from a specific
+ # subproject
+ glibproj_sourcedir = join_paths(meson.source_root(), subprojdir, 'glib')
+ glibproj_builddir = join_paths(meson.build_root(), subprojdir, 'glib')
+
+ glib_files += join_paths(glibproj_sourcedir, 'gobject', 'glib-types.h')
+
+ # Generated files, relative to the build directory
+ glib_files += [
+ join_paths(glibproj_builddir, 'glib', 'glibconfig.h'),
+ join_paths(glibproj_builddir, 'gobject', 'glib-enumtypes.h'),
+ ]
+
if giounix_dep.found()
- glib_files += join_paths(glib_incdir, 'glib-unix.h')
+ glib_files += [
+ join_paths(glibproj_sourcedir, 'glib', 'glib-unix.h'),
+ ]
endif
+
# We know exactly what headers will be installed, so just fetch that
glib_subproject = subproject('glib')
glib_headers = glib_subproject.get_variable('glib_sub_headers')
glib_files += glib_subproject.get_variable('glib_sources')
+
# XXX: Assumes that the builddir layout is 'mirror'
- gobject_libdir = join_paths(meson.build_root(), subprojdir, 'glib', 'gobject')
- gmodule_libdir = join_paths(meson.build_root(), subprojdir, 'glib', 'gmodule')
- gio_libdir = join_paths(meson.build_root(), subprojdir, 'glib', 'gio')
- glib_libpaths = ['-L' + glib_libdir, '-L' + gobject_libdir,
- '-L' + gmodule_libdir, '-L' + gio_libdir]
+ glib_libdir = join_paths(glibproj_builddir, 'glib')
+ gobject_libdir = join_paths(glibproj_builddir, 'gobject')
+ gmodule_libdir = join_paths(glibproj_builddir, 'gmodule')
+ gio_libdir = join_paths(glibproj_builddir, 'gio')
+
+ glib_libpaths = [
+ '-L' + glib_libdir,
+ '-L' + gobject_libdir,
+ '-L' + gmodule_libdir,
+ '-L' + gio_libdir,
+ ]
# Includes that will be used to compile the scanner executable
- glib_buildinc = join_paths(meson.build_root(), subprojdir, 'glib')
- gmodule_incdir = join_paths(glibproj_incdir, 'gmodule')
- gio_incdir = join_paths(glibproj_incdir, 'gio')
- glib_includes = ['-I' + glibproj_incdir, '-I' + glib_incdir, '-I' + glib_libincdir,
- '-I' + glib_buildinc, '-I' + gmodule_incdir, '-I' + gio_incdir]
+ glib_incdir = join_paths(glibproj_sourcedir, 'glib')
+ gobject_incdir = join_paths(glibproj_sourcedir, 'gobject')
+ gmodule_incdir = join_paths(glibproj_sourcedir, 'gmodule')
+ gio_incdir = join_paths(glibproj_sourcedir, 'gio')
+
+ glib_includes = [
+ '-I' + glibproj_sourcedir,
+ '-I' + glibproj_builddir,
+ '-I' + glib_libdir,
+ '-I' + glib_incdir,
+ '-I' + gobject_incdir,
+ '-I' + gmodule_incdir,
+ '-I' + gio_incdir,
+ ]
+
# XXX: We need include paths to all glib dependencies too. We assume that the
# dependencies are only libffi and proxy-libintl, and that they are used as
# subprojects. In the worst case we add paths to non-existent directories.
@@ -158,10 +185,13 @@ elif dep_type == 'internal'
ffi_libdir = join_paths(meson.build_root(), subprojdir, 'libffi', 'src')
intl_libdir = join_paths(meson.build_root(), subprojdir, 'proxy-libintl')
- glib_libpaths = ['-L' + ffi_libdir, '-L' + intl_libdir] + glib_libpaths
+ glib_libpaths = [
+ '-L' + ffi_libdir,
+ '-L' + intl_libdir,
+ ] + glib_libpaths
+ glib_command += ['--pkg-export=glib-2.0']
glib_command += glib_libpaths
-
else
error('Unknown glib dependency type: ' + dep_type)
endif
@@ -234,7 +264,9 @@ if dep_type == 'pkgconfig'
else
gobject_command += ['--pkg-export=gobject-2.0']
gobject_headers = glib_subproject.get_variable('gobject_install_headers')
- gobject_files += glib_subproject.get_variable('gobject_sources')
+ gobject_files += [
+ glib_subproject.get_variable('gobject_sources'),
+ ]
gobject_command += glib_libpaths
endif
@@ -288,8 +320,11 @@ if dep_type == 'pkgconfig'
else
gmodule_command += ['--pkg-export=gmodule-2.0']
gmodule_command += glib_libpaths
- gmodule_files += [join_paths(glibproj_incdir, 'gmodule', 'gmodule.h'),
- join_paths(glibproj_incdir, 'gmodule', 'gmodule.c')]
+ gmodule_files += [
+ join_paths(glibproj_sourcedir, 'gmodule', 'gmodule.h'),
+ join_paths(glibproj_sourcedir, 'gmodule', 'gmodule.c'),
+ join_paths(glibproj_builddir, 'gmodule', 'gmoduleconf.h'),
+ ]
endif
# NOTE: Always add this last so that we prefer the annotations in the sources
@@ -344,7 +379,11 @@ if dep_type == 'pkgconfig'
else
gio_command += ['--pkg-export=gio-2.0']
gio_headers = glib_subproject.get_variable('gio_headers')
- gio_files += glib_subproject.get_variable('gio_sources')
+ gio_files += [
+ glib_subproject.get_variable('gio_sources'),
+ join_paths(glibproj_builddir, 'gio', 'gioenumtypes.h'),
+ join_paths(glibproj_builddir, 'gio', 'gnetworking.h'),
+ ]
gio_command += glib_libpaths
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]