Cross-compiling gobject-introspection

The cross compilation of gobject-introspection from linux to mingw has been proven a really tough task. That project seems an octopus connected at runtime to different part of the system: python, pkg-config, a shell, dlltool and cc. On a standard unix based system all those tools are already installed but when cross-compiling you must build every single piece by yourself.

My first approach was to build everything on the host side (i.e. on mingw-w64). I still think this is the correct way (after all I need to add introspection for packages installed on the host side) but after a lot of trial and error (more errors than trials) I gave up. I was bound continuosly from the build side to the host side and vice versa because of path format, filename mangling and requirements. When I realized I had to build gcc on the host I was fed up. I just tried a precompiled binary and definitively gave up after the umpteenth error.

The second approach was to leverage the tools on the build system by configuring them to work with the paths of the host system. It was not straight-forward but surely much easier than the previous attempt and, above all, successful!

The main problem was to build the giscanner python module for the build platform. I resolved building the project twice, as already done by Nicolas Dufresne when cross-compiling for other arch. I then leveraged wine to run host programs on the build side.

The changes on gobject-introspection are relatively few and unobtrusive. They can be pulled from my xbuild branch.

The build is still not as straight-forward as I would. I used a variation of the following (untested) procedure.