なんとな~くしあわせ?の日記

「そしてそれゆえ、知識そのものが力である」 (Nam et ipsa scientia potestas est.) 〜 フランシス・ベーコン

x86-64-w64-mingw32でのビルド

「--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32」をconfigureにつけると、ほとんどのソースが問題なくビルドできることに気づいた。
freeglutが素でビルドできるとは思っていなかった。

MinGW64 - インストールしたソースメモ

$ x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc.exe (tdm64-1) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1. zlib-1.2.7
$ cd /usr/local/src/zlib-1.2.7/
$ make -f win32/Makefile.gcc CC=x86_64-w64-mingw32-gcc
$ make -f win32/Makefile.gcc install BINARY_PATH=/mingw/bin INCLUDE_PATH=/mingw/include LIBRARY_PATH=/mingw/lib SHARED_MODE=1

2. libxml2-2.9.0
$ wget ftp://xmlsoft.org/libxml2/libxml2-2.9.0.tar.gz
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --enable-shared --with-threads=no  CFLAGS=-O2
$ make
$ make install

3. nasm-2.10.07
$ cd /usr/local/src/nasm-2.10.07
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
$ make
$ make install

4. libjpeg-turbo-1.2.1
$ cd /usr/local/src/libjpeg-turbo-1.2.1
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
$ make 
$ make install

5. libpng-1.5.13
$ cd /usr/local/src/libpng-1.5.13
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
$ make
$ make install

6. freeglut-2.8.0
$ cd /usr/local/src/freeglut-2.8.0
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
$ make
$ make install

7. tiff-4.0.3
$ cd /usr/local/src/tiff-4.0.3
$ ./configure --prefix=/mingw --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
$ make
$ make install 

8. wxWidgets-2.8.12
$ wget http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.12.tar.bz2
$ tar xvf wxWidgets-2.8.12.tar.bz2
$ cd wxWidgets-2.8.12
$ wget --no-check-certificate https://mingw-w64-dgn.googlecode.com/svn/trunk/patch/wxWidgets-2.8.12-w64.patch
$ patch -p0 < wxWidgets-2.8.12-w64.patch
$ ./configure --prefix=/mingw --with-msw --enable-unicode --disable-debug --enable-gl --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 CXXFLAGS='-fno-keep-inline-dllexport'
$ make
$ make install

# wx-configのスクリプトを修正する
参考:MinGW 64 how-to

$ sed -i 's/--define __WIN32__ --define __WIN95__ --define __GNUWIN32__/--define WX_CPU_AMD64/g' /mingw/bin/wx-config

最後、wxWidgetsのスレッド周りでキャストできないエラーが出るらしいのでパッチを使わせてもらう。新しいgccになったから出たのかなあ?
ポインタをintptr_tやuintptr_tでキャストしてコンパイルを通しているようだ。