summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:20:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:23:49 +0200
commit6fe7fc56873b27deef74bc9dc36adf86af4fd79b (patch)
treeab6794c3f6ac2202ebf9f5e2f24cd4f0886fc68e
parentbe44ee078fa5d5470dddd097db0d97fadfc754ff (diff)
Update MinGW64 binary build (MinGW 3.3 runtime)
Using GCC 4.9.3, multi-arch/multi-lib build (you don't want to try this at home).
-rw-r--r--binary/mingw-w64/NOTES58
-rwxr-xr-xbinary/mingw-w64/binutils-configure3
-rwxr-xr-xbinary/mingw-w64/binutils-cross-configure3
-rwxr-xr-xbinary/mingw-w64/build-dist23
-rwxr-xr-xbinary/mingw-w64/gcc-configure11
-rwxr-xr-xbinary/mingw-w64/gcc-cross-configure8
-rwxr-xr-xbinary/mingw-w64/odb-configure2
-rw-r--r--binary/mingw-w64/patches/gcc-4.7-20130209-cross.patch25
-rw-r--r--binary/mingw-w64/patches/gcc-4.7-20130209-mingw.patch24
-rw-r--r--binary/mingw-w64/patches/gcc-4.7-20130209-static-plugin.patch142
-rw-r--r--binary/mingw-w64/patches/gcc-4.9-20150204-cross.patch25
-rw-r--r--binary/mingw-w64/patches/gcc-4.9-20150204-mingw.patch24
-rw-r--r--binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch150
-rwxr-xr-xbinary/mingw-w64/pthread-cross-configure2
-rwxr-xr-xbinary/mingw-w64/pthread-cross-configure-6410
-rwxr-xr-xbinary/mingw-w64/rt-cross-configure4
-rwxr-xr-xbinary/mingw-w64/rt-headers-cross-configure3
17 files changed, 488 insertions, 29 deletions
diff --git a/binary/mingw-w64/NOTES b/binary/mingw-w64/NOTES
index fec4e7a..c94988f 100644
--- a/binary/mingw-w64/NOTES
+++ b/binary/mingw-w64/NOTES
@@ -1,7 +1,11 @@
-TODO:
+Notes:
-* Multi-arch build (i.e., i686 hosted, i686 and x86_64-trageting, just
- like in Qt5). Then will be able to pass -m32/-m64 to the ODB compiler.
+- Currently have to use the mingw/lib -> i686-w64-mingw32/lib64 hack to
+ make GCC see 64-bit system libraries. This is required for both cross
+ and native compiler. In the native compiler it is removed later and
+ the result seem to work ok.
+
+- If updating msys, add gendef and reimp (from mingw-utils) utilities.
An overview of steps required to switch to a new GCC version. This is
a complete toolchain bring up.
@@ -39,9 +43,11 @@ a complete toolchain bring up.
3. Adapt gcc-cross-configure based on MinGW-W64 config and old config.
4. Build & install GCC only:
+ # High -j does not seem to work properly, -j 4 seems to work.
+
cd gcc-cross-build
../gcc-cross-configure
- make -j 16 all-gcc
+ make -j 4 all-gcc
make install-gcc
5. Build runtime:
@@ -52,32 +58,39 @@ a complete toolchain bring up.
export PATH=`pwd`/cross/mingw/bin:$PATH
cd mingw-w64-build
../rt-cross-configure
- make -j 16
- make install
+ make -j 22
+ make -j 22 install
-6. Build pthreads:
+ i686-w64-mingw32-ar cr ../cross/mingw/i686-w64-mingw32/lib/libpthread.a
+ i686-w64-mingw32-ar cr ../cross/mingw/i686-w64-mingw32/lib64/libpthread.a
- 1. Get winpthreads, create or clean winpthreads-build
-
- svn checkout http://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/experimental/winpthreads
-
- 2. Build and install:
+ mkdir winpthreads32
+ cd winpthreads32
+ ../../pthread-cross-configure
+ make -j 16
+ make install
+ mv ../../cross/mingw/i686-w64-mingw32/bin/libwinpthread* ../../cross/mingw/i686-w64-mingw32/lib/
- export PATH=`pwd`/cross/mingw/bin:$PATH
- cd winpthreads-build
- ../pthreads-cross-configure
+ cd ..
+ mkdir winpthreads64
+ cd winpthreads64
+ ../../pthread-cross-configure-64
make -j 16
make install
+ mv ../../cross/mingw/i686-w64-mingw32/bin/libwinpthread* ../../cross/mingw/i686-w64-mingw32/lib64/
7. Build cross-GCC, phase 2:
1. Build & install:
+ @@ Had to ln mingw/lib to lib64 in cross/mingw/
+
cd gcc-cross-build
make -j 16
make install
- 2. Disable .dll & .la files in i686-w64-mingw32/lib and bin/.
+ 2. Disable .dll & .la files in i686-w64-mingw32/lib and bin/ (for
+ static link)
3. Check that the compiler works. Compile and run sizeof_funds.cxx and
throw.cxx.
@@ -91,11 +104,17 @@ a complete toolchain bring up.
cd mingw-w64-headers-build
make DESTDIR=/home/boris/work/odb/build/mingw-w64/mingw-rt install
+ # May need export PATH above
cd mingw-w64-build
make DESTDIR=/home/boris/work/odb/build/mingw-w64/mingw-rt install
- cd winpthreads-build
+ cd winpthreads32
make DESTDIR=/home/boris/work/odb/build/mingw-w64/mingw-rt install
+ #do manually: mv ../../mingw-rt/i686-w64-mingw32/bin/libwinpthread* ../../mingw-rt/i686-w64-mingw32/lib/
+
+ cd winpthreads64
+ make DESTDIR=/home/boris/work/odb/build/mingw-w64/mingw-rt install
+ #do manually: mv ../../mingw-rt/i686-w64-mingw32/bin/libwinpthread* ../../mingw-rt/i686-w64-mingw32/lib64/
Move to the top level directory.
@@ -160,8 +179,13 @@ a complete toolchain bring up.
2. Check the package for any stray directories/files. Compare size to
the old version.
+ Check that 32 and 64-bit libstdc++ are different (use file) Globbing
+ for odb.
+
3. On Windows, check that:
+ - No dependencies on MinGW DLLs (odb, g++, cc1plus, ld).
+
- Compiler, including exceptions, work. Compile and run sizeof_funds.cxx
and throw.cxx.
diff --git a/binary/mingw-w64/binutils-configure b/binary/mingw-w64/binutils-configure
index e5194c0..713decc 100755
--- a/binary/mingw-w64/binutils-configure
+++ b/binary/mingw-w64/binutils-configure
@@ -3,6 +3,9 @@
../binutils/configure \
--host i686-w64-mingw32 \
--target i686-w64-mingw32 \
+--enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 \
+--enable-multilib \
+--enable-64-bit-bfd \
--prefix=/mingw \
--with-sysroot=/mingw \
--disable-nls \
diff --git a/binary/mingw-w64/binutils-cross-configure b/binary/mingw-w64/binutils-cross-configure
index 142f110..199a064 100755
--- a/binary/mingw-w64/binutils-cross-configure
+++ b/binary/mingw-w64/binutils-cross-configure
@@ -2,6 +2,9 @@
../binutils/configure \
--target i686-w64-mingw32 \
+--enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 \
+--enable-multilib \
+--enable-64-bit-bfd \
--prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw \
--with-sysroot=/home/boris/work/odb/build/mingw-w64/cross/mingw \
--disable-nls \
diff --git a/binary/mingw-w64/build-dist b/binary/mingw-w64/build-dist
index 5b8e1f0..0c1e082 100755
--- a/binary/mingw-w64/build-dist
+++ b/binary/mingw-w64/build-dist
@@ -90,6 +90,9 @@ if [ $rebuild = y ]; then
cp -r mingw-rt/* /mingw/
cp -r mingw-binutils/* /mingw/
+
+ mkdir /mingw/mingw
+ ln -s /mingw/i686-w64-mingw32/lib64 /mingw/mingw/lib
fi
# Build libplugin-stub
@@ -251,17 +254,30 @@ else
fi
make -j $jobs STATIC_PLUGIN_LIBS="-Wl,--whole-archive $out_root/odb-build/odb/.libs/odb.a -Wl,--no-whole-archive $out_root/libcutl/cutl/.libs/libcutl.a -lstdc++ -static-libgcc"
+
+# Split 32 and 64 libs/dlls.
+#
+rm -rf /mingw/bin64
+mv /mingw/bin /mingw/bin32
make install
-make -C i686-w64-mingw32/libstdc++-v3 install-strip
+make -C i686-w64-mingw32/libstdc++-v3/src install-strip
+mv /mingw/bin/* /mingw/bin32/
+rm -rf /mingw/bin /mingw/bin64
+make -C i686-w64-mingw32/64/libstdc++-v3/src install-strip
+mv /mingw/bin /mingw/bin64
+mv /mingw/bin32 /mingw/bin
cd ..
-# Copy /mingw over to installation
+# Copy /mingw over to installation.
#
cp -r /mingw $install_root/
# Move some DLLs to mingw/bin/.
mv $install_root/mingw/lib/libgcc_s_sjlj-1.dll $install_root/mingw/bin/
-mv $install_root/mingw/i686-w64-mingw32/bin/libwinpthread-1.dll $install_root/mingw/bin/
+mv $install_root/mingw/i686-w64-mingw32/lib/libwinpthread-1.dll $install_root/mingw/bin/
+
+mv $install_root/mingw/lib64/libgcc_s_sjlj-1.dll $install_root/mingw/bin64/
+mv $install_root/mingw/i686-w64-mingw32/lib64/libwinpthread-1.dll $install_root/mingw/bin64/
# Move doc and man out of share/
#
@@ -272,6 +288,7 @@ rm -r $install_root/share
# Clean some things up.
#
+rm -r $install_root/mingw/mingw
rm -f $install_root/mingw/lib/libbfd.*
rm -f $install_root/mingw/include/bfd*.h
rm -f $install_root/mingw/lib/libopcodes.*
diff --git a/binary/mingw-w64/gcc-configure b/binary/mingw-w64/gcc-configure
index ca00dd5..156d803 100755
--- a/binary/mingw-w64/gcc-configure
+++ b/binary/mingw-w64/gcc-configure
@@ -15,7 +15,12 @@
--disable-libssp \
--disable-libgomp \
--disable-graphite \
---disable-multilib \
+--enable-targets=all \
+--enable-multilib \
+--with-arch-32=i686 \
+--with-arch-64=nocona \
+--with-tune-32=generic \
+--with-tune-64=core2 \
--enable-libstdcxx-time \
--enable-fully-dynamic-string \
--disable-dw2-exceptions \
@@ -29,5 +34,5 @@
--with-pkgversion="ODB special" \
--with-bugurl="http://www.codesynthesis.com/products/odb/" \
--enable-static-plugin \
---with-stage1-libs=libplugin-stub.a \
-CFLAGS=-O2 CXXFLAGS=-O2 LDFLAGS=-s
+--with-stage1-libs="libplugin-stub.a -lstdc++" \
+CFLAGS=-O2 CXXFLAGS=-O2 LDFLAGS="-s -static-libgcc"
diff --git a/binary/mingw-w64/gcc-cross-configure b/binary/mingw-w64/gcc-cross-configure
index 39d1d54..d0ecf76 100755
--- a/binary/mingw-w64/gcc-cross-configure
+++ b/binary/mingw-w64/gcc-cross-configure
@@ -13,7 +13,12 @@
--disable-libssp \
--disable-libgomp \
--disable-graphite \
---disable-multilib \
+--enable-targets=all \
+--enable-multilib \
+--with-arch-32=i686 \
+--with-arch-64=nocona \
+--with-tune-32=generic \
+--with-tune-64=core2 \
--enable-libstdcxx-time \
--enable-fully-dynamic-string \
--disable-dw2-exceptions \
@@ -24,4 +29,5 @@
--disable-win32-registry \
--disable-nls \
--disable-werror \
+--with-system-zlib \
CFLAGS=-O2 CXXFLAGS=-O2
diff --git a/binary/mingw-w64/odb-configure b/binary/mingw-w64/odb-configure
index fd565a0..6d26edb 100755
--- a/binary/mingw-w64/odb-configure
+++ b/binary/mingw-w64/odb-configure
@@ -9,6 +9,6 @@
--with-libcutl=../libcutl \
--with-gxx-name='..\\mingw\\bin\\g++.exe' \
--with-options-file='..\\etc\\odb\\default.options' \
-CXXFLAGS="-O2 -W -Wall" \
+CXXFLAGS="-O2 -fno-devirtualize -W -Wall" \
LDFLAGS=-static-libgcc \
CPPFLAGS="-I`pwd`/../gcc-headers/gcc -I`pwd`/../gcc/gcc -I`pwd`/../gcc/libcpp/include -I`pwd`/../gcc/include"
diff --git a/binary/mingw-w64/patches/gcc-4.7-20130209-cross.patch b/binary/mingw-w64/patches/gcc-4.7-20130209-cross.patch
new file mode 100644
index 0000000..ab207cc
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.7-20130209-cross.patch
@@ -0,0 +1,25 @@
+diff -ru gcc-4.7-20130209/gcc/config/i386/mingw32.h gcc-cross/gcc/config/i386/mingw32.h
+--- gcc-4.7-20130209/gcc/config/i386/mingw32.h 2012-08-06 16:34:27.000000000 +0200
++++ gcc-cross/gcc/config/i386/mingw32.h 2013-05-27 15:41:55.000000000 +0200
+@@ -153,7 +153,7 @@
+ /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
+ macro contains POSIX-style path. See bug 52947. */
+ #undef NATIVE_SYSTEM_HEADER_DIR
+-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
++#define NATIVE_SYSTEM_HEADER_DIR "/include"
+
+ /* Output STRING, a string representing a filename, to FILE.
+ We canonicalize it to be in Unix format (backslashes are replaced
+diff -ru gcc-4.7-20130209/gcc/config.gcc gcc-cross/gcc/config.gcc
+--- gcc-4.7-20130209/gcc/config.gcc 2013-01-14 18:32:37.000000000 +0200
++++ gcc-cross/gcc/config.gcc 2013-05-27 15:42:06.000000000 +0200
+@@ -1485,7 +1485,7 @@
+ tmake_file="${tmake_file} i386/t-mingw-w32"
+ ;;
+ esac
+- native_system_header_dir=/mingw/include
++ native_system_header_dir=/include
+ target_gtfiles="\$(srcdir)/config/i386/winnt.c"
+ extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+ case ${target} in
+
diff --git a/binary/mingw-w64/patches/gcc-4.7-20130209-mingw.patch b/binary/mingw-w64/patches/gcc-4.7-20130209-mingw.patch
new file mode 100644
index 0000000..391bf0b
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.7-20130209-mingw.patch
@@ -0,0 +1,24 @@
+diff -ru gcc-4.7-20130209/gcc/config/i386/mingw32.h gcc/gcc/config/i386/mingw32.h
+--- gcc-4.7-20130209/gcc/config/i386/mingw32.h 2012-08-06 16:34:27.000000000 +0200
++++ gcc/gcc/config/i386/mingw32.h 2013-05-27 15:42:33.000000000 +0200
+@@ -153,7 +153,7 @@
+ /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
+ macro contains POSIX-style path. See bug 52947. */
+ #undef NATIVE_SYSTEM_HEADER_DIR
+-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
++#define NATIVE_SYSTEM_HEADER_DIR "/include"
+
+ /* Output STRING, a string representing a filename, to FILE.
+ We canonicalize it to be in Unix format (backslashes are replaced
+diff -ru gcc-4.7-20130209/gcc/config.gcc gcc/gcc/config.gcc
+--- gcc-4.7-20130209/gcc/config.gcc 2013-01-14 18:32:37.000000000 +0200
++++ gcc/gcc/config.gcc 2013-05-27 15:42:45.000000000 +0200
+@@ -1485,7 +1485,7 @@
+ tmake_file="${tmake_file} i386/t-mingw-w32"
+ ;;
+ esac
+- native_system_header_dir=/mingw/include
++ native_system_header_dir=/include
+ target_gtfiles="\$(srcdir)/config/i386/winnt.c"
+ extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+ case ${target} in
diff --git a/binary/mingw-w64/patches/gcc-4.7-20130209-static-plugin.patch b/binary/mingw-w64/patches/gcc-4.7-20130209-static-plugin.patch
new file mode 100644
index 0000000..786a354
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.7-20130209-static-plugin.patch
@@ -0,0 +1,142 @@
+diff -ru gcc-4.7-20130209/gcc/config.in gcc/gcc/config.in
+--- gcc-4.7-20130209/gcc/config.in 2013-02-10 00:52:59.000000000 +0200
++++ gcc/gcc/config.in 2013-05-27 15:42:33.000000000 +0200
+@@ -143,6 +143,10 @@
+ #undef ENABLE_PLUGIN
+ #endif
+
++/* Define to enable static plugin support. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_STATIC_PLUGIN
++#endif
+
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+diff -ru gcc-4.7-20130209/gcc/configure.ac gcc/gcc/configure.ac
+--- gcc-4.7-20130209/gcc/configure.ac 2013-02-06 17:23:55.000000000 +0200
++++ gcc/gcc/configure.ac 2013-05-27 15:42:45.000000000 +0200
+@@ -5224,6 +5224,14 @@
+ AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
+ fi
+
++AC_ARG_ENABLE(static-plugin,
++[ --enable-static-plugin enable static plugin support],
++enable_static_plugin=$enableval,
++enable_static_plugin==no)
++
++if test x"$enable_static_plugin" = x"yes"; then
++ AC_DEFINE(ENABLE_STATIC_PLUGIN, 1, [Define to enable static plugin support.])
++fi
+
+ AC_ARG_ENABLE(libquadmath-support,
+ [AS_HELP_STRING([--disable-libquadmath-support],
+diff -ru gcc-4.7-20130209/gcc/cp/Make-lang.in gcc/gcc/cp/Make-lang.in
+--- gcc-4.7-20130209/gcc/cp/Make-lang.in 2011-11-09 19:53:53.000000000 +0200
++++ gcc/gcc/cp/Make-lang.in 2013-05-27 15:42:32.000000000 +0200
+@@ -103,7 +103,8 @@
+
+ cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+ +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+- $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++ $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(STATIC_PLUGIN_LIBS) \
++ $(LIBS) $(BACKENDLIBS)
+
+ ifeq ($(ENABLE_MAINTAINER_RULES), true)
+ # Special build rule. This is a maintainer rule, that is only
+diff -ru gcc-4.7-20130209/gcc/opts-global.c gcc/gcc/opts-global.c
+--- gcc-4.7-20130209/gcc/opts-global.c 2011-11-03 16:46:26.000000000 +0200
++++ gcc/gcc/opts-global.c 2013-05-27 15:42:45.000000000 +0200
+@@ -365,7 +365,7 @@
+ break;
+
+ case OPT_fplugin_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ add_new_plugin (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+@@ -373,7 +373,7 @@
+ break;
+
+ case OPT_fplugin_arg_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ parse_plugin_arg_opt (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+diff -ru gcc-4.7-20130209/gcc/plugin.c gcc/gcc/plugin.c
+--- gcc-4.7-20130209/gcc/plugin.c 2011-10-19 15:20:22.000000000 +0200
++++ gcc/gcc/plugin.c 2013-05-27 15:42:45.000000000 +0200
+@@ -31,7 +31,7 @@
+ #include "timevar.h"
+ #include "ggc.h"
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ #include "plugin-version.h"
+ #endif
+
+@@ -132,6 +132,7 @@
+
+ flag_plugin_added = true;
+
++#ifdef ENABLE_PLUGIN
+ /* Replace short names by their full path when relevant. */
+ name_is_short = !IS_ABSOLUTE_PATH (plugin_name);
+ for (pc = plugin_name; name_is_short && *pc; pc++)
+@@ -153,6 +154,7 @@
+ plugin_name, base_name);
+ }
+ else
++#endif
+ base_name = get_plugin_base_name (plugin_name);
+
+ /* If this is the first -fplugin= option we encounter, create
+@@ -619,6 +621,26 @@
+ return 1;
+ }
+
++#elif defined(ENABLE_STATIC_PLUGIN)
++
++extern int
++plugin_init (struct plugin_name_args*, struct plugin_gcc_version*);
++
++static int
++init_one_plugin (void **slot, void * ARG_UNUSED (info))
++{
++ struct plugin_name_args *plugin = (struct plugin_name_args *) *slot;
++
++ /* Call the plugin-provided initialization routine with the arguments. */
++ if (plugin_init (plugin, &gcc_version))
++ {
++ error ("Fail to initialize plugin %s", plugin->full_name);
++ htab_remove_elt (plugin_name_args_tab, plugin->base_name);
++ XDELETE (plugin);
++ }
++ return 1;
++}
++
+ #endif /* ENABLE_PLUGIN */
+
+ /* Main plugin initialization function. Called from compile_file() in
+@@ -633,7 +655,7 @@
+
+ timevar_push (TV_PLUGIN_INIT);
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* Traverse and initialize each plugin specified in the command-line. */
+ htab_traverse_noresize (plugin_name_args_tab, init_one_plugin, NULL);
+ #endif
+diff -ru gcc-4.7-20130209/gcc/plugin.h gcc/gcc/plugin.h
+--- gcc-4.7-20130209/gcc/plugin.h 2010-10-05 16:28:39.000000000 +0200
++++ gcc/gcc/plugin.h 2013-05-27 15:42:33.000000000 +0200
+@@ -52,7 +52,7 @@
+ invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
+ void *gcc_data ATTRIBUTE_UNUSED)
+ {
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* True iff at least one plugin has been added. */
+ if (flag_plugin_added)
+ return invoke_plugin_callbacks_full (event, gcc_data);
diff --git a/binary/mingw-w64/patches/gcc-4.9-20150204-cross.patch b/binary/mingw-w64/patches/gcc-4.9-20150204-cross.patch
new file mode 100644
index 0000000..497aa9b
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.9-20150204-cross.patch
@@ -0,0 +1,25 @@
+diff -ru gcc-4.9-20150204/gcc/config/i386/mingw32.h gcc-cross/gcc/config/i386/mingw32.h
+--- gcc-4.9-20150204/gcc/config/i386/mingw32.h 2014-04-23 11:46:13.000000000 +0200
++++ gcc-cross/gcc/config/i386/mingw32.h 2015-02-09 08:27:15.531922502 +0200
+@@ -162,7 +162,7 @@
+ /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
+ macro contains POSIX-style path. See bug 52947. */
+ #undef NATIVE_SYSTEM_HEADER_DIR
+-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
++#define NATIVE_SYSTEM_HEADER_DIR "/i686-w64-mingw32/include"
+
+ /* Output STRING, a string representing a filename, to FILE.
+ We canonicalize it to be in Unix format (backslashes are replaced
+diff -ru gcc-4.9-20150204/gcc/config.gcc gcc-cross/gcc/config.gcc
+--- gcc-4.9-20150204/gcc/config.gcc 2014-11-07 18:40:16.000000000 +0200
++++ gcc-cross/gcc/config.gcc 2015-02-09 08:28:53.155923698 +0200
+@@ -1666,7 +1666,7 @@
+ tmake_file="${tmake_file} i386/t-mingw-w32"
+ ;;
+ esac
+- native_system_header_dir=/mingw/include
++ native_system_header_dir=/i686-w64-mingw32/include
+ target_gtfiles="\$(srcdir)/config/i386/winnt.c"
+ extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+ case ${target} in
+
diff --git a/binary/mingw-w64/patches/gcc-4.9-20150204-mingw.patch b/binary/mingw-w64/patches/gcc-4.9-20150204-mingw.patch
new file mode 100644
index 0000000..9c10bae
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.9-20150204-mingw.patch
@@ -0,0 +1,24 @@
+diff -ru gcc-4.9-20150204/gcc/config/i386/mingw32.h gcc/gcc/config/i386/mingw32.h
+--- gcc-4.9-20150204/gcc/config/i386/mingw32.h 2014-04-23 11:46:13.000000000 +0200
++++ gcc/gcc/config/i386/mingw32.h 2015-02-09 15:37:33.864238829 +0200
+@@ -162,7 +162,7 @@
+ /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
+ macro contains POSIX-style path. See bug 52947. */
+ #undef NATIVE_SYSTEM_HEADER_DIR
+-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
++#define NATIVE_SYSTEM_HEADER_DIR "/include"
+
+ /* Output STRING, a string representing a filename, to FILE.
+ We canonicalize it to be in Unix format (backslashes are replaced
+diff -ru gcc-4.9-20150204/gcc/config.gcc gcc/gcc/config.gcc
+--- gcc-4.9-20150204/gcc/config.gcc 2014-11-07 18:40:16.000000000 +0200
++++ gcc/gcc/config.gcc 2015-02-09 15:38:07.376239240 +0200
+@@ -1666,7 +1666,7 @@
+ tmake_file="${tmake_file} i386/t-mingw-w32"
+ ;;
+ esac
+- native_system_header_dir=/mingw/include
++ native_system_header_dir=/include
+ target_gtfiles="\$(srcdir)/config/i386/winnt.c"
+ extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+ case ${target} in
diff --git a/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch b/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch
new file mode 100644
index 0000000..4230d5f
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch
@@ -0,0 +1,150 @@
+diff -ru gcc-4.9-20150204/gcc/config.in gcc/gcc/config.in
+--- gcc-4.9-20150204/gcc/config.in 2015-02-05 00:32:56.000000000 +0200
++++ gcc/gcc/config.in 2015-02-08 19:58:45.215372260 +0200
+@@ -137,6 +137,10 @@
+ #undef ENABLE_PLUGIN
+ #endif
+
++/* Define to enable static plugin support. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_STATIC_PLUGIN
++#endif
+
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+diff -ru gcc-4.9-20150204/gcc/configure.ac gcc/gcc/configure.ac
+--- gcc-4.9-20150204/gcc/configure.ac 2014-12-04 20:25:37.000000000 +0200
++++ gcc/gcc/configure.ac 2015-02-08 19:58:45.219372260 +0200
+@@ -5519,6 +5519,14 @@
+ fi
+ fi
+
++AC_ARG_ENABLE(static-plugin,
++[ --enable-static-plugin enable static plugin support],
++enable_static_plugin=$enableval,
++enable_static_plugin==no)
++
++if test x"$enable_static_plugin" = x"yes"; then
++ AC_DEFINE(ENABLE_STATIC_PLUGIN, 1, [Define to enable static plugin support.])
++fi
+
+ # Check for plugin support
+ AC_ARG_ENABLE(plugin,
+diff -ru gcc-4.9-20150204/gcc/cp/Make-lang.in gcc/gcc/cp/Make-lang.in
+--- gcc-4.9-20150204/gcc/cp/Make-lang.in 2014-04-15 10:04:17.000000000 +0200
++++ gcc/gcc/cp/Make-lang.in 2015-02-08 20:01:21.479374174 +0200
+@@ -90,14 +90,14 @@
+
+ # compute checksum over all object files and the options
+ cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
+- $(CXX_OBJS) $(BACKEND) $(LIBDEPS)
++ $(CXX_OBJS) $(BACKEND) $(LIBDEPS)
+ build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \
+ checksum-options > cc1plus-checksum.c.tmp && \
+ $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c
+
+ cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+ +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+- $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++ $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(STATIC_PLUGIN_LIBS) $(LIBS) $(BACKENDLIBS)
+
+ ifeq ($(ENABLE_MAINTAINER_RULES), true)
+ # Special build rule. This is a maintainer rule, that is only
+diff -ru gcc-4.9-20150204/gcc/opts-global.c gcc/gcc/opts-global.c
+--- gcc-4.9-20150204/gcc/opts-global.c 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/opts-global.c 2015-02-08 19:58:45.223372260 +0200
+@@ -381,7 +381,7 @@
+ break;
+
+ case OPT_fplugin_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ add_new_plugin (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+@@ -389,7 +389,7 @@
+ break;
+
+ case OPT_fplugin_arg_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ parse_plugin_arg_opt (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+diff -ru gcc-4.9-20150204/gcc/plugin.c gcc/gcc/plugin.c
+--- gcc-4.9-20150204/gcc/plugin.c 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/plugin.c 2015-02-09 12:40:04.956108359 +0200
+@@ -31,7 +31,7 @@
+ #include "plugin.h"
+ #include "ggc.h"
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ #include "plugin-version.h"
+ #endif
+
+@@ -159,6 +159,7 @@
+
+ flag_plugin_added = true;
+
++#ifdef ENABLE_PLUGIN
+ /* Replace short names by their full path when relevant. */
+ name_is_short = !IS_ABSOLUTE_PATH (plugin_name);
+ for (pc = plugin_name; name_is_short && *pc; pc++)
+@@ -180,6 +181,7 @@
+ plugin_name, base_name);
+ }
+ else
++#endif
+ base_name = get_plugin_base_name (plugin_name);
+
+ /* If this is the first -fplugin= option we encounter, create
+@@ -634,6 +636,26 @@
+ return 1;
+ }
+
++#elif defined(ENABLE_STATIC_PLUGIN)
++
++extern "C" int
++plugin_init (struct plugin_name_args*, struct plugin_gcc_version*);
++
++static int
++init_one_plugin (void **slot, void * ARG_UNUSED (info))
++{
++ struct plugin_name_args *plugin = (struct plugin_name_args *) *slot;
++
++ /* Call the plugin-provided initialization routine with the arguments. */
++ if (plugin_init (plugin, &gcc_version))
++ {
++ error ("Fail to initialize plugin %s", plugin->full_name);
++ htab_remove_elt (plugin_name_args_tab, plugin->base_name);
++ XDELETE (plugin);
++ }
++ return 1;
++}
++
+ #endif /* ENABLE_PLUGIN */
+
+ /* Main plugin initialization function. Called from compile_file() in
+@@ -648,7 +670,7 @@
+
+ timevar_push (TV_PLUGIN_INIT);
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* Traverse and initialize each plugin specified in the command-line. */
+ htab_traverse_noresize (plugin_name_args_tab, init_one_plugin, NULL);
+ #endif
+diff -ru gcc-4.9-20150204/gcc/plugin.h gcc/gcc/plugin.h
+--- gcc-4.9-20150204/gcc/plugin.h 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/plugin.h 2015-02-08 19:58:45.227372260 +0200
+@@ -53,7 +53,7 @@
+ invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
+ void *gcc_data ATTRIBUTE_UNUSED)
+ {
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* True iff at least one plugin has been added. */
+ if (flag_plugin_added)
+ return invoke_plugin_callbacks_full (event, gcc_data);
+
diff --git a/binary/mingw-w64/pthread-cross-configure b/binary/mingw-w64/pthread-cross-configure
index d858097..dc67088 100755
--- a/binary/mingw-w64/pthread-cross-configure
+++ b/binary/mingw-w64/pthread-cross-configure
@@ -2,7 +2,7 @@
#
#
-../winpthreads/configure \
+../../mingw-w64/mingw-w64-libraries/winpthreads/configure \
--host i686-w64-mingw32 \
--prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw/i686-w64-mingw32 \
--with-sysroot=/home/boris/work/odb/build/mingw-w64/cross/mingw \
diff --git a/binary/mingw-w64/pthread-cross-configure-64 b/binary/mingw-w64/pthread-cross-configure-64
new file mode 100755
index 0000000..dc9f2d5
--- /dev/null
+++ b/binary/mingw-w64/pthread-cross-configure-64
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+#
+#
+../../mingw-w64/mingw-w64-libraries/winpthreads/configure \
+--host i686-w64-mingw32 \
+--prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw/i686-w64-mingw32 \
+--libdir=/home/boris/work/odb/build/mingw-w64/cross/mingw/i686-w64-mingw32/lib64 \
+--with-sysroot=/home/boris/work/odb/build/mingw-w64/cross/mingw \
+CFLAGS="-O2 -m64" CXXFLAGS="-O2 -m64" LDFLAGS=-m64 RCFLAGS="-F pe-x86-64"
diff --git a/binary/mingw-w64/rt-cross-configure b/binary/mingw-w64/rt-cross-configure
index 0822c0e..0cf7ece 100755
--- a/binary/mingw-w64/rt-cross-configure
+++ b/binary/mingw-w64/rt-cross-configure
@@ -4,7 +4,9 @@
#
../mingw-w64/configure \
--host i686-w64-mingw32 \
---prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw \
+--prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw/i686-w64-mingw32 \
--with-sysroot=/home/boris/work/odb/build/mingw-w64/cross/mingw \
--enable-wildcard \
+--enable-lib32 \
+--enable-lib64 \
CFLAGS=-O2 CXXFLAGS=-O2
diff --git a/binary/mingw-w64/rt-headers-cross-configure b/binary/mingw-w64/rt-headers-cross-configure
index b5ea2a0..66d4026 100755
--- a/binary/mingw-w64/rt-headers-cross-configure
+++ b/binary/mingw-w64/rt-headers-cross-configure
@@ -4,6 +4,5 @@
#
../mingw-w64/mingw-w64-headers/configure \
--host i686-w64-mingw32 \
---prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw \
---enable-wildcard \
+--prefix=/home/boris/work/odb/build/mingw-w64/cross/mingw/i686-w64-mingw32 \
CFLAGS=-O2 CXXFLAGS=-O2