G-IR-SCANNER(1)

πŸ“¦
version 1.86.0 Β· 2 versions
  • 1.86.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.68.0 Β· centos-stream 9
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 is gir.
  • --include=NAME β€” add the specified introspection dependency to the scanned namespace. NAME is of the form NAMESPACE-VERSION, like Gtk-3.0 🌈
  • --include-uninstalled=PATH β€” add the specified introspection dependency to the scanned namespace. this differs from --include in that it takes a file path, and does not process the pkg-config dependencies (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 leading lib prefix 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 instance 1.0. this is usually the platform version, eg 2.0 for Gtk+, not 2.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 to g_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 of Foo will export the identifier typdef struct _FooBar FooBar; as Foo.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 of foo will export the symbol foo_bar_do_something as Foo.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 of pkg-config packages to get compiler and linker flags from. this option can be specified multiple times to include flags from several pkg-config packages πŸ’–
  • --pkg-export=PACKAGE β€” list of pkg-config packages 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 by g-ir-scanner when introspecting the run time type information, like properties, signals, ancestors, and implemented interfaces. it has the same semantics as the CC environment 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