Move the GLib type system into libglib

The type system should have never been relegated to libgobject: it's a low
level API to register types at run time.

Having GType inside libglib allows us to use the type system information
everywhere:

- generic but type safe storage data types
- explicit memory management semantics for all data types
- enumeration types for all flags

Having the type system inside libglib also allows us to create new and
better fundamental types in the future, like sum types, option types,
tuples, and generic types.

Moved:

- gatomicarray
- gboxed
- genums
- gtype
- gtypeplugin
- gvalue

The move is mostly Git surgery, but given the amount of internal API
surface, it results in a single commit to avoid breaking bisectability.

We need to maintain `gobject/gvaluecollector.h` as a publicly installed
header but, to avoid issues in case of excessive inclusions, we make it
conflict with `glib/gvaluecollector.h`.

See: #2370

See: https://discourse.gnome.org/t/straw-man-moving-the-gtype-api-down-to-libglib-2-0/11169
This commit is contained in:
Emmanuele Bassi
2025-01-03 22:56:56 +00:00
parent 68388cf7f7
commit 3c53fb8790
46 changed files with 922 additions and 607 deletions

View File

@@ -2,12 +2,9 @@ gobject_includedir = glib_includedir / 'gobject'
gobject_install_headers = files(
'gobject-autocleanups.h',
'glib-types.h',
'gbinding.h',
'gbindinggroup.h',
'gboxed.h',
'gclosure.h',
'genums.h',
'gmarshal.h',
'gobject.h',
'gparam.h',
@@ -15,13 +12,9 @@ gobject_install_headers = files(
'gsignal.h',
'gsignalgroup.h',
'gsourceclosure.h',
'gtype.h',
'gtypemodule.h',
'gtypeplugin.h',
'gvalue.h',
'gvaluearray.h',
'gvaluecollector.h',
'gvaluetypes.h',
'gobjectnotifyqueue.c', # sic
)
@@ -38,12 +31,9 @@ gobject_sources += gobject_visibility_h
install_headers(gobject_install_headers, install_dir : gobject_includedir)
gobject_sources += files(
'gatomicarray.c',
'gbinding.c',
'gbindinggroup.c',
'gboxed.c',
'gclosure.c',
'genums.c',
'gmarshal.c',
'gobject.c',
'gparam.c',
@@ -51,13 +41,8 @@ gobject_sources += files(
'gsignal.c',
'gsignalgroup.c',
'gsourceclosure.c',
'gtype.c',
'gtypemodule.c',
'gtypeplugin.c',
'gvalue.c',
'gvaluearray.c',
'gvaluetransform.c',
'gvaluetypes.c',
)
if host_system == 'windows' and glib_build_shared
@@ -134,10 +119,6 @@ glib_enumtypes_c = custom_target('glib_enumtypes_c',
'--template', files('glib-enumtypes.c.template'),
'@INPUT@'])
# Expose as variable to be used by gobject-introspection
# when it includes GLib as a subproject
glib_types_h = files('glib-types.h')
libgobject = library('gobject-2.0',
gobject_dtrace_obj, gobject_dtrace_hdr, glib_enumtypes_h, glib_enumtypes_c,
sources : gobject_sources,