Commit Graph

11 Commits

Author SHA1 Message Date
Emmanuele Bassi
e7ef715883 build: Add docs.c to the GLib GIR
For historical reasons, some doc blocks are included in an ancillary
file. Add it to the list of sources parsed by g-ir-scanner, to increase
the coverage of various macros.

Fixes: #3372
2024-05-20 13:34:19 +01:00
Philip Withnall
81b16a88d1
girepository: Make gi_repository_find_by_gtype() deterministic
When faced with a `GType` which is present in multiple typelibs, the old
implementation was not deterministic, as it iterated over a hash table
of typelibs. The iteration order of a hash table is not deterministic.

Use the new `ordered_typelibs` and `ordered_lazy_typelibs` arrays to
iterate instead, making the order deterministic.

Add a unit test to check this. In particular, to check that symbols
which are present in both `Gio` and `GioUnix` are correctly resolved as
being from `GioUnix`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3303
2024-05-16 22:47:35 +01:00
Marco Trevisan (Treviño)
caf2f2fbda girepository/introspection: Set asan option only on address sanitizer
It's the only sanitizer failing when generating the introspection data
2024-05-10 04:16:17 +02:00
Marco Trevisan (Treviño)
0eb6c85606 build: Define glib_sanitizers variable to easily get the sanitizers in use
It's an array containing the list of sanitizers in use, normally it
contains a value, but in some cases may have more than one (e.g.
'address' and 'undefined').

And so use it to avoid repeated checks
2024-05-10 02:15:52 +02:00
Marco Trevisan (Treviño)
c78d0ad514 girepository/introspection: Properly check for sanitizer value
The sanitizer option is set to 'none' when not used
2024-05-09 17:51:10 +02:00
Alexander Kanavin
22ec5a96e3 girepository/introspection: correctly install .gir files into custom locations
There is a meson option (gir_dir_prefix), but without being passed in here
the files would always get installed into the default location (datadir).

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2024-04-23 14:21:21 +02:00
Philip Withnall
19308d6c18 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>
2024-02-12 17:54:36 +00:00
Philip Withnall
4314944e56 introspection: Drop Unix and Win32 prefixes from platform specific APIs
So now introspection users will have to call `GLibUnix.open_pipe()`
rather than `GLibUnix.unix_open_pipe()` — or
`GLibWin32.check_windows_version()` rather than
`GLibWin32.win32_check_windows_version()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:36 +00:00
Philip Withnall
5021d002ab introspection: Generate separate GIR files for platform specific APIs
For both GLib and GIO. (GObject, GIRepository and GModule don’t have any
platform specific APIs.)

This is needed for two reasons:
 * If the same GIR file is shipped on multiple platforms, it has no way
   to conditionally define/not-define an API based on the platform (like
   an `#ifdef` in a C header). So we either end up shipping differing
   GIR APIs on different platforms, or shipping a GIR file which
   declares APIs which aren’t resolvable by `dlopen()` on certain
   platforms, and will cause a language runtime error.
 * The API reference documentation is now generated from the GIR, and
   similar problems are present there: if the GIR contains different
   symbols depending on the platform, there is no way to generate API
   documentation for the union of all of them.

The fix is to ensure that there are no conditional symbols in a GIR, by
splitting out the platform specific symbols into platform specific GIR
files. Platform specific documentation can then be generated from these,
in addition to the main, platform agnostic, documentation.

The documentation changes will following in a subsequent commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
0d9170c6b8 gio: Remove unnecessary appinfo_sources variable
There was no obvious logical need to list the `GAppInfo` subclass
sources separately in the build. It makes more sense to add them to the
platform-specific source lists, since they are platform specific.

This will be used in an upcoming commit which generates
platform-specific GIR files, so needs the full platform-specific lists
of sources.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Evan Welsh
f75221c7ea girepository: Move GIR generation into girepository and prior to tests
To enable tests which depend on libgirepository's GIR and typelib,
we need to refactor the order we're currently building these items.

We can also move everything under girepository/ to cleanup the
top-level.
2024-01-30 00:50:40 -06:00