Commit Graph

29 Commits

Author SHA1 Message Date
Philip Withnall
06a7258a8c girepository: Add g_autoptr() and g_auto() support
This should make the code a bit more usable in situations where people
aren’t potentially using MSVC.

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

Helps: #3255
2024-02-14 11:54:48 +00:00
Philip Withnall
3a7dfb14c6 Merge branch '3245-boxed-info-typing' into 'main'
gibaseinfo: Stop building GIBoxedInfo instances and use gi_registered_type_info_is_boxed() instead

Closes #3245

See merge request GNOME/glib!3905
2024-02-12 14:11:36 +00:00
Marco Trevisan
730a348574 Merge branch '3244-typelib-path' into 'main'
girepository: Export builddir typelib and GIR paths

Closes #3244

See merge request GNOME/glib!3880
2024-02-12 13:45:00 +00:00
Philip Withnall
f51398af91 girepository: Drop GIBoxedInfo
See the previous commit for details.

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

Helps: #3245
2024-02-12 13:17:04 +00:00
Philip Withnall
5c3c2cf6b3 girepository: Rename g-ir-generate and g-ir-inspect
Rename them to `gi-decompile-repository` and `gi-inspect-repository` to
match the existing `gi-compile-repository`. The names have to differ
from those used in girepository-1.0 to avoid collisions.

‘generate’ has been changed to ‘decompile’ because it does the inverse
of what `gi-compile-repository` does: it converts a typelib to a GIR
file. ‘generate’ never really made much sense for this anyway — it’s
almost a synonym of ‘compile’.

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

Helps: #3155
2024-02-09 20:40:17 +00:00
Philip Withnall
57c02e4c07 girepository: Export builddir typelib and GIR paths
These can then be used by a parent project if GLib is used as a Meson
subproject.

In particular, GJS wants to use `GLib-2.0.typelib`
from GLib-as-a-subproject, but doesn’t want to hardcode the path to it
inside the GLib builddir.

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

Fixes: #3244
2024-02-08 15:17:18 +00:00
Evan Welsh
5d997cad03 girepository: Update gi-compile-repository and use it to compile GIRs
Adapt gi-compile-repository sources to compile against the updated
libgirepository that is included with GLib.

This also renames "g-ir-compiler" to "gi-compile-repository" to avoid
overwriting the existing binary and to simplify the binary name going
forward.
2024-01-31 11:13:16 +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
Simon McVittie
25ec19723c girepository: Exclude private symbols from the ABI
This removes the gthash utility functions from the ABI, so link those
into their automated test statically.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-19 12:07:30 +00:00
Philip Withnall
7228c6d3e0 giboxedinfo: Add a tag type for boxed types
Boxed types are already represented within `GIInfoType`, so they should
have a `GType` representation as well.

In an upcoming commit, this will allow us to represent the subtype
relation between `GIBoxedInfo` and `GIRegisteredTypeInfo` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
eafc35e5ed gienuminfo: Split out GIFlagsInfo as a derived type
Flag enums are already treated as a special kind of enum within
`GIInfoType`, so it would be tidier to give it its own `GType` too, with
a subtype relation to `GI_TYPE_ENUM_INFO`.

This will simplify implementing `GI_IS_ENUM_INFO` in a following commit
too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9377a0dd54 girepository: Split GIValueInfo out of gienuminfo.c
It’s a separate type, so it would be less confusing if it were in its
own file.

This doesn’t change any API.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-18 13:15:22 +00:00
Philip Withnall
a35c6f764d girepository: Re-number GIR file from 2.0 to 3.0
The library shipped by gobject-introspection.git was
`libgirepository-1.0.so`, but for some reason (accident?), it was
accompanied by `GIRepository-2.0.gir`. That’s been the case for the last
6 years.

In moving libgirepository to glib.git, we’ve bumped the version to
`libgirepository-2.0.so`, and have changed the API.

In order to avoid a collision between the new `GIRepository-2.0.gir` and
the old `GIRepository-2.0.gir`, we can either:
 * Rename the basename of the library (confusing).
 * Re-version the whole thing to 3.0 (would mean it’s completely out of
   sync with the rest of glib.git, and would lead to build system
   misery).
 * Re-version only the GIR file (a bit confusing, but hopefully less
   confusing).

So I’ve done the final option: glib.git now ships
`libgirepository-2.0.so` and `GIRepository-3.0.gir`. This avoids
collisions with what’s shipped by gobject-introspection.git, while
hopefully still making some sense.

We considered using version number 2.1 rather than 3.0, but decided
against it because that makes it look like it’s compatible with version
2.0, which it isn’t.

Note that none of these changes touch the
`${prefix}/lib/girepository-1.0` and `${prefix}/share/gir-1.0`
directories. The version numbers in those refer to the versions of the
GIR and typelib file formats, which have not changed.

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

Helps: #3155
2023-12-22 12:21:57 +00:00
Marco Trevisan (Treviño)
2fbe6ca53e cleanup: Add missing final ending line to meson girrepository files 2023-12-21 03:02:27 +01:00
Philip Withnall
989f87d26a build: Ensure gi-visibility.h is built before libgirepository_dep is used
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-19 18:41:02 +00:00
Philip Withnall
e699037fef girepository: Add a couple of very simple unit tests
For the moment, this is enough to roughly verify that the port to
`GTypeInstance` has not massively broken things. It’s not anywhere near
sufficient to qualify as a proper test suite though.

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

Helps: #3155
2023-12-12 16:58:27 +00:00
Philip Withnall
76a70381d4 girepository: Rename meson variables for consistency
If they’re all named after the actual library name, rather than a
contraction of it, that’s easier to remember so they can be easily
referenced elsewhere in the build system (such as when adding unit
tests).

This introduces no functional changes.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
52ac467426 girepository: Port GIBaseInfo to GTypeInstance
This adds more type safety to libgirepository, and allows
differentiating the `GIBaseInfo` derived types using the type system.

Two new derived types had to be added (previously they were just a
collection of helper methods which worked directly on a `GIBaseInfo` and
didn’t check types): `GICallbackInfo` and `GIUnresolvedInfo`.

Further cleanups and refactoring might be needed on this, but the core
of libgirepository now uses `GTypeInstance` and appears to still work
(it’s difficult to be entirely sure because there are no unit tests
yet).

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Emmanuele Bassi
cf28391d5b gir: Build introspection data for libgirepository
We currently add the GI and gi prefixes, but outside of visibility
macros we should move every identifier to the G namespace.
2023-12-12 16:58:04 +00:00
Emmanuele Bassi
ebb0346380 gir: Do not include builtin directories in pkgconfig.generate()
It's deprecated since Meson 0.62, and breaks the build with fatal
warnings enabled for Meson.
2023-11-08 12:04:12 +00:00
Philip Withnall
dda97fea98 girepository: Ensure gi-visibility.h is built before girepository-internals
It gets transitively included.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:41:05 +01:00
Philip Withnall
9103eae11f build: Add missing builddir include to libgirepository-internals
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:35:05 +01:00
Philip Withnall
f0e11e82d3 girepository: Various fixes to symbol visibility and compilation defines
To make the setup in libgirepository match that in libgio.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:30:38 +01:00
Philip Withnall
3c89fe9d03 build: Add missing builddir include to libgirepository-gthash
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:03:45 +01:00
Philip Withnall
a6df2ec312 girepository: Ensure gi-visibility.h is built before gthash.c
`gthash.c` transitively includes it.

Most of this commit is just moving variables around so `gi_visibility_h`
is defined early enough in the file. The moved code has not been changed.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:02:52 +01:00
Philip Withnall
4dcd044b02 build: Add missing builddir include to libgirepository
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 17:28:37 +01:00
Philip Withnall
e30f8ac0a1 girepository: Add remaining license/copyright SPDX headers
These are all custom-written, including a load of research in `git log`
to find the copyright holders for `girepository/meson.build` and
`girepository/gi-dump-types.c`.

With this, `reuse lint` raises no complaints about the `girepository/`
directory.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 17:12:25 +01:00
Emmanuele Bassi
af36393e60 Build libgirepository as a GLib sub-library
The introspection API has lived out of tree far too long. It has the
same ABI guarantees as the rest of GLib, so it has no reason to be split
from the main library.

The gobject-introspection project can depend on libgirepository, and the
language bindings can drop the gobject-introspection-1.0 dependency.
2023-10-16 15:24:08 +01:00
Emmanuele Bassi
03d6c16434 Move girepository 2023-10-15 17:56:05 +01:00