gi-decompile-typelib(1)
π gi-decompile-typelib β the GIR decompiler, bestie edition π
okay so picture this: you've got a compiled binary typelib and you're like "what's in there??" and this little icon (part of the General Commands Manual crew, hi) will literally crack it open for you. she's a typelib decompiler and she ate. let's get into it π¦
β¨ SYNOPSIS β¨
gi-decompile-typelib [OPTIONβ¦] TYPELIB [TYPELIBβ¦]
yes queen, you can pass more than one TYPELIB. plural. we love that for us π
πΈ DESCRIPTION πΈ
So gi-decompile-typelib is a GIR decompiler, and she does it using the repository API (iykyk). She takes the compiled binary typelib format and turns it back into GIR XML files. Iconic behavior honestly.
Where does the output go? Straight to standard output, bestie β unless you pass --output, in which case it goes wherever you told it to. Main character energy: she does NOT ask twice.
Now the tea β (sad tea, not fun tea): the binary typelib format only stores a subset of the info that's available in GIR XML. So not every typelib can be decompiled this way, and even when it works, the resulting GIR XML might be incomplete. It's giving "found footage" β you get the vibes but not the whole lore. π
Also, real talk: normally you should be generating GIR XML from source code, headers and shared libraries using g-ir-scanner(1) instead of using this tool. Like, that's the intended route. This one is the emergency route. No cap.
π«Ά Debian girlies, listen up: on Debian-derived systems, each architecture ships a version ofgi-decompile-typelibprefixed with theDEB_HOST_GNU_TYPEfromdpkg-architecture(1), for examplearm-linux-gnueabihf-gi-decompile-typelib. Those architecture-prefixed names use the appropriate search paths for that architecture, and you should use them when cross-compiling. The full details live in/usr/share/doc/gobject-introspection/README.Debian.gz. Go read it, it's a whole mood.
π OPTIONS π
--helpβ Show help options. (a classic, the "hello??" button)--output FILENAME,-o FILENAMEβ Save the resulting output in FILENAME. Instead of screaming into stdout, she writes to a file. Very demure.--includedir DIRECTORYβ Add DIRECTORY to the search path for typelibs. You can use this option more than once (stack 'em up π). The first DIRECTORY on the command-line will be searched first β that means highest precedence, so order matters, don't play with her.--allβ Show all available information. Everything. The full lore drop. β¨--versionβ Show program's version number and exit. Then she's gone, bye π¨
π EXAMPLE π
here's the example, copied exactly as she appears in the wild (yes, including the little docs-build meltdown in the middle β the source file was not having a good day, and we respect the honesty):
:: $ libdir=/usr/lib/x86_64-linux-gnu # or /usr/lib64 or similar
$ gi-decompile-typelib -o Gio-2.0.gir
System Message: ERROR/3 (../../../docs/reference/girepository/gi-
decompile-typelib.rst:, line 93)
Unexpected indentation.
$libdir/girepository-1.0/Gio-2.0.typelib
$ diff -u /usr/share/gir-1.0/Gio-2.0.gir Gio-2.0.gir
then run that diff -u /usr/share/gir-1.0/Gio-2.0.gir Gio-2.0.gir and you will see for yourself that the original GIR XML contains much more information than the decompiled typelib. she's doing her best, okay?? π€ the original is just built different.
π BUGS π
Found a bug? Report it at <https://gitlab.gnome.org/GNOME/glib/-/issues>. Be nice, be specific, include the details. π«Ά
π§ HOMEPAGE and CONTACT π§
<https://gi.readthedocs.io/> β go, click, absorb, slay.
β AUTHORS β
- Matthias Clasen π
and that's the whole page babes. this one came to you from the General Commands Manual section, and the absolute legend who wrote the page we just read is named right up there. now go decompile something and text me how it went ππ
π¦ where this page comes from
- ubuntu stonking: girepository-tools 2.90.0-1 Β· LGPL-2.1-or-later
- π the page's license: LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms