mxe/mxe — pull request #192 by tonytheodore (2013-05-23 15:11:53+00:00)
Title: Mingw-w64 support

Full multi-target support is still a way off, but the mingw-w64 support is stable enough now for broad usage. Indeed, it's hard to speculate about the requirements without actually having multiple targets, and the outward facing usage is unlikely to change regardless of how we structure it internally. It's time to make this available for usage and feedback.

For the packages that build, it works almost as a drop-in replacement. For example, I was able to build a 64-bit version of [openscad](http://www.openscad.org) (a current mxe user) with very little effort. The changes boiled down to:

1. conditionally removing a deprecated lib that isn't in mingw-w64 (libglaux)
2. replacing any hard-coded references to i686-pc-mingw32

The openscad project uses qmake and requires qt, eigen, opencsg, cgal, and nsis. That means all the config systems (autotools/pkg-config, cmake, qmake, and scons) work flawlessly, and I ran the builds on FreeBSD, Mac OSX, and Ubuntu. 64-bit nsis is beyond me, but it's easy to use a 32-bit installer for 64-bit applications.

Of the 268 current packages:
- 32 disabled [1] for i686-w64-mingw32
- 54 disabled for x86_64-w64-mingw32
- all i686-pc-mingw32 build as normal

Targets are specified in the `Makefile`, `settings.mk` or on the command line:
```
make qt MXE_TARGETS='i686-w64-mingw32 x86_64-w64-mingw32'
```
It's not clear to me what
```
make qt x86_64-w64-mingw32 # won't work
```
should do, so targets can't be specified that way for the time being.

I haven't done the doc updates yet, one thing I learned in the openscad exercise was that it's not very clear what the triplets mean or how to decide which runtime to use. I'll work on that, along with some tables that show pkg/target support.

Cheers,

Tony

[1] output of `grep 'BUILD_i686-w64-mingw32.*=$' src/*.mk | wc -l`