introspection: Re-add platform specific APIs to GLib-2.0.gir and Gio-2.0.gir

To avoid a big introspection API break.

These APIs are now listed in the new `{GLib,Gio}{Unix,Win32}-2.0.gir`
files, but for backwards compatibility they need to continue to be
listed in `Gio-2.0.gir` and `GLib-2.0.gir` as well, until the next major
introspection API break (and none is planned).

No new platform specific APIs should be added to these GIR files, but
these existing ones must remain.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3892#note_2001361

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-02-12 15:17:20 +00:00
parent 4314944e56
commit 19308d6c18

View File

@ -15,20 +15,33 @@ if get_option('b_sanitize') != ''
endif endif
# GLib # GLib
glib_gir_sources = [
gi_gen_shared_sources,
glibconfig_h,
gversionmacros_h,
glib_visibility_h,
glib_headers,
glib_deprecated_headers,
glib_sub_headers,
glib_enumtypes_h,
glib_types_h,
glib_deprecated_sources,
glib_sources,
]
# For API compatibility reasons, GLib-2.0.gir needs to contain the platform
# specific APIs which are also present in the (newer) GLibUnix-2.0.gir and
# GLibWin32-2.0.gir repositories.
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3892#note_2001361
# These can be dropped when GLib next breaks API (i.e. with GLib-3.0.gir).
if host_system == 'windows'
glib_gir_sources += files('../../glib/gwin32.h')
else
glib_gir_sources += files('../../glib/glib-unix.h')
endif
glib_gir = gnome.generate_gir(libglib, glib_gir = gnome.generate_gir(libglib,
sources: [ sources: glib_gir_sources,
gi_gen_shared_sources,
glibconfig_h,
gversionmacros_h,
glib_visibility_h,
glib_headers,
glib_deprecated_headers,
glib_sub_headers,
glib_enumtypes_h,
glib_types_h,
glib_deprecated_sources,
glib_sources,
],
namespace: 'GLib', namespace: 'GLib',
nsversion: '2.0', nsversion: '2.0',
identifier_prefix: gi_identifier_prefix, identifier_prefix: gi_identifier_prefix,
@ -173,19 +186,41 @@ gio_gir_sources = [
contenttype_sources, contenttype_sources,
settings_sources, settings_sources,
] ]
gio_gir_packages = [ 'gio-2.0' ]
gio_gir_args = [ gio_gir_args = [
'-DGIO_COMPILATION', '-DGIO_COMPILATION',
'-DG_SETTINGS_ENABLE_BACKEND', '-DG_SETTINGS_ENABLE_BACKEND',
'--symbol-prefix=gio', '--symbol-prefix=gio',
] ]
# For API compatibility reasons, Gio-2.0.gir needs to contain the platform
# specific APIs which are also present in the (newer) GioUnix-2.0.gir and
# GioWin32-2.0.gir repositories.
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3892#note_2001361
# These can be dropped when GIO next breaks API (i.e. with Gio-3.0.gir).
if host_system == 'windows'
gio_gir_sources += [ gio_win32_include_headers, win32_sources ]
foreach h: gio_win32_include_headers
gio_gir_args += '--c-include=@0@'.format(h)
endforeach
gio_gir_packages += 'gio-win32-2.0'
gio_gir_args += '--pkg=gio-win32-2.0'
else
gio_gir_sources += [ gio_unix_include_headers, unix_sources ]
foreach h: gio_unix_include_headers
gio_gir_args += '--c-include=@0@'.format(h)
endforeach
gio_gir_packages += 'gio-unix-2.0'
gio_gir_args += '--pkg=gio-unix-2.0'
endif
gio_gir = gnome.generate_gir(libgio, gio_gir = gnome.generate_gir(libgio,
sources: gio_gir_sources, sources: gio_gir_sources,
namespace: 'Gio', namespace: 'Gio',
nsversion: '2.0', nsversion: '2.0',
identifier_prefix: gi_identifier_prefix, identifier_prefix: gi_identifier_prefix,
symbol_prefix: gi_symbol_prefix, symbol_prefix: gi_symbol_prefix,
export_packages: [ 'gio-2.0' ], export_packages: gio_gir_packages,
header: 'gio/gio.h', header: 'gio/gio.h',
includes: [ glib_gir[0], gmodule_gir[0], gobject_gir[0] ], includes: [ glib_gir[0], gmodule_gir[0], gobject_gir[0] ],
install: true, install: true,