Commit Graph

29878 Commits

Author SHA1 Message Date
Philip Withnall
268871426a gi-inspect-repository: Port to girepository-2.0
Update the code to the latest standards and to use girepository-2.0
after it’s been imported to this repository.

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

Helps: #3155
2024-02-09 20:40:47 +00:00
Philip Withnall
aaed30f3dc gi-decompile-repository: Port to girepository-2.0
Update the code to the latest standards and to use girepository-2.0
after it’s been imported to this repository.

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

Helps: #3155
2024-02-09 20:40:47 +00:00
Philip Withnall
d6d845aee3 docs: Add missing migration guide for gi_repository_get_shared_libraries()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:40:47 +00:00
Philip Withnall
45468f1bb8 docs: Document girepository-2.0 utility program name changes
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:40:46 +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
bb9f69d8b2 Revert "ci: Remove not-printable chars from generated junit file"
This reverts commit 94273b0ebf.

Meson 1.2.0 contains a fix for the underlying issue (in commit
bd3d2cf91894b1f91128011b2cf56a5bd2c326ae), and we now depend on 1.2.0.
So the workaround is no longer needed.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:22:35 +00:00
Philip Withnall
a59499ab0a Merge branch 'no-override-g-ir-compiler' into 'main'
build: Only override g-ir-compiler when GIR generation is enabled

See merge request GNOME/glib!3876
2024-02-09 20:18:39 +00:00
Evan Welsh
e36839818a build: Only override g-ir-compiler when GIR generation is enabled
GLib is used a subproject with GObject Introspection and overriding
this binary breaks that usage. For now we will make overriding the
binary conditional until Meson is updated to handle the binary changes.
2024-02-09 06:56:38 -08:00
Simon McVittie
8a8ce72a7a cmph: Fix a typo
In the project from which this copy of cmph was forked, this was fixed
in version 2.0.2 by commit
bbf77c63c9/

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 14:44:34 +00:00
Philip Withnall
8300b52cbb Merge branch 'wip/smcv/closefrom' into 'main'
glib-unix: Add g_closefrom(), g_fdwalk_set_cloexec()

Closes #3247

See merge request GNOME/glib!3884
2024-02-09 14:06:52 +00:00
Philip Withnall
f9cbd07003 Merge branch 'wip/smcv/pipes' into 'main'
glib/tests/unix: Mostly pass O_CLOEXEC to g_unix_pipe_open()

See merge request GNOME/glib!3911
2024-02-09 13:48:02 +00:00
Philip Withnall
6dea98bac4 glib-unix: Fix reference to FD_CLOEXEC in docs for g_unix_pipe_open()
The docs for this should match the docs for `g_unix_open_pipe()`, which
it calls.

Inspired by !3911.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 13:10:42 +00:00
Simon McVittie
f4afed90e6 tests: Exercise g_fdwalk_set_cloexec() and g_closefrom()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 12:12:29 +00:00
Simon McVittie
82c9a4631d glib/tests/unix: Mostly pass O_CLOEXEC to g_unix_pipe_open()
Using FD_CLOEXEC here is now deprecated. Keep exactly one call with
FD_CLOEXEC, in test_pipe_fd_cloexec().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 11:15:28 +00:00
Philip Withnall
2cacc09398 Merge branch '3231-gir-symbols-cleanup' into 'main'
introspection: Remove various public symbols from newly generated GIRs

Closes #3231

See merge request GNOME/glib!3910
2024-02-09 10:58:29 +00:00
Simon McVittie
a7d5a6b69a gspawn: Simplify set_cloexec
The copy of this function that moved to glib-unix.c still needs to
implement the fdwalk-style interface, but this copy does not, allowing
us to turn it into a very simple syscall wrapper. Its remaining callers
never check for errors, and it never failed anyway, so remove the
returned value.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 10:57:12 +00:00
Simon McVittie
69c1a05ede glib-unix: Add g_closefrom(), g_fdwalk_set_cloexec()
These are the same as Linux `close_range (lowfd, ~0U, 0)` and
`close_range (lowfd, ~0U, CLOSE_RANGE_CLOEXEC)`, but portable.
Unlike some implementations of BSD closefrom(3), they are
async-signal-safe.

The implementations were moved from the GSpawn code, which already
needs all of this functionality anyway, with the exception of
set_cloexec() which was copied (leading to some minor duplication,
but it's very simple).

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3247
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 10:57:12 +00:00
Philip Withnall
e1d603bc3d gslice: Hide g_slice_debug_tree_statistics from introspection
It’s not useful and previously hasn’t been shown in the introspection
API.

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

Fixes: #3231
2024-02-09 10:08:00 +00:00
Philip Withnall
e9c94e8bf3 build: Remove private header files from Meson sources lists
They don’t need to be listed there in order to be built, and doing so
just means they get pulled into the `g-ir-scanner` command for building
`GLib-2.0.gir` and their contents end up being listed as public
introspectable API, which is not what we want.

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

Helps: #3231
2024-02-09 10:06:52 +00:00
Philip Withnall
71801e445e gthreadedresolver: Move private testing symbols to a private header
The symbols still have to be exported from the library (since they’re
called from unit tests), but there was never any reason for them to be
in a public header.

This means they now disappear from `Gio-2.0.gir`.

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

Helps: #3231
2024-02-09 10:05:56 +00:00
Philip Withnall
0701943d9f Merge branch 'moskalets/gapplication/add-version' into 'main'
gapplication: add GApplication:version property

Closes #3198

See merge request GNOME/glib!3889
2024-02-09 10:04:15 +00:00
Maxim Moskalets
cbcb35a77a gapplication: add GApplication:version property
This property is supposed to be used by authors of applications that use GAppliaction to output the version by --version flag or otherwise if a version is needed.

Closes #3198

Signed-off-by: Maxim Moskalets <Maxim.Moskalets@kaspersky.com>
2024-02-09 10:04:14 +00:00
Philip Withnall
59d454a20d Merge branch '3155-quickly-drop-info-type' into 'main'
girepository: Make GIInfoType private

Closes #3155

See merge request GNOME/glib!3906
2024-02-08 22:45:17 +00:00
Philip Withnall
0fa7daad12 Merge branch '3155-import-generate-and-inspect' into 'main'
Import source for g-ir-generate and g-ir-inspect from gobject-introspection.git

Closes #55

See merge request GNOME/glib!3907
2024-02-08 15:20:50 +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
Philip Withnall
931931d8f1 girepository: Add SPDX lines to newly imported tools
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-08 14:01:57 +00:00
Christoph Reiter
c24a174437 Add a --version option to g-ir-compiler and g-ir-generate. Fixes #55 2024-02-08 13:53:59 +00:00
Christoph Reiter
4c150f199e build: enable -Wshadow 2024-02-08 13:53:59 +00:00
Christoph Reiter
d70551e624 g-ir-generate: fix missing error handling for command line parsing
The error arg was used but the result never checked.
2024-02-08 13:53:59 +00:00
Chun-wei Fan
ea917797bb g-ir-inspect: Ensure variables are at the top of block
We did not yet advertise C99 requirements for G-I yet, so let's not
assume this yet.
2024-02-08 13:53:59 +00:00
Ting-Wei Lan
55bca7b445 g-ir-{compiler,generate,inspect}: Call setlocale in main function
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760419
2024-02-08 13:53:59 +00:00
Igor Gnatenko
43d2206bcf g-ir-inspect: make description for --version a bit better
Reported-and-tested-by: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Reviewed-by: Colin Walters <walters@verbum.org>
2024-02-08 13:53:59 +00:00
Igor Gnatenko
68162605ba g-ir-inspect: remove last usage of g_autoptr()
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=769600
2024-02-08 13:53:59 +00:00
Igor Gnatenko
77e08288a5 g-ir-inspect: Inspect GI typelibs
Various distributions (mainly RPM based so far) make use of automatic
dependencies extracted from typelib files (they can require other typelibs
and also shared libraries)

Current features
* Print used shared libraries
* Print used typelib dependencies

Based-on-patch-by: Dominique Leuenberger <dimstar@opensuse.org>
Reference: https://bugzilla.gnome.org/show_bug.cgi?id=665672
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2024-02-08 13:53:59 +00:00
Colin Walters
42654f0979 Drop calls to g_type_init()
And bump our GLib requirement.
2024-02-08 13:53:59 +00:00
Colin Walters
4dc7b03bce Add Emacs mode lines to C sources 2024-02-08 13:53:59 +00:00
Johan Dahlin
dac19120aa [GIRepository] Rename GTypelib to GITypelib
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2024-02-08 13:53:59 +00:00
Colin Walters
a52046e847 Fix two compilation warnings 2024-02-08 13:53:59 +00:00
Colin Walters
4bf5ef6bd7 [girepository] Actually verify header of loaded typelibs in g_irepository_require
Take a GError * for typelib loading code, validate the header.  This
fixes bizarre errors from gjs where g_irepository_require would happily
load old typelibs.
2024-02-08 13:53:59 +00:00
Johan Dahlin
a01e97f46f [girwriter] Refactor out of generate.c
Move out the girwriter out of generate.c. Still a private API,
but that will probably change in the future.
2024-02-08 13:53:59 +00:00
Johan Dahlin
af10e6bd6e [generate] Get rid of globals
Get rid of all globals in gir generator, in preparation for
moving all code into libgirepository
2024-02-08 13:53:59 +00:00
Johan Dahlin
ccdceb1e09 [gtypelib.ch] Rename to gitypelib.ch
Rename gtypelib.h -> gitypelib-internal.h and rename
gtypelib.c to gitypelib.c
2024-02-08 13:53:59 +00:00
Johan Dahlin
a9a3352d8a [g-ir-generate] Write out array type
For GLib arrays, write out the array type to the tgir
2024-02-08 13:53:59 +00:00
Colin Walters
ecd9c2f3e7 Support (out caller-allocates)
People have wanted support for marking (out) on functions of the
form:

/**
 * clutter_color_from_pixel:
 * @pixel: A pixel
 * @color: (out): Color to initialize with value of @pixel
 */
void
clutter_color_from_pixel (guint32 pixel, ClutterColor *color);

Where the caller is supposed to have allocated the argument; the
C function just initializes it.  This patch adds support for this
argument passing style to introspection.  In this case, we see the
(out), and notice that there's only a single indirection (*) on
the argument, and assume that this means (out caller-allocates).

https://bugzilla.gnome.org/show_bug.cgi?id=604749
2024-02-08 13:53:59 +00:00
Johan Dahlin
320dd66c62 Add support for foreign structs
Foreign structs are special in the sense that there might
be native bindings (for instance PyCairo for PyGI) that provides
the same functionallity as the introspected variant.

https://bugzilla.gnome.org/show_bug.cgi?id=610357
2024-02-08 13:53:59 +00:00
Johan Dahlin
567a6d2195 Remove trailing whitespace 2024-02-08 13:53:59 +00:00
Tomeu Vizoso
90c166144c Implement callbacks as part of struct fields. Fixes #557383
gir: embed <callback> inside <field>
typelib: if a field contains a callback, store it just after the FieldBlob
girepository API: no additions
2024-02-08 13:53:59 +00:00
Andreas Rottmann
7a6056cbeb Bug 576605 - Get rid of GI_SCOPE_TYPE_OBJECT
Remove support for (scope object) as it lacks a real use case.
2024-02-08 13:53:59 +00:00
Colin Walters
f979d003ce Bug 564016 - Include c:prefix in typelib, use it to optimize find_by_gtype
Parse the c:prefix from the .gir, include it in the header.  Armed with this
information, we can now optimize lookups of GTypes because we
have the requirement that GTypes must start with the c:prefix.  We do
fall back though if a lookup fails.
2024-02-08 13:53:59 +00:00
Colin Walters
02bb4f8d6a Bug 557383 - Virtual method support
Broadly speaking, this change adds the concept of <vfunc> to the .gir.
The typelib already had most of the infrastructure for virtual functions,
though there is one API addition.

The scanner assumes that any class callback slot that doesn't match
a signal name is a virtual.  In the .gir, we write out *both* the <method>
wrapper and a <vfunc>.  If we can determine an association between
them (based on the names matching, or a new Virtual: annotation),
then we notate that in the .gir.

The typelib gains an association from the vfunc to the function, if
it exists.  This will be useful for bindings since they already know
how to consume FunctionInfo.
2024-02-08 13:53:59 +00:00