gi-decompile-typelib(1)

πŸ“¦
version 2.90.0 Β· 3 versions
, in ubuntu stonking

πŸ’– 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 of gi-decompile-typelib prefixed with the DEB_HOST_GNU_TYPE from dpkg-architecture(1), for example arm-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