JuliaLang/Cairo.jl — pull request #21 by timholy (2013-07-04 18:28:30+00:00)
Title: RFC: partial fixes for building from source (64bit windows)

I've been working my way through building Cairo from source on a 64-bit machine. I've successfully built Julia itself, and verified that `Int == Int64`.

In building Cairo I noticed issues that needed attention, including:

- the downloadable library versions have changed. I've introduced variables to centralize version numbers in these cases, so it's easier to change in the future. We may want a more permanent solution, but this is at least a step in the right direction.
- there were a number of directories that, at least on my system, were not created automatically

Presumably none of these are 64-bit specific fixes.

Now comes the "I'm stuck" part: in building `libffi`, it chooses the `i686-pc-mingw32` target. This ends in the errors:
```
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../
src -DFFI_BUILDING -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g -MT src
/x86/win32.lo -MD -MP -MF src/x86/.deps/win32.Tpo -c ../src/x86/win32.S -DDLL_E
XPORT -DPIC -o src/x86/.libs/win32.o
../src/x86/win32.S: Assembler messages:
../src/x86/win32.S:486: Error: invalid instruction suffix for `push'
../src/x86/win32.S:497: Error: invalid instruction suffix for `push'
../src/x86/win32.S:498: Error: invalid instruction suffix for `push'
../src/x86/win32.S:643: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:652: Error: invalid instruction suffix for `push'
../src/x86/win32.S:669: Error: invalid instruction suffix for `push'
../src/x86/win32.S:768: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:780: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:797: Error: invalid instruction suffix for `push'
../src/x86/win32.S:799: Error: invalid instruction suffix for `push'
../src/x86/win32.S:814: Error: invalid instruction suffix for `push'
../src/x86/win32.S:818: Error: invalid instruction suffix for `push'
../src/x86/win32.S:918: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:919: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:934: Error: invalid instruction suffix for `push'
../src/x86/win32.S:1032: Error: invalid instruction suffix for `pop'
make[4]: *** [src/x86/win32.lo] Error 1
make[4]: Leaving directory `/usr/home/tim/packages/Cairo/deps/src/libffi-3.0.11/
i686-pc-mingw32'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/home/tim/packages/Cairo/deps/src/libffi-3.0.11/
i686-pc-mingw32'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/home/tim/packages/Cairo/deps/src/libffi-3.0.11/
i686-pc-mingw32'
make[1]: *** [all-all] Error 2
make[1]: Leaving directory `/usr/home/tim/packages/Cairo/deps/src/libffi-3.0.11'

ERROR: failed process: Process(`make ''`, ProcessExited(2)) [2]
in error at error.jl:22
in success at process.jl:414
in wait_exit at process.jl:546
at C:\MinGW\msys\1.0\msys\home\tim\packages\Cairo\deps\build.jl:108

julia>
```
The issue is that it's choosing the `win32.S` file for a 64-bit machine.

I suspect the cure is on this line:
```
autotools_install(depsdir,"ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz","libffi-3.0.11.tar.gz",String[],"libffi-3.0.11","libffi-3.0.11",OS_NAME == :Windows ? "i686-pc-mingw32/.libs/libffi.la" : ".libs/libffi.la","libffi.la",OS_NAME == :Windows ? "i686-pc-mingw32" : "")
```
In place of the `String[]`, I've tried several combinations of `-m32`, `--32`, `--build=x86_64-w64-mingw32`, etc. No luck so far. Any tips?