Building gobject-introspection
==============================

Let's see what happens when building GLib-2.0.gir:

1) Makefile-gir.am sets GLIB_LIBRARY=libglib-2.0-0 and
   GOBJECT_LIBRARY=libgobject-2.0-0, then
   GLib_2_0_gir_LIBS = $(GLIB_LIBRARY) $(GOBJECT_LIBRARY)

2) Makefile.introspection computes _gir_libraries based
   on Glib_2_0_gir_LIBS. So _gir_libraries is set to
   "--library=libglib-2.0-0 --library=libgobject-2.0-0"

3) The value of _gir_libraries is passed as argument to g-ir-scanner

4) scannermain.py:scanner_main() takes these arguments, pulls
   them through an optparse.OptionParser() instance and stores
   the result in the options and args variables

5) scannermain.py:scanner_main() goes on to eventually pass the
   options variable to create_binary(transformer, options, args)
   which in turn calls...

6) ...resolve_shlibs(options, binary, libraries)
   Here it is determined that both "libgobject-2.0-0" and
   "libglib-2.0-0" are not ".la" files, so they get shoved into
   the "non_libtool" list and passed to
   _resolve_non_libtool(options, binary, libraries)

There is no fully functional and Free(!) ldd alternative
that I know of. To be precise, these tend to come and go, are 
never properly maintained and always buggy. The last promising
attempt I'm aware of was https://github.com/LRN/ntldd
which seems to have slowly passed into oblivion after the
initial announcement.

Now what? Well, all shared libraries containing code we're
ever likely to introspect have been built with libtool. And
thus are named as we would expect them to be named, so we
have libgobject-2.0-0, libglib-2.0-0, etc

Just have a peek inside the bin directory of the latest GTK+
bundle. So simply append ".dll" to the library name and
be done with it. Eureka!

But probably only for the MinGW case as this assumption will
only hold when the entire stack is built to follow these naming
rules. No idea how a VS build looks like, but we'll probably
find out soon as I've talked to Fan this morning -he expressed
interest in building g-i and PyGObject with VS- but we ran out of
time to address this specific issue. So we'll probably need to revisit
this depending on what he has to say about the VS case...

Here's what the relevant parts of the build log looks like, with
stategically placed print statements, and cleaned up in an
attempt to at least keep some of our sanity:

echo   --verbose -I/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src --add-include-path=/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src --add-include-path=/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src/gir --add-include-path=. --add-include-path=. --namespace=GLib --nsversion=2.0 --libtool="./libtool" --pkg=glib-2.0    --library=libglib-2.0-0 --library=libgobject-2.0-0 --external-library --reparse-validate --identifier-prefix=G --symbol-prefix=g --symbol-prefix=glib --c-include="glib.h"  -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0 -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include -DGETTEXT_PACKAGE=Dummy -DGLIB_COMPILATION -D__G_I18N_LIB_H__  d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include/glibconfig.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/galloca.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/garray.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gasyncqueue.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gatomic.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gbacktrace.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gbase64.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gbitlock.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gbookmarkfile.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gcache.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gchecksum.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gcompletion.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gconvert.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gdataset.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gdate.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gdatetime.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gdir.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gerror.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gfileutils.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/ghash.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/ghmac.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/ghook.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/ghostutils.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gi18n-lib.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gi18n.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/giochannel.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gkeyfile.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/glist.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmacros.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmain.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmappedfile.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmarkup.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmem.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gmessages.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gnode.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/goption.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gpattern.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gpoll.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gprimes.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gprintf.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gqsort.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gquark.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gqueue.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/grand.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gregex.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/grel.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gscanner.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gsequence.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gshell.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gslice.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gslist.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gspawn.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gstdio.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gstrfuncs.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gstring.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gtestutils.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gthread.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gthreadpool.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gtimer.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gtimezone.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gtree.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gtypes.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gunicode.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gurifuncs.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gutils.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gvariant.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gvarianttype.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/glib/gwin32.h d:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0/gobject/glib-types.h /d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src/gir/glib-2.0.c g-ir-scanner g-ir-compiler.exe --output GLib-2.0.gir > g-ir-scanner.args
PATH=.:.libs:/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/dist/bin:/d/dev/gnome.org/gnome-windows/checkout/glib/git/dist/bin:/d/dev/gnome.org/gnome-windows/checkout/libffi/libffi-3.0.10rc8-1-win32/dist/bin:/d/bin/Python27:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/cairo-1.10.2-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/libpng-1.4.3-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/fontconfig-2.8.0-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/freetype-2.4.4-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/pkg-config-0.26-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/gettext-tools-0.18.1.1-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/gettext-runtime-0.18.1.1-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/zlib-1.2.5-2/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem env PATH=.libs:/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/dist/bin:/d/dev/gnome.org/gnome-windows/checkout/glib/git/dist/bin:/d/dev/gnome.org/gnome-windows/checkout/libffi/libffi-3.0.10rc8-1-win32/dist/bin:/d/bin/Python27:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/cairo-1.10.2-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/libpng-1.4.3-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/fontconfig-2.8.0-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/freetype-2.4.4-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/pkg-config-0.26-1/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/gettext-tools-0.18.1.1-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/gettext-runtime-0.18.1.1-2/bin:/d/dev/gnome.org/gnome-windows/checkout/legacynativebuilds/devel/dist/win32/zlib-1.2.5-2/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem LPATH=.libs PYTHONPATH=.:/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src UNINSTALLED_INTROSPECTION_SRCDIR=/d/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src UNINSTALLED_INTROSPECTION_BUILDDIR=. ./g-ir-scanner --args-file=g-ir-scanner.args
g-ir-scanner: compile: gcc -mthreads -mms-bitfields -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0 -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include -Id:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0 -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0 -Id:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include -c -o d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0.o d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0.c
g-ir-scanner: link: ./libtool --mode=link --tag=CC gcc -mthreads -o d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0exe -export-all-symbols -Ld:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib -Ld:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/../bin -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lglib-2.0 -lgobject-2.0 d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0.o
libtool: link: gcc -mthreads -o d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0exe -export-all-symbols d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/build/tmp-introspectvkesb6/GLib-2.0.o  -Ld:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib -Ld:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/../bin -lgio-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lgobject-2.0 -mthreads
* resolve_shlibs(options, binary, libraries)
* options    : {'': None,
                'external_library': True,
                'verbose': True,
                'cpp_defines': ['GETTEXT_PACKAGE=Dummy',
                                'GLIB_COMPILATION',
                                '__G_I18N_LIB_H__'],
                'accept_unprefixed': False,
                'identifier_prefixes': ['G'],
                'symbol_prefixes': ['g', 'glib'],
                'libraries': ['libglib-2.0-0', 'libgobject-2.0-0'],
                'library_paths': [],
                'nolibtool': False,
                'format': 'gir',
                'typelib_xml': None,
                'program': None,
                'namespace_version': '2.0',
                'c_includes': ['glib.h'],
                'cpp_undefines': [],
                'reparse_validate_gir': True,
                'includes_uninstalled': [],
                'strip_prefix': None,
                'includes': [],
                'm_option': [],
                'include_paths': ['d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src',
                                  'd:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src/gir',
                                  '.',
                                  '.'],
                'warn_fatal': None,
                'args_file': None,
                'test_codegen': None,
                'packages': ['glib-2.0'],
                'namespace_name': 'GLib',
                'program_args': [],
                'libtool_path': './libtool',
                'init_sections': [],
                'quiet': False,
                'packages_export': [],
                'warn_all': False,
                'output': 'GLib-2.0.gir',
                'passthrough_gir': None,
                'cpp_includes': ['d:/dev/gnome.org/gnome-windows/checkout/gobject-introspection/git/src',
                                 'd:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0',
                                 'd:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include',
                                 'd:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/include/glib-2.0',
                                 'd:/dev/gnome.org/gnome-windows/checkout/glib/git/dist/lib/glib-2.0/include']}
* binary     : <giscanner.gdumpparser.IntrospectionBinary object at 0x02C40EF0>
* libraries  : ['libglib-2.0-0', 'libgobject-2.0-0']
* libtool    : []
* non_libtool: ['libglib-2.0-0', 'libgobject-2.0-0']
