G-IR-SCANNER(1)
β¨ G-IR-SCANNER(1) β¨
okay bestie, pull up a chair, because we're talking about g-ir-scanner from the manual, section 1 π
this is the little build-step icon that turns your C headers into GIR XML magic, and honestly? she's doing the most so your language bindings don't have to π«Ά
πΈ NAME πΈ
g-ir-scanner β extracting C metadata from sources and headers β¨
π SYNOPSIS π
g-ir-scanner [OPTION...] FILES...
π¦ DESCRIPTION π¦
so g-ir-scanner is the tool that generates GIR XML files, and the way she does it is by parsing headers and introspecting GObject based libraries π§ like, she reads your C code and writes out the whole vibe.
she's normally invoked during the regular build step of a project, and the info she spits out gets saved to disk and installed later β that way language bindings and other applications can come along and actually use it π
you pass header files and source files in as arguments on the command line. the suffix is what decides how a file gets treated:
.cβ treated as a source file.hβ treated as a header file
and ngl, currently only C based libraries are supported by the scanner. that's the whole menu, bestie π
π OPTIONS π
--helpβ show help options π₯°--quietβ if you pass this, she will not print details of normal operation. silence is golden, periodt.--warn-allβ display warnings for public API which is not introspectable π--warn-errorβ makes warnings be fatal errors. scary but iconic.--strictβ display warnings for strict introspectable API π₯--format=FORMATβ this parameter decides which resulting format will be used. the default value isgir.--include=NAMEβ add the specified introspection dependency to the scanned namespace.NAMEis of the formNAMESPACE-VERSION, likeGtk-3.0π--include-uninstalled=PATHβ add the specified introspection dependency to the scanned namespace. this differs from--includein that it takes a file path, and does not process thepkg-configdependencies (since they may not be installed yet) π--add-include-path=PATHβ add a directory to the path which the scanner uses to find GIR files. can be used multiple times to specify multiple directories β¨-i,--library=LIBRARYβ specifies a library that will be introspected. this means the*_get_type()functions in it will be called for GObject data types. the name of the library should not contain the leadinglibprefix nor the ending shared library suffix π-L,--library-path=PATHβ include this directory when searching for a library. this option can be specified multiple times to include more than one directory to look for libraries in π-Idirectoryβ include this directory in the list of directories to be searched for header files. you need to pass to the scanner all the directories you'd normally pass to the compiler when using the specified source files. no gatekeeping, give her everything π«Ά--c-include=C_INCLUDESβ headers which should be included in C programs. this option can be specified multiple times to include more than one header πΈ-n,--namespace=NAMEβ the namespace name. this name should be capitalized, eg the first letter should be upper case. examples:Gtk,Clutter,WebKitπ--no-libtoolβ disable usage of libtool for compiling stub introspection binary. use this if your build system does not require libtool π--libtoolβ full path to libtool executable. typically used for Automake systems.--nsversion=VERSIONβ the namespace version. for instance1.0. this is usually the platform version, eg2.0for Gtk+, not2.12.7. read that again bestie π-p,--program=PROGRAMβ specifies a binary that will be introspected. this means the*_get_type()functions in it will be called for GObject data types. the binary must be modified to take a--introspect-dump=option, and to pass the argument to this function tog_irepository_dump. yes, you have to do surgery on your binary, she doesn't make the rules π§--program-arg=ARGβ additional argument to pass to program for introspection.--identifier-prefix=PREFIXβ this option may be specified multiple times. each one gives a prefix that will be stripped from all C identifiers. if none specified, the namespace will be used. eg, an identifier prefix ofFoowill export the identifiertypdef struct _FooBar FooBar;asFoo.Barβ¨--symbol-prefix=PREFIXβ this option may be specified multiple times. each one gives a prefix that will be stripped from all C symbols. eg, an symbol prefix offoowill export the symbolfoo_bar_do_somethingasFoo.Bar.do_somethingπ--accept-unprefixedβ if specified, the scanner will accept identifiers and symbols which do not match the namespace prefix. try to avoid using this if possible π (she said it, not me)--output=FILENAMEβ name of the file to output. normally namespace + format extension. eg,GLib-2.0.gir.--pkg=PACKAGEβ list ofpkg-configpackages to get compiler and linker flags from. this option can be specified multiple times to include flags from severalpkg-configpackages π--pkg-export=PACKAGEβ list ofpkg-configpackages that are provided by the generated gir. this option can be specified multiple times if the gir provides more packages. if not specified, the packages specified with--pkg=will be used π--compiler=COMPILERβ the C compiler to be used internally byg-ir-scannerwhen introspecting the run time type information, like properties, signals, ancestors, and implemented interfaces. it has the same semantics as theCCenvironment variable β--verboseβ be verbose, include some debugging information. spill the tea, girl π
π ENVIRONMENT VARIABLES π
g-ir-scanner uses the XDG_DATA_DIRS variable to check for dirs β the girs are located in XDG_DATA_DIRS/gir-1.0. it's normally set on a distribution so you shouldn't need to set it yourself, bestie, don't touch it π
the variable GI_SCANNER_DISABLE_CACHE ensures that the scanner will not write cache data to $HOME π«
the variable GI_SCANNER_DEBUG can be used to debug issues in the build-system that involve g-ir-scanner. when it is set to save-temps, then g-ir-scanner will not remove temporary files and directories after it terminates π (super handy, super messy)
the variable GI_HOST_OS can be used to control the OS name on the host that runs the scanner. it has the same semantics as the Python os.name property π
the variable GI_CROSS_LAUNCHER can be used to wrap the GType introspection binary generated by g-ir-scanner before executing it. it is useful when generating introspection data in a cross-compilation environment π
π BUGS π
report bugs at
https://gitlab.gnome.org/GNOME/gobject-introspection/issues
(be nice, and be specific, she's trying her best π)
π HOMEPAGE AND CONTACT π
https://gi.readthedocs.io/
π AUTHORS π
Johan Dahlin
and that's the whole page, bestie π this was the g-ir-scanner manual from the G-IR-SCANNER(1) page in section 1 of the manual set β huge shoutout to her for showing up and showing out, no cap π«Άβ¨
π¦ where this page comes from
- alpine 3.22: gobject-introspection-doc 1.84.0-r0 Β· LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT
- alpine 3.23: gobject-introspection-doc 1.86.0-r0 Β· LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT
- alpine 3.24: gobject-introspection-doc 1.86.0-r1 Β· LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT
- arch rolling: gobject-introspection 1.86.0-2 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 10: gobject-introspection-devel 1.79.1-7.el10 Β· GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause
- debian bookworm: gobject-introspection 1.74.0-3 Β· GPL-2.0-or-later
- debian trixie: gobject-introspection-bin 1.84.0-1 Β· GPL-2.0-or-later
- fedora 43: gobject-introspection-devel 1.84.0-3.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause
- fedora 43: gobject-introspection-devel 1.84.0-3.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause
- fedora 44: gobject-introspection-devel 1.86.0-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause
- fedora 44: gobject-introspection-devel 1.86.0-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause
- nixpkgs unstable: gobject-introspection 1.86.0
- opensuse-leap 16.0: gobject-introspection 1.84.0-160000.2.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: gobject-introspection 1.84.0-160000.2.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: gobject-introspection 1.84.0-160000.2.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: gobject-introspection 1.84.0-160000.2.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: gobject-introspection 1.72.0-1 Β· GPL-2.0-or-later
- ubuntu noble: gobject-introspection-bin 1.80.1-1 Β· GPL-2.0-or-later
- ubuntu questing: gobject-introspection-bin 1.84.0-1
- ubuntu resolute: gobject-introspection-bin 1.86.0-6build1 Β· GPL-2.0-or-later
- ubuntu stonking: gobject-introspection-bin 1.86.0-6build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms