summaryrefslogtreecommitdiff
path: root/binary/mingw
diff options
context:
space:
mode:
Diffstat (limited to 'binary/mingw')
-rwxr-xr-xbinary/mingw/binutils-cross-configure10
-rwxr-xr-xbinary/mingw/build-dist14
-rw-r--r--binary/mingw/gcc-4.7.2-mingw-cross.patch24
-rw-r--r--binary/mingw/gcc-4.7.2-mingw.patch24
-rw-r--r--binary/mingw/gcc-4.7.2-static-plugin.patch142
-rwxr-xr-xbinary/mingw/gcc-configure29
-rwxr-xr-xbinary/mingw/gcc-cross-configure26
-rw-r--r--binary/mingw/new-gcc-version73
-rwxr-xr-xbinary/mingw/odb-configure4
9 files changed, 327 insertions, 19 deletions
diff --git a/binary/mingw/binutils-cross-configure b/binary/mingw/binutils-cross-configure
new file mode 100755
index 0000000..7e53218
--- /dev/null
+++ b/binary/mingw/binutils-cross-configure
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+../binutils-cross/configure \
+--disable-nls \
+--disable-shared \
+--disable-debug \
+--target i686-mingw32 \
+--prefix=/home/boris/work/odb/build/mingw/cross/mingw \
+--with-sysroot=/home/boris/work/odb/build/mingw/cross/mingw \
+CFLAGS=-O2
diff --git a/binary/mingw/build-dist b/binary/mingw/build-dist
index a784fd6..aca3dcb 100755
--- a/binary/mingw/build-dist
+++ b/binary/mingw/build-dist
@@ -209,7 +209,7 @@ if [ $rebuild = y ]; then
../libcutl-configure
fi
-make
+make -j 10
cd ..
# Build odb
@@ -234,9 +234,9 @@ if [ $rebuild = y ]; then
../odb-configure $over
fi
-make
+make -j 10
make install-strip
-rm -f $install_root/bin/odb.a
+rm -r $install_root/libexec # odb/odb.a
cd ..
# Build gcc
@@ -250,7 +250,7 @@ else
rm -f gcc/cc1plus.exe gcc/cc1plus-dummy.exe
fi
-make 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"
+make 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" -j 10
make install
make -C i686-mingw32/libstdc++-v3 install-strip
cd ..
@@ -259,6 +259,12 @@ cd ..
#
cp -r /mingw $install_root/
+# Move mingw/lib/gcc/i686-mingw32/libgcc_s_dw2-1.dll to mingw/bin/.
+#
+if [ -e $install_root/mingw/lib/gcc/i686-mingw32/libgcc_s_dw2-1.dll ]; then
+ mv $install_root/mingw/lib/gcc/i686-mingw32/libgcc_s_dw2-1.dll $install_root/mingw/bin/
+fi
+
# Move doc and man out of share/
#
rm -rf $install_root/doc $install_root/man
diff --git a/binary/mingw/gcc-4.7.2-mingw-cross.patch b/binary/mingw/gcc-4.7.2-mingw-cross.patch
new file mode 100644
index 0000000..ddfc8a3
--- /dev/null
+++ b/binary/mingw/gcc-4.7.2-mingw-cross.patch
@@ -0,0 +1,24 @@
+diff -ru -bB gcc-4.7.2/gcc/config/i386/mingw32.h gcc-cross/gcc/config/i386/mingw32.h
+--- gcc-4.7.2/gcc/config/i386/mingw32.h 2012-08-06 16:34:27.000000000 +0200
++++ gcc-cross/gcc/config/i386/mingw32.h 2013-02-10 06:30:59.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 -bB gcc-4.7.2/gcc/config.gcc gcc-cross/gcc/config.gcc
+--- gcc-4.7.2/gcc/config.gcc 2012-09-12 11:03:54.000000000 +0200
++++ gcc-cross/gcc/config.gcc 2013-02-10 06:31:22.000000000 +0200
+@@ -1477,7 +1477,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/gcc-4.7.2-mingw.patch b/binary/mingw/gcc-4.7.2-mingw.patch
new file mode 100644
index 0000000..757a51b
--- /dev/null
+++ b/binary/mingw/gcc-4.7.2-mingw.patch
@@ -0,0 +1,24 @@
+diff -ru -bB gcc-4.7.2/gcc/config/i386/mingw32.h gcc/gcc/config/i386/mingw32.h
+--- gcc-4.7.2/gcc/config/i386/mingw32.h 2012-08-06 16:34:27.000000000 +0200
++++ gcc/gcc/config/i386/mingw32.h 2013-02-09 18:52:51.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 -bB gcc-4.7.2/gcc/config.gcc gcc/gcc/config.gcc
+--- gcc-4.7.2/gcc/config.gcc 2012-09-12 11:03:54.000000000 +0200
++++ gcc/gcc/config.gcc 2013-02-09 18:59:10.000000000 +0200
+@@ -1477,7 +1477,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/gcc-4.7.2-static-plugin.patch b/binary/mingw/gcc-4.7.2-static-plugin.patch
new file mode 100644
index 0000000..d60f47d
--- /dev/null
+++ b/binary/mingw/gcc-4.7.2-static-plugin.patch
@@ -0,0 +1,142 @@
+diff -ru -bB gcc-4.7.2/gcc/config.in gcc/gcc/config.in
+--- gcc-4.7.2/gcc/config.in 2012-09-20 09:23:55.000000000 +0200
++++ gcc/gcc/config.in 2013-02-09 16:42:31.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 -bB gcc-4.7.2/gcc/configure.ac gcc/gcc/configure.ac
+--- gcc-4.7.2/gcc/configure.ac 2012-09-13 15:32:31.000000000 +0200
++++ gcc/gcc/configure.ac 2013-02-09 16:46:29.000000000 +0200
+@@ -5188,6 +5188,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 -bB gcc-4.7.2/gcc/cp/Make-lang.in gcc/gcc/cp/Make-lang.in
+--- gcc-4.7.2/gcc/cp/Make-lang.in 2011-11-09 19:53:53.000000000 +0200
++++ gcc/gcc/cp/Make-lang.in 2013-02-10 13:03:11.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 -bB gcc-4.7.2/gcc/opts-global.c gcc/gcc/opts-global.c
+--- gcc-4.7.2/gcc/opts-global.c 2011-11-03 16:46:26.000000000 +0200
++++ gcc/gcc/opts-global.c 2013-02-09 16:53:51.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 -bB gcc-4.7.2/gcc/plugin.c gcc/gcc/plugin.c
+--- gcc-4.7.2/gcc/plugin.c 2011-10-19 15:20:22.000000000 +0200
++++ gcc/gcc/plugin.c 2013-02-10 09:19:37.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 -bB gcc-4.7.2/gcc/plugin.h gcc/gcc/plugin.h
+--- gcc-4.7.2/gcc/plugin.h 2010-10-05 16:28:39.000000000 +0200
++++ gcc/gcc/plugin.h 2013-02-09 17:01:32.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/gcc-configure b/binary/mingw/gcc-configure
index 548ca30..016e7d2 100755
--- a/binary/mingw/gcc-configure
+++ b/binary/mingw/gcc-configure
@@ -1,28 +1,31 @@
#! /bin/sh
-../gcc-4.5.1/configure \
+# Try to configure a build similar to MinGW's.
+#
+# NOTE: update gcc-headers/ if changing the configuration.
+#
+../gcc/configure \
--with-pkgversion="ODB special" \
--with-bugurl="http://www.codesynthesis.com/products/odb/" \
---enable-threads=win32 \
---enable-version-specific-runtime-libs \
---enable-languages=c,c++ \
+--host i686-mingw32 \
+--target i686-mingw32 \
+--prefix=/mingw \
+--with-sysroot=/mingw \
--with-dwarf2 \
+--enable-languages=c,c++ \
--enable-shared \
+--enable-threads=win32 \
--disable-libssp \
--disable-libgomp \
+--disable-graphite \
+--enable-version-specific-runtime-libs \
--disable-sjlj-exceptions \
---disable-win32-registry \
--disable-nls \
--disable-multilib \
--disable-libstdcxx-pch \
---host i686-mingw32 \
---target i686-mingw32 \
---with-sysroot=/mingw \
---prefix=/mingw \
+--disable-libstdcxx-debug \
+--disable-bootstrap \
+--disable-win32-registry \
--enable-static-plugin \
--with-stage1-libs=libplugin-stub.a \
CFLAGS=-O2 CXXFLAGS=-O2 LDFLAGS=-s
-
-# --disable-shared
-
-#echo 'make STATIC_PLUGIN_LIBS="`pwd`/../odb-build/odb/.libs/odb.a `pwd`/../libcutl/cutl/.libs/libcutl.a -lstdc++"'
diff --git a/binary/mingw/gcc-cross-configure b/binary/mingw/gcc-cross-configure
new file mode 100755
index 0000000..eae0f5a
--- /dev/null
+++ b/binary/mingw/gcc-cross-configure
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+# Try to configure a build similar to MinGW's.
+#
+../gcc-cross/configure \
+--target i686-mingw32 \
+--prefix=/home/boris/work/odb/build/mingw/cross/mingw \
+--with-sysroot=/home/boris/work/odb/build/mingw/cross/mingw \
+--enable-languages=c,c++ \
+--enable-shared \
+--with-dwarf2 \
+--enable-threads=win32 \
+--disable-multilib \
+--disable-debug \
+--disable-libssp \
+--disable-libgomp \
+--disable-graphite \
+--disable-build-poststage1-with-cxx \
+--enable-version-specific-runtime-libs \
+--disable-sjlj-exceptions \
+--disable-libstdcxx-debug \
+--disable-win32-registry \
+--disable-nls \
+--with-gnu-as \
+--with-gnu-ld \
+CFLAGS=-O2 CXXFLAGS=-O2
diff --git a/binary/mingw/new-gcc-version b/binary/mingw/new-gcc-version
new file mode 100644
index 0000000..6642589
--- /dev/null
+++ b/binary/mingw/new-gcc-version
@@ -0,0 +1,73 @@
+An overview of steps required to switch to a new GCC version.
+
+1. Get the MinGW build of this version and get configuration
+ flags (gcc -v). The idea is to build both the cross-compiler
+ and the native compiler (with linked-in ODB plugin) as close
+ to the MinGW configuration as possible.
+
+2. Build the cross-compiler:
+
+ 1. Backup old cross/mingw to cross/mingw-X.Y.Z.
+ 2. Cleanup old GCC files from cross/mingw.
+ 3. Unpack GCC, rename to gcc-cross, create or clean gcc-cross-build.
+ 4. Adapt older gcc-X.Y.Z-mingw-cross.patch (--dry-run) and apply.
+ 5. Adapt gcc-cross-configure.
+ 6. Build & install:
+
+ cd gcc-cross-build
+ ../gcc-cross-configure
+ make -j 16
+ make install
+
+ 7. Clean up .so & .la files from cross/mingw/lib/gcc/i686-mingw/X.Y.Z
+ (we still seem to have to build with --enable-shared for exceptions
+ to work).
+ 8. Check that the compiler works. Compile and run sizeof_funds.cxx and
+ throw.cxx. There should be no auto-importing (see step 7).
+
+3. Build the native compiler:
+
+ 1. Unpack GCC, rename to gcc, create or clean gcc-build.
+ 2. Adapt older gcc-X.Y.Z-mingw.patch (--dry-run) and apply.
+ 3. Adapt older gcc-X.Y.Z-static-plugin.patch (--dry-run) and apply.
+ This step will probably require careful review of changes in the
+ plugin code (plugin.h and plugin.c).
+ 4. Regegerate configure script in gcc/gcc/. Use the same autoconf
+ version as in the original (see ~/build/autocond-X.Y). For example:
+
+ sudo make -C ~/build/autoconf-2.64 install
+ autoconf --version
+ cd gcc
+ autoconf
+ sudo make -C ~/build/autoconf-2.64 uninstall
+
+ 4. Adapt gcc-configure.
+ 5. Configure and make GCC manually:
+
+ export PATH=`pwd`/cross/mingw/bin:$PATH
+ cd gcc-build
+ ../gcc-configure
+ make -j 16
+
+ This step will fail due to lack of libplugin-stub.a. That's
+ ok. Copy .h and .def files from gcc-build/gcc/ to gcc-headers/
+ (backup old ones).
+
+4. Run the build-dist script with -rebuild
+
+ 1. If GCC build fails, then it can be re-configured or re-made
+ directly from the gcc-build directory provided you don't
+ clean it up (if you do so, you can manually copy libplugin-stub.a
+ to gcc-build/gcc/).
+
+ 2. Check the package for any stray directories/files.
+
+ 3. On Windows, check that:
+
+ - Compiler, including exceptions, work. Compile and run sizeof_funds.cxx
+ and throw.cxx.
+
+ - Make sure ODB runs, including throwing exceptions (run on object
+ with private data members).
+
+5. Copy updates/patches to odb/etc/.
diff --git a/binary/mingw/odb-configure b/binary/mingw/odb-configure
index 337c98f..318560d 100755
--- a/binary/mingw/odb-configure
+++ b/binary/mingw/odb-configure
@@ -9,6 +9,6 @@
--with-libcutl=../libcutl \
--with-gxx-name='..\\mingw\\bin\\g++.exe' \
--with-options-file='..\\etc\\odb\\default.options' \
-CPPFLAGS=-I`pwd`/../cross/mingw/include/plugin \
CXXFLAGS="-O2 -W -Wall" \
-LDFLAGS=-static-libgcc
+LDFLAGS=-static-libgcc \
+CPPFLAGS="-I`pwd`/../gcc-headers/gcc -I`pwd`/../gcc/gcc -I`pwd`/../gcc/libcpp/include -I`pwd`/../gcc/include"