[Libreoffice-commits] .: config_host.mk.in configure.ac download.lst external/CustomTarget_jawt.mk external/CustomTarget_mingw_dlls.mk external/CustomTarget_wine.mk external/dbghelp external/gcc3_specific external/glibc external/glibc-2.1.3.patch external/jawt external/Makefile external/mingw-dlls external/mingwheaders external/Module_external.mk external/msm100 external/msm110 external/msm90 external/msvcp100 external/msvcp110 external/msvcp80 external/msvcp90 external/Package_dbghelp.mk external/Package_jawt.mk external/Package_mingw_dlls.mk external/Package_msms.mk external/Package_msvc_dlls.mk external/Package_wine.mk external/prj external/StaticLibrary_gnu_getopt.mk external/StaticLibrary_gnu_readdir_r.mk external/unowinreg external/UnpackedTarball_glibc.mk .gitignore Makefile.fetch readlicense_oo/txt Repository.mk RepositoryModule_ooo.mk vcl/Library_vcl.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 25 00:41:05 PST 2012


 .gitignore                                    |    7 
 Makefile.fetch                                |    3 
 Repository.mk                                 |    2 
 RepositoryModule_ooo.mk                       |    1 
 config_host.mk.in                             |    4 
 configure.ac                                  |   95 -
 download.lst                                  |    2 
 external/CustomTarget_jawt.mk                 |   25 
 external/CustomTarget_mingw_dlls.mk           |   83 +
 external/CustomTarget_wine.mk                 |   23 
 external/Makefile                             |    7 
 external/Module_external.mk                   |   50 
 external/Package_dbghelp.mk                   |   14 
 external/Package_jawt.mk                      |   14 
 external/Package_mingw_dlls.mk                |   16 
 external/Package_msms.mk                      |   16 
 external/Package_msvc_dlls.mk                 |   16 
 external/Package_wine.mk                      |   18 
 external/StaticLibrary_gnu_getopt.mk          |   29 
 external/StaticLibrary_gnu_readdir_r.mk       |   28 
 external/UnpackedTarball_glibc.mk             |   23 
 external/dbghelp/README_dbghelp.dll           |    1 
 external/gcc3_specific/makefile.mk            |   43 
 external/glibc-2.1.3.patch                    |  210 --
 external/glibc/config.h                       |   40 
 external/glibc/glibc-2.1.3.patch              |   29 
 external/glibc/makefile.mk                    |   71 
 external/glibc/readdir_r.c                    |   54 
 external/jawt/makefile.mk                     |   42 
 external/mingw-dlls/makefile.mk               |  124 -
 external/mingwheaders/makefile.mk             |  213 --
 external/mingwheaders/mingw_atl_headers.patch | 1654 --------------------
 external/mingwheaders/mingw_headers.patch     | 2130 --------------------------
 external/msm100/README_msm100.txt             |    6 
 external/msm110/README_msm110.txt             |    6 
 external/msm90/README_msm90.txt               |   10 
 external/msvcp100/README_msvcX100.dll         |    2 
 external/msvcp110/README_msvcX110.dll         |    2 
 external/msvcp80/README_msvcX80.dll           |    3 
 external/msvcp90/README_msvcX90.dll           |    2 
 external/prj/build.lst                        |    6 
 external/prj/d.lst                            |   62 
 external/unowinreg/README                     |    2 
 readlicense_oo/txt/license.txt                |  298 +++
 vcl/Library_vcl.mk                            |    2 
 45 files changed, 835 insertions(+), 4653 deletions(-)

New commits:
commit 5b0d2d02a51dcf6c4235124f7d92280877fbb3df
Author: Peter Foley <pefoley2 at verizon.net>
Date:   Mon Dec 17 17:48:00 2012 -0500

    convert external to gbuild
    
    Change-Id: I7127db6aad9e97a0f3e758aa83b22ac8465d3f43

diff --git a/.gitignore b/.gitignore
index 08fb164..fe264e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,13 +98,6 @@
 /*/*.exe
 /solenv/gdb/libreoffice/*.pyo
 /solenv/gdb/libreoffice/util/*.pyo
-
-# external dlls etc: that should be reworkded too.
-/external/*/*.dll
-/external/*/*.exe
-/external/*/*.manifest
-/external/*/*.txt
-/external/*/*.msm
 /moz/zipped/*.zip
 
 
diff --git a/Makefile.fetch b/Makefile.fetch
index 161dc40..4b60d7b 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -79,7 +79,6 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,VISIO,VISIO_TARBALL) \
 	,$(call fetch_Download_item_special,http://dev-www.libreoffice.org/src,$(item)))
 	$(foreach item, \
-		4a660ce8466c9df01f19036435425c3a-glibc-2.1.3-stub.tar.gz \
 		$(call fetch_Optional,AFMS,$(AFMS_TARBALL)) \
 		$(call fetch_Optional,APACHE_COMMONS,$(APACHE_COMMONS_CODEC_TARBALL)) \
 		$(call fetch_Optional,APACHE_COMMONS,$(APACHE_COMMONS_HTTPCLIENT_TARBALL)) \
@@ -93,6 +92,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,CPPUNIT,$(CPPUNIT_TARBALL)) \
 		$(call fetch_Optional,CT2N,$(CT2N_TARBALL)) \
 		$(call fetch_Optional,CURL,$(CURL_TARBALL)) \
+		$(call fetch_Optional,DBGHELP,$(DBGHELP_DLL)) \
 		$(call fetch_Optional,EPM,$(EPM_TARBALL)) \
 		$(call fetch_Optional,EXPAT,$(EXPAT_TARBALL)) \
 		$(call fetch_Optional,MORE_FONTS,$(FONT_DEJAVU_TARBALL)) \
@@ -108,6 +108,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,FREETYPE,$(FREETYPE_TARBALL)) \
 		$(GOOGLE_DOCS_EXTENSION_PACK) \
 		$(call fetch_Optional,GRAPHITE,$(GRAPHITE_TARBALL)) \
+		$(call fetch_Optional,GLIBC,$(GLIBC_TARBALL)) \
 		$(call fetch_Optional,HSQLDB,$(HSQLDB_TARBALL)) \
 		$(call fetch_Optional,HUNSPELL,$(HUNSPELL_TARBALL)) \
 		$(call fetch_Optional,HYPHEN,$(HYPHEN_TARBALL)) \
diff --git a/Repository.mk b/Repository.mk
index 46a0979..79a56bd 100755
--- a/Repository.mk
+++ b/Repository.mk
@@ -648,6 +648,8 @@ $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
     cosv \
     dtobj \
 	findsofficepath \
+	gnu_getopt \
+	gnu_readdir_r \
     headless \
     libeay32 \
     npsoenv \
diff --git a/RepositoryModule_ooo.mk b/RepositoryModule_ooo.mk
index e747178..4ddde55 100644
--- a/RepositoryModule_ooo.mk
+++ b/RepositoryModule_ooo.mk
@@ -76,6 +76,7 @@ $(eval $(call gb_Module_add_moduledirs,ooo,\
 	eventattacher \
 	$(call gb_Helper_optional,EXPAT,expat) \
 	extensions \
+	external \
 	extras \
 	fileaccess \
 	filter \
diff --git a/config_host.mk.in b/config_host.mk.in
index 34f7708..2545cf3 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -324,6 +324,7 @@ export MAC_OS_X_VERSION_MIN_REQUIRED=@MAC_OS_X_VERSION_MIN_REQUIRED@
 export MD5SUM=@MD5SUM@
 export MDDS_CPPFLAGS=$(gb_SPACE)@MDDS_CPPFLAGS@
 export MERGELIBS=@MERGELIBS@
+export MERGE_MODULES=@MERGE_MODULES@
 export MFC_INCLUDE=@MFC_INCLUDE@
 export MFC_LIB=@MFC_LIB@
 export MINGWCXX=@MINGWCXX@
@@ -388,6 +389,9 @@ export MKDEPENDSOLVER=TRUE
 export ML_EXE=@ML_EXE@
 export MOC4=@MOC4@
 export MOC=@MOC@
+export MSM_PATH=@MSM_PATH@
+export MSVC_DLL_PATH=@MSVC_DLL_PATH@
+export MSVC_DLLS=@MSVC_DLLS@
 export NPAPI_HEADERS_CFLAGS=$(gb_SPACE)@NPAPI_HEADERS_CFLAGS@
 export MSPUB_CFLAGS=$(gb_SPACE)@MSPUB_CFLAGS@
 export MSPUB_LIBS=$(gb_SPACE)@MSPUB_LIBS@
diff --git a/configure.ac b/configure.ac
index b0d85b9..032c9c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3292,9 +3292,8 @@ AC_SUBST(SHOWINCLUDES_PREFIX)
 # dbghelp.dll
 #
 if test "$_os" == "WINNT"; then
-    DBGHELP_DLL="13fbc2e8b37ddf28181dd6d8081c2b8e-dbghelp.dll"
+    BUILD_TYPE="$BUILD_TYPE DBGHELP"
 fi
-AC_SUBST(DBGHELP_DLL)
 
 #
 # unowinreg.dll
@@ -4876,8 +4875,7 @@ find_winsdk()
     done
 }
 
-#TODO: move copy_* functions to external/ module once gbuildified
-copy_msms()
+find_msms()
 {
     for ver in 9.0 10.0 11.0; do
         reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
@@ -4894,65 +4892,43 @@ copy_msms()
         AC_MSG_ERROR([Merge modules not found])
     fi
 
-    if test $VCVER -eq 90; then
-        cp $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm ./external/msm90
-        if test $? -ne 0; then
-            AC_MSG_ERROR([Failed to copy merge modules])
-        fi
-    fi
-    cp $msmdir/Microsoft_VC${VCVER}_CRT_x86.msm ./external/msm${VCVER}
-    if test $? -ne 0; then
-        AC_MSG_ERROR([Failed to copy merge modules])
-    fi
-    cp $msmdir/Microsoft_VC${VCVER}_CRT_x64.msm ./external/msm${VCVER}
-    if test $? -ne 0; then
+    msms="Microsoft_VC${VCVER}_CRT_x86.msm"
+    if test -e $msmdir/Microsoft_VC${VCVER}_CRT_x64.msm; then
+        msms="$msms Microsoft_VC${VCVER}_CRT_x64.msm"
+    else
         AC_MSG_WARN([Failed to copy x64 merge modules, installation will lack the 64-bit Explorer extension])
     fi
+    if test "$VCVER" = "90"; then
+        if test -e $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm; then
+            msms="$msms policy_9_0_Microsoft_VC90_CRT_x86.msm"
+        else
+            AC_MSG_ERROR([Merge modules not found])
+        fi
+    fi
 }
 
-copy_msvc_dlls()
+find_msvc_dlls()
 {
-    if test $CPUNAME == INTEL; then
+    if test "$CPUNAME" = "INTEL"; then
         vsarch=x86
     else
         vsarch=amd64
     fi
 
-    if test -f $VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT/msvcp${VCVER}.dll; then
-        vsdlldir=$VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT
-    else
-        AC_MSG_ERROR([can not find VS dll $VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT/msvcp${VCVER}.dll])
+    msvcdllpath="$VC_PRODUCT_DIR/redist/$vsarch/Microsoft.VC${VCVER}.CRT"
+    msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
+    if test "$VCVER" = "90"; then
+        msvcdlls="$msvcdlls msvcm90.dll Microsoft.VC90.CRT.manifest"
     fi
 
-    cp $vsdlldir/msvcp${VCVER}.dll $vsdlldir/msvcr${VCVER}.dll ./external/msvcp${VCVER}
-
-    if test $VCVER == 90; then
-        cp $vsdlldir/msvcm${VCVER}.dll $vsdlldir/Microsoft.VC90.CRT.manifest ./external/msvcp${VCVER}
-        if test $? -ne 0; then
-            AC_MSG_ERROR([Failed to copy VS dlls])
+    for dll in $msvcdlls; do
+        if ! test -f "$msvcdllpath/$dll"; then
+            AC_MSG_ERROR([can not find $dll in $msvcdllpath])
         fi
-    fi
-}
-
-copy_dbghelp_dll()
-{
-    if test ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/$DBGHELP_DLL; then
-        cp $TARFILE_LOCATION/$DBGHELP_DLL ./external/dbghelp/dbghelp.dll;
-    fi
-    if test ! -f ./external/dbghelp/dbghelp.dll; then
-        echo "dbghelp.dll is missing in external/dbghelp/."
-        echo "Get it from the Microsoft site and put it there."
-        echo "(Note: Microsoft seems to enjoy changing the exact location of this file."
-        echo "You may have to search Microsoft's website.) Last time it was seen at:"
-        echo "<http://www.microsoft.com/downloads/release.asp?releaseid=30682>."
-        exit 1
-    fi
+    done
 }
 
 if test "$build_os" = "cygwin"; then
-    copy_msvc_dlls
-    copy_dbghelp_dll
-
     dnl Check midl.exe
     AC_MSG_CHECKING([for midl.exe])
 
@@ -5967,16 +5943,20 @@ if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
 fi
 AC_SUBST([JITC_PROCESSOR_TYPE])
 
+# Misc Windows Stuff
 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
-    AC_MSG_CHECKING([for Microsoft_VC${VCVER}_CRT_x86.msm])
-        copy_msms
-    if test -n $msms_copied ; then
-        AC_MSG_RESULT([yes])
-        SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
-    else
-        AC_MSG_RESULT([no])
-    fi
+    find_msvc_dlls
+    find_msms
+    MSVC_DLL_PATH="$msvcdllpath"
+    MSVC_DLLS="$msvcdlls"
+    MSM_PATH="$msmdir"
+    MERGE_MODULES="$msms"
+    SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
 fi
+AC_SUBST(MSVC_DLL_PATH)
+AC_SUBST(MSVC_DLLS)
+AC_SUBST(MSM_PATH)
+AC_SUBST(MERGE_MODULES)
 
 dnl ===================================================================
 dnl Checks for Java
@@ -8974,6 +8954,11 @@ else
     HAVE_READDIR_R=NO
     SYSTEM_LIBC=YES
 fi
+
+if test "$HAVE_GETOPT" = NO -o "$HAVE_READDIR_R" = NO; then
+    BUILD_TYPE="$BUILD_TYPE GLIBC"
+fi
+
 AC_SUBST(HAVE_GETOPT)
 AC_SUBST(HAVE_READDIR_R)
 AC_SUBST(SYSTEM_LIBC)
diff --git a/download.lst b/download.lst
index 3abd8ed..cea356c 100644
--- a/download.lst
+++ b/download.lst
@@ -18,6 +18,7 @@ export CMIS_TARBALL := b2371dc7cf4811c9d32146eec913d296-libcmis-0.3.0.tar.gz
 export CPPUNIT_TARBALL := ac4781e01619be13461bb2d562b94a7b-cppunit-1.13.1.tar.gz
 export CT2N_TARBALL := 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
 export CURL_TARBALL := 3fa4d5236f2a36ca5c3af6715e837691-curl-7.26.0.tar.gz
+export DBGHELP_DLL := 4003e34416ebd25e4c115d49dc15e1a7-dbghelp.dll
 export EPM_TARBALL := 3ade8cfe7e59ca8e65052644fed9fca4-epm-3.7.tar.gz
 export EXPAT_TARBALL := dd7dab7a5fea97d2a6a43f511449b7cd-expat-2.1.0.tar.gz
 export FONTCONFIG_TARBALL := 77e15a92006ddc2adbb06f840d591c0e-fontconfig-2.8.0.tar.gz
@@ -32,6 +33,7 @@ export FONT_SOURCECODE_TARBALL := 0279a21fab6f245e85a6f85fea54f511-source-code-f
 export FONT_SOURCESANS_TARBALL := 1e9ddfe25ac9577da709d7b2ea36f939-source-sans-font-1.036.tar.gz
 export FREETYPE_TARBALL := dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
 export GRAPHITE_TARBALL := f5ef3f7f10fa8c3542c6a085a233080b-graphite2-1.2.0.tgz
+export GLIBC_TARBALL := 4a660ce8466c9df01f19036435425c3a-glibc-2.1.3-stub.tar.gz
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
 export HUNSPELL_TARBALL := 3121aaf3e13e5d88dfff13fb4a5f1ab8-hunspell-1.3.2.tar.gz
 export HYPHEN_TARBALL := a2f6010987e1c601274ab5d63b72c944-hyphen-2.8.4.tar.gz
diff --git a/external/CustomTarget_jawt.mk b/external/CustomTarget_jawt.mk
new file mode 100644
index 0000000..72b9cc5
--- /dev/null
+++ b/external/CustomTarget_jawt.mk
@@ -0,0 +1,25 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,external/jawt))
+
+$(eval $(call gb_CustomTarget_register_target,external/jawt,libjawt.dll.a))
+
+$(call gb_CustomTarget_get_workdir,external/jawt)/jawt.def:| \
+	$(call gb_CustomTarget_get_workdir,external/jawt)/.dir
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
+	echo EXPORTS > $@
+	echo "JAWT_GetAWT at 8" >> $@
+
+$(call gb_CustomTarget_get_target,external/jawt)/libjawt.dll.a: \
+	$(call gb_CustomTarget_get_workdir,external/jawt)/jawt.def
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),DLT,1)
+	$(DLLTOOL) --input-def=$< --output-lib=$@ --dllname=jawt.dll
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/CustomTarget_mingw_dlls.mk b/external/CustomTarget_mingw_dlls.mk
new file mode 100644
index 0000000..c1d240c
--- /dev/null
+++ b/external/CustomTarget_mingw_dlls.mk
@@ -0,0 +1,83 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,external/mingw-dlls))
+
+MINGW_DLLS := \
+    $(MINGW_BOOST_DATE_TIME_DLL) \
+    $(MINGW_CAIRO_DLL) \
+    $(MINGW_CRYPTO_DLL) \
+    $(MINGW_CURL_DLL) \
+    $(MINGW_EXPAT_DLL) \
+    $(MINGW_FONTCONFIG_DLL) \
+    $(MINGW_FREETYPE_DLL) \
+    $(MINGW_GCRYPT_DLL) \
+    $(MINGW_GLIB_DLL) \
+    $(MINGW_GMODULE_DLL) \
+    $(MINGW_GNUTLS_DLL) \
+    $(MINGW_GPG_ERROR_DLL) \
+    $(MINGW_GRAPHITE2_DLL) \
+    $(MINGW_HUNSPELL_DLL) \
+    $(MINGW_HYPHEN_DLL) \
+    $(MINGW_ICONV_DLL) \
+    $(MINGW_ICUDATA_DLL) \
+    $(MINGW_ICUI18N_DLL) \
+    $(MINGW_ICUUC_DLL) \
+    $(MINGW_IDN_DLL) \
+    $(MINGW_INTL_DLL) \
+    $(MINGW_JPEG_DLL) \
+    $(MINGW_LCMS2_DLL) \
+    $(MINGW_LIBEXSLT_DLL) \
+    $(MINGW_LIBLANGTAG_DLL) \
+    $(MINGW_LIBXML_DLL) \
+    $(MINGW_LIBXSLT_DLL) \
+    $(MINGW_LPSOLVE_DLL) \
+    $(MINGW_MYTHES_DLL) \
+    $(MINGW_NEON_DLL) \
+    $(MINGW_NSPR4_DLL) \
+    $(MINGW_NSS3_DLL) \
+    $(MINGW_NSSUTIL3_DLL) \
+    $(MINGW_PIXMAN_DLL) \
+    $(MINGW_PYTHON_DLL) \
+    $(MINGW_PYTHON_EXE) \
+    $(MINGW_PLC4_DLL) \
+    $(MINGW_PLDS4_DLL) \
+    $(MINGW_PNG15_DLL) \
+    $(MINGW_POPPLER_DLL) \
+    $(MINGW_RAPTOR_DLL) \
+    $(MINGW_RASQAL_DLL) \
+    $(MINGW_READLINE_DLL) \
+    $(MINGW_REDLAND_DLL) \
+    $(MINGW_SQLITE3_DLL) \
+    $(MINGW_SMIME3_DLL) \
+    $(MINGW_SSH2_DLL) \
+    $(MINGW_SSL3_DLL) \
+    $(MINGW_SSL_DLL) \
+    $(MINGW_TASN1_DLL) \
+    $(MINGW_TERMCAP_DLL) \
+    $(MINGW_ZLIB_DLL) \
+    $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),$(MINGW_GCCDLL)) \
+    $(if $(filter YES,$(MINGW_SHARED_GXXLIB)),$(MINGW_GXXDLL))
+
+POTENTIAL_MINGW_RUNTIME_BINDIRS := \
+	$(COMPATH)/$(HOST_PLATFORM)/sys-root/mingw/bin \
+	/usr/$(HOST_PLATFORM)/sys-root/mingw/bin
+
+$(eval $(call gb_CustomTarget_register_targets,external/wine,\
+	$(MINGW_DLLS) \
+))
+
+$(call gb_CustomTarget_get_workdir,external/mingw-dlls)/%.dll: $(firstword $(wildcard $(foreach dir,$(POTENTIAL_MINGW_RUNTIME_BINDIRS), $(dir)/%)))
+	if ! test -f $<; then \
+		echo Could not find $*.dll in any of $(POTENTIAL_MINGW_RUNTIME_BINDIRS); \
+	fi
+	$(call gb_Output_announce,$*,$(true),CPY,1)
+	cp $< $*
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/CustomTarget_wine.mk b/external/CustomTarget_wine.mk
new file mode 100644
index 0000000..7796e8c
--- /dev/null
+++ b/external/CustomTarget_wine.mk
@@ -0,0 +1,23 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,external/wine))
+
+$(eval $(call gb_CustomTarget_register_targets,external/wine,\
+	libgdiplus.dll.a \
+	libmsi.dll.a \
+	liburlmod.dll.a \
+))
+
+$(call gb_CustomTarget_get_target,external/wine)/lib%.dll.a: $(call gb_CustomTarget_get_workdir,external/wine)/%.def | \
+	$(call gb_CustomTarget_get_workdir,external/wine)/.dir
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),DLT,1)
+	$(DLLTOOL) --kill-at --input-def=$< --output-lib=$@ --dllname=$*.dll
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Makefile b/external/Makefile
new file mode 100644
index 0000000..ccb1c85
--- /dev/null
+++ b/external/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/Module_external.mk b/external/Module_external.mk
new file mode 100644
index 0000000..151ecdd
--- /dev/null
+++ b/external/Module_external.mk
@@ -0,0 +1,50 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,external))
+
+$(eval $(call gb_Module_add_targets,external,\
+))
+
+ifeq ($(GUI)$(COM),WNTGCC)
+$(eval $(call gb_Module_add_targets,external,\
+	CustomTarget_jawt \
+	CustomTarget_mingw_dlls \
+	CustomTarget_wine \
+	Package_jawt \
+	Package_mingw_dlls \
+	Package_wine \
+))
+endif
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_Module_add_targets,external,\
+	Package_dbghelp \
+	Package_msms \
+	Package_msvc_dlls \
+))
+endif
+
+ifeq ($(HAVE_GETOPT),NO)
+$(eval $(call gb_Module_add_targets,external,\
+	UnpackedTarball_glibc \
+	StaticLibrary_gnu_getopt \
+))
+endif
+
+ifeq ($(HAVE_READDIR_R),NO)
+ifneq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,external,\
+	$(if $(filter YES,$(HAVE_GETOPT)),UnpackedTarball_glibc) \
+	StaticLibrary_gnu_readdir_r \
+))
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/Package_dbghelp.mk b/external/Package_dbghelp.mk
new file mode 100644
index 0000000..4387839
--- /dev/null
+++ b/external/Package_dbghelp.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,dbghelp,$(TARFILE_LOCATION)))
+
+$(eval $(call gb_Package_add_file,dbghelp,bin/dbghelp.dll,$(DBGHELP_DLL)))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Package_jawt.mk b/external/Package_jawt.mk
new file mode 100644
index 0000000..f5e3743
--- /dev/null
+++ b/external/Package_jawt.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,jawt,$(call gb_CustomTarget_get_workdir,external/jawt)))
+
+$(eval $(call gb_Package_add_file,jawt,libjawt.dll.a,lib/libjawt.dll.a))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Package_mingw_dlls.mk b/external/Package_mingw_dlls.mk
new file mode 100755
index 0000000..eb7e726
--- /dev/null
+++ b/external/Package_mingw_dlls.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,mingw_dlls,$(call gb_CustomTarget_get_workdir,external/mingw_dlls)))
+
+$(eval $(call gb_Package_add_files,mingw_dlls,bin,\
+	$(MINGW_DLLS) \
+))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Package_msms.mk b/external/Package_msms.mk
new file mode 100755
index 0000000..283e113
--- /dev/null
+++ b/external/Package_msms.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,msms,$(MSM_PATH)))
+
+$(eval $(call gb_Package_add_files,msms,bin,\
+	$(MERGE_MODULES) \
+))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Package_msvc_dlls.mk b/external/Package_msvc_dlls.mk
new file mode 100755
index 0000000..b8bec8f
--- /dev/null
+++ b/external/Package_msvc_dlls.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,msvc_dlls,$(MSVC_DLL_PATH)))
+
+$(eval $(call gb_Package_add_files,msvc_dlls,bin,\
+	$(MSVC_DLLS) \
+))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/Package_wine.mk b/external/Package_wine.mk
new file mode 100644
index 0000000..64ee28c
--- /dev/null
+++ b/external/Package_wine.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,dbghelp,$(call gb_CustomTarget_get_workdir,external/wine)))
+
+$(eval $(call gb_Package_add_files,dbghelp,lib,\
+	gdiplus.dll.a \
+	msi.dll.a \
+	urlmon.dll.a \
+))
+
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/StaticLibrary_gnu_getopt.mk b/external/StaticLibrary_gnu_getopt.mk
new file mode 100644
index 0000000..aeccb38
--- /dev/null
+++ b/external/StaticLibrary_gnu_getopt.mk
@@ -0,0 +1,29 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,gnu_getopt))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,gnu_getopt,glibc))
+
+$(eval $(call gb_StaticLibrary_set_include,gnu_getopt,\
+    -I$(call gb_UnpackedTarball_get_dir,glibc) \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_defs,gnu_getopt,\
+    -DHAVE_STRING_H \
+    -DHAVE_CONFIG_H \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,gnu_getopt,\
+    UnpackedTarball/glibc/posix/getopt \
+    UnpackedTarball/glibc/posix/getopt1 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/StaticLibrary_gnu_readdir_r.mk b/external/StaticLibrary_gnu_readdir_r.mk
new file mode 100644
index 0000000..51a618e
--- /dev/null
+++ b/external/StaticLibrary_gnu_readdir_r.mk
@@ -0,0 +1,28 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,gnu_readdir_r))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,gnu_readdir_r,glibc))
+
+$(eval $(call gb_StaticLibrary_set_include,gnu_readdir_r,\
+    -I$(call gb_UnpackedTarball_get_dir,glibc) \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_defs,gnu_readdir_r,\
+    -DHAVE_STRING_H \
+    -DHAVE_CONFIG_H \
+))
+
+$(eval $(call gb_StaticLibrary_add_cobjects,gnu_readdir_r,\
+    external/glibc/readdir_r \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/UnpackedTarball_glibc.mk b/external/UnpackedTarball_glibc.mk
new file mode 100644
index 0000000..40bd1f6
--- /dev/null
+++ b/external/UnpackedTarball_glibc.mk
@@ -0,0 +1,23 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,glibc))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,glibc,$(GLIBC_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_add_files,glibc,posix,\
+	external/glibc/config.h \
+	external/glibc/readdir_r.c \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,glibc,\
+	external/glibc/glibc-2.1.3.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/dbghelp/README_dbghelp.dll b/external/dbghelp/README_dbghelp.dll
deleted file mode 100644
index 984cf0e..0000000
--- a/external/dbghelp/README_dbghelp.dll
+++ /dev/null
@@ -1 +0,0 @@
-Put the dbghelp.dll in this directory for Windows builds.
diff --git a/external/gcc3_specific/makefile.mk b/external/gcc3_specific/makefile.mk
deleted file mode 100644
index 501acfa..0000000
--- a/external/gcc3_specific/makefile.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-PRJ=..
-PRJNAME=external
-TARGET=gcc3_specific
-
-# ------------------------------------------------------------------
-.INCLUDE: settings.mk
-# ------------------------------------------------------------------
-
-.IF "$(SYSTEM_STDLIBS)" != "YES" && "$(COMID)"=="gcc3"
-
-.IF "$(OS)"!="MACOSX" && "$(OS)"!="IOS" && "$(OS)"!="ANDROID" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" && "$(OS)"!="OPENBSD" && "$(OS)"!="DRAGONFLY"
-
-.EXPORT : CC
-
-.IF "$(OS)"=="AIX"
-
-all .SEQUENTIAL : $(LB)$/libstdc++.a $(LB)$/libgcc_s.a
-
-$(LB)$/libstdc++.a :
-    $(GCCINSTLIB) libstdc++.a $(LB)
-
-$(LB)$/libgcc_s.a :
-    $(GCCINSTLIB) libgcc_s.a $(LB)
-
-.ELSE
-
-all .SEQUENTIAL : $(LB)$/libstdc++.so.$(SHORTSTDCPP3) $(LB)$/libgcc_s.so.$(SHORTSTDC3)
-
-
-$(LB)$/libstdc++.so.$(SHORTSTDCPP3) :
-    $(GCCINSTLIB) libstdc++.so.$(SHORTSTDCPP3) $(LB)
-
-$(LB)$/libgcc_s.so.$(SHORTSTDC3) :
-    $(GCCINSTLIB) libgcc_s.so.$(SHORTSTDC3) $(LB)
-
-.ENDIF
-
-.ENDIF 
-
-.ENDIF
-
-.INCLUDE: target.mk
-
diff --git a/external/glibc-2.1.3.patch b/external/glibc-2.1.3.patch
deleted file mode 100644
index 8d23c95..0000000
--- a/external/glibc-2.1.3.patch
+++ /dev/null
@@ -1,210 +0,0 @@
---- misc/glibc-2.1.3/posix/config.h	Mon Mar 31 09:43:50 2008
-+++ misc/build/glibc-2.1.3/posix/config.h	Mon Mar 31 09:43:26 2008
-@@ -1 +1,42 @@
--dummy
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifdef WNT
-+#include <stdlib.h>
-+#define getenv getenv
-+#endif
-+
-+
-+#if defined(MACOSX)
-+//Workaround for MACOS
-+#define getopt my_neues_getopt
-+#define opterr my_neues_opterr
-+#define optind my_neues_optind
-+#define optopt my_neues_optopt
-+#endif
-+
-+
---- misc/glibc-2.1.3/posix/getopt.h	Sun Aug 27 16:11:33 2000
-+++ misc/build/glibc-2.1.3/posix/getopt.h	Mon Mar 31 09:42:01 2008
-@@ -131,7 +131,7 @@
- /* Many other libraries have conflicting prototypes for getopt, with
-    differences in the consts, in stdlib.h.  To avoid compilation
-    errors, only prototype getopt for the GNU C library.  */
--extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
-+extern int getopt (int argc, char *const *argv, const char *shortopts);
- # else /* not __GNU_LIBRARY__ */
- extern int getopt ();
- # endif /* __GNU_LIBRARY__ */
-@@ -137,14 +137,14 @@
- # endif /* __GNU_LIBRARY__ */
- 
- # ifndef __need_getopt
--extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
-+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- 		        const struct option *__longopts, int *__longind);
--extern int getopt_long_only (int __argc, char *const *__argv,
-+extern int getopt_long_only (int argc, char *const *argv,
- 			     const char *__shortopts,
- 		             const struct option *__longopts, int *__longind);
- 
- /* Internal only.  Users should not call this directly.  */
--extern int _getopt_internal (int __argc, char *const *__argv,
-+extern int _getopt_internal (int argc, char *const *argv,
- 			     const char *__shortopts,
- 		             const struct option *__longopts, int *__longind,
- 			     int __long_only);
---- misc/glibc-2.1.3/posix/makefile.mk	Mon Mar 31 09:43:50 2008
-+++ misc/build/glibc-2.1.3/posix/makefile.mk	Mon Mar 31 09:43:38 2008
-@@ -1 +1,71 @@
--dummy
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2000, 2010 Oracle and/or its affiliates.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU Lesser General Public License version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..$/..$/..$/..
-+
-+PRJNAME=external
-+TARGET=gnu_getopt
-+LIBTARGET=NO
-+
-+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-+
-+SOLARINC+=-I.. 
-+UWINAPILIB=
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE :  settings.mk
-+
-+CDEFS+=-DHAVE_STRING_H  -DHAVE_CONFIG_H
-+
-+# --- Files --------------------------------------------------------
-+
-+.IF "$(HAVE_GETOPT)" != "YES"
-+OBJFILES=	$(OBJ)$/getopt.obj		\
-+			$(OBJ)$/getopt1.obj
-+
-+LIB1TARGET=$(SLB)$/$(TARGET).lib
-+LIB1ARCHIV=$(LB)$/lib$(TARGET).a
-+LIB1OBJFILES=$(OBJFILES)
-+.ENDIF
-+
-+.IF "$(HAVE_READDIR_R)" != "YES" && "$(OS)" != "WNT"
-+TARGET2=gnu_readdir_r
-+OBJFILES+= $(OBJ)$/readdir_r.obj
-+LIB2TARGET=$(SLB)$/$(TARGET2).lib
-+LIB2ARCHIV=$(LB)$/lib$(TARGET2).a
-+LIB2OBJFILES= $(OBJ)$/readdir_r.obj
-+.ENDIF
-+
-+.IF "$(HAVE_READDIR_R)" == "YES" && "$(HAVE_GETOPT)" == "YES"
-+ at all:
-+	@echo "Nothing to do here.
-+.ENDIF
-+
-+# --- Targets ------------------------------------------------------
-+
-+.INCLUDE :  target.mk
---- misc/glibc-2.1.3/posix/readdir_r.c	Mon Mar 31 09:43:50 2008
-+++ misc/build/glibc-2.1.3/posix/readdir_r.c	Mon Mar 31 09:42:01 2008
-@@ -1 +1,56 @@
--dummy
-+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Library General Public License as
-+   published by the Free Software Foundation; either version 2 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Library General Public License for more details.
-+
-+   You should have received a copy of the GNU Library General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <limits.h>
-+#include <stddef.h>
-+#include <string.h>
-+#include <dirent.h>
-+#include <unistd.h>
-+#include <sys/types.h>
-+#include <assert.h>
-+
-+#ifndef __READDIR_R
-+# define __READDIR_R readdir_r
-+# define DIRENT_TYPE struct dirent
-+#endif
-+
-+/* Read a directory entry from DIRP.  */
-+int
-+__READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
-+{
-+  DIRENT_TYPE *dp;
-+  size_t reclen;
-+
-+  errno = 0; 
-+  /* call our non-reentrant counterpart to get the information */
-+  dp = readdir(dirp);
-+
-+  /* copy the result into entry */
-+  if (dp != NULL) {
-+    reclen = dp->d_reclen;           /* This might be NetBSD-specific 
-+				      * Add #ifdef's if anything else needed */
-+    *result = memcpy(entry, dp, reclen); 
-+  } else {
-+    *result = NULL;
-+  }
-+
-+  return dp != NULL ? 0 : errno ? errno : 0; 
-+}
-+
-+
diff --git a/external/glibc/config.h b/external/glibc/config.h
new file mode 100644
index 0000000..c5df8d8
--- /dev/null
+++ b/external/glibc/config.h
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef WNT
+#include <stdlib.h>
+#define getenv getenv
+#endif
+
+
+#if defined(MACOSX)
+//Workaround for MACOS
+#define getopt my_neues_getopt
+#define opterr my_neues_opterr
+#define optind my_neues_optind
+#define optopt my_neues_optopt
+#endif
diff --git a/external/glibc/glibc-2.1.3.patch b/external/glibc/glibc-2.1.3.patch
new file mode 100644
index 0000000..bedaad0
--- /dev/null
+++ b/external/glibc/glibc-2.1.3.patch
@@ -0,0 +1,29 @@
+--- misc/glibc-2.1.3/posix/getopt.h	Sun Aug 27 16:11:33 2000
++++ misc/build/glibc-2.1.3/posix/getopt.h	Mon Mar 31 09:42:01 2008
+@@ -131,7 +131,7 @@
+ /* Many other libraries have conflicting prototypes for getopt, with
+    differences in the consts, in stdlib.h.  To avoid compilation
+    errors, only prototype getopt for the GNU C library.  */
+-extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
++extern int getopt (int argc, char *const *argv, const char *shortopts);
+ # else /* not __GNU_LIBRARY__ */
+ extern int getopt ();
+ # endif /* __GNU_LIBRARY__ */
+@@ -137,14 +137,14 @@
+ # endif /* __GNU_LIBRARY__ */
+
+ # ifndef __need_getopt
+-extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
++extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+		        const struct option *__longopts, int *__longind);
+-extern int getopt_long_only (int __argc, char *const *__argv,
++extern int getopt_long_only (int argc, char *const *argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind);
+
+ /* Internal only.  Users should not call this directly.  */
+-extern int _getopt_internal (int __argc, char *const *__argv,
++extern int _getopt_internal (int argc, char *const *argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind,
+			     int __long_only);
diff --git a/external/glibc/makefile.mk b/external/glibc/makefile.mk
deleted file mode 100644
index 8eee6a5..0000000
--- a/external/glibc/makefile.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org.  If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..
-
-PRJNAME=external
-TARGET=getopt
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :	settings.mk
-
-# --- Files --------------------------------------------------------
-
-.IF "$(HAVE_GETOPT)" != "YES" || "$(HAVE_READDIR_R)" != "YES"
-TARFILE_NAME=glibc-2.1.3-stub
-TARFILE_MD5=4a660ce8466c9df01f19036435425c3a
-TARFILE_ROOTDIR=glibc-2.1.3
-ADDITIONAL_FILES=posix$/makefile.mk posix$/config.h
-.IF "$(HAVE_READDIR_R)" != "YES"
-ADDITIONAL_FILES += posix$/readdir_r.c
-.ENDIF
-
-PATCH_FILES=$(PRJ)$/glibc-2.1.3.patch
-
-CONFIGURE_ACTION=
-
-BUILD_DIR=posix
-BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
-
-OUT2INC= \
-    posix/getopt.h \
-    posix/config.h
-
-.ELSE
-
- at all:
-# nothing
-
-.ENDIF
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : set_ext.mk
-.INCLUDE : target.mk
-.INCLUDE : tg_ext.mk
-
diff --git a/external/glibc/readdir_r.c b/external/glibc/readdir_r.c
new file mode 100644
index 0000000..87b8c9d
--- /dev/null
+++ b/external/glibc/readdir_r.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#ifndef __READDIR_R
+# define __READDIR_R readdir_r
+# define DIRENT_TYPE struct dirent
+#endif
+
+/* Read a directory entry from DIRP.  */
+int
+__READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
+{
+  DIRENT_TYPE *dp;
+  size_t reclen;
+
+  errno = 0;
+  /* call our non-reentrant counterpart to get the information */
+  dp = readdir(dirp);
+
+  /* copy the result into entry */
+  if (dp != NULL) {
+    reclen = dp->d_reclen;           /* This might be NetBSD-specific
+                                      * Add #ifdef's if anything else needed */
+    *result = memcpy(entry, dp, reclen);
+  } else {
+    *result = NULL;
+  }
+
+  return dp != NULL ? 0 : errno ? errno : 0;
+}
diff --git a/external/jawt/makefile.mk b/external/jawt/makefile.mk
deleted file mode 100644
index 469621d..0000000
--- a/external/jawt/makefile.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Initial Developer of the Original Code is Novell, Inc.
-# Portions created by the Initial Developer are Copyright (C) 2011 the
-# Initial Developer. All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-PRJ=..
-PRJNAME=external
-TARGET=libjawt
-
-.INCLUDE :  settings.mk
-
-.IF "$(OS)$(COM)" != "WNTGCC" ||  "$(CROSS_COMPILING)" != "YES"
-
-ALL:
-    @echo Nothing needed for this configuration
-
-.ENDIF
-
-all: $(LB)/libjawt.dll.a
-
-$(LB)/libjawt.dll.a:
-    (echo EXPORTS; echo JAWT_GetAWT at 8) >$(MISC)/jawt.def
-    $(DLLTOOL) --input-def=$(MISC)/jawt.def --output-lib=$@ --dllname=jawt.dll
-
-.INCLUDE :  target.mk
diff --git a/external/mingw-dlls/makefile.mk b/external/mingw-dlls/makefile.mk
deleted file mode 100644
index 61fcaa5..0000000
--- a/external/mingw-dlls/makefile.mk
+++ /dev/null
@@ -1,124 +0,0 @@
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Tor Lillqvist <tml at iki.fi> (initial developer)
-# Jan Holesovsky <kendy at suse.cz>
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-#
-
-PRJ=..
-PRJNAME=external
-TARGET=mingw-dlls
-
-.INCLUDE: settings.mk
-
-# ------------------------------------------------------------------
-
-.IF "$(GUI)$(COM)" != "WNTGCC"
-
-dummy:
-    @echo "Nothing to do."
-
-.ELSE
-
-MINGW_DLLS:= \
-    $(MINGW_BOOST_DATE_TIME_DLL) \
-    $(MINGW_CAIRO_DLL) \
-    $(MINGW_CRYPTO_DLL) \
-    $(MINGW_CURL_DLL) \
-    $(MINGW_EXPAT_DLL) \
-    $(MINGW_FONTCONFIG_DLL) \
-    $(MINGW_FREETYPE_DLL) \
-    $(MINGW_GCRYPT_DLL) \
-    $(MINGW_GLIB_DLL) \
-    $(MINGW_GMODULE_DLL) \
-    $(MINGW_GNUTLS_DLL) \
-    $(MINGW_GPG_ERROR_DLL) \
-    $(MINGW_GRAPHITE2_DLL) \
-    $(MINGW_HUNSPELL_DLL) \
-    $(MINGW_HYPHEN_DLL) \
-    $(MINGW_ICONV_DLL) \
-    $(MINGW_ICUDATA_DLL) \
-    $(MINGW_ICUI18N_DLL) \
-    $(MINGW_ICUUC_DLL) \
-    $(MINGW_IDN_DLL) \
-    $(MINGW_INTL_DLL) \
-    $(MINGW_JPEG_DLL) \
-    $(MINGW_LCMS2_DLL) \
-    $(MINGW_LIBEXSLT_DLL) \
-    $(MINGW_LIBLANGTAG_DLL) \
-    $(MINGW_LIBXML_DLL) \
-    $(MINGW_LIBXSLT_DLL) \
-    $(MINGW_LPSOLVE_DLL) \
-    $(MINGW_MYTHES_DLL) \
-    $(MINGW_NEON_DLL) \
-    $(MINGW_NSPR4_DLL) \
-    $(MINGW_NSS3_DLL) \
-    $(MINGW_NSSUTIL3_DLL) \
-    $(MINGW_PIXMAN_DLL) \
-    $(MINGW_PYTHON_DLL) \
-    $(MINGW_PYTHON_EXE) \
-    $(MINGW_PLC4_DLL) \
-    $(MINGW_PLDS4_DLL) \
-    $(MINGW_PNG15_DLL) \
-    $(MINGW_POPPLER_DLL) \
-    $(MINGW_RAPTOR_DLL) \
-    $(MINGW_RASQAL_DLL) \
-    $(MINGW_READLINE_DLL) \
-    $(MINGW_REDLAND_DLL) \
-    $(MINGW_SQLITE3_DLL) \
-    $(MINGW_SMIME3_DLL) \
-    $(MINGW_SSH2_DLL) \
-    $(MINGW_SSL3_DLL) \
-    $(MINGW_SSL_DLL) \
-    $(MINGW_TASN1_DLL) \
-    $(MINGW_TERMCAP_DLL) \
-    $(MINGW_ZLIB_DLL)
-
-.IF "$(MINGW_SHARED_GCCLIB)" == "YES"
-MINGW_DLLS+=$(MINGW_GCCDLL)
-.ENDIF
-
-.IF "$(MINGW_SHARED_GXXLIB)" == "YES"
-MINGW_DLLS+=$(MINGW_GXXDLL)
-.ENDIF
-
-# Guesstimate where the DLLs can be
-
-POTENTIAL_MINGW_RUNTIME_BINDIRS = \
-	$(COMPATH)/$(HOST_PLATFORM)/sys-root/mingw/bin \
-	/usr/$(HOST_PLATFORM)/sys-root/mingw/bin \
-
-all:
-	@for DLL in $(MINGW_DLLS) ; do \
-	    for D in $(POTENTIAL_MINGW_RUNTIME_BINDIRS); do \
-	       test -f $$D/$$DLL && $(COPY) -p $$D/$$DLL $(BIN)$/ && break; \
-	    done ; \
-	    test -f $(BIN)$/$$DLL || { echo Could not find $$DLL in none of $(POTENTIAL_MINGW_RUNTIME_BINDIRS) ; exit 1 ; } ; \
-	done
-
-.ENDIF
-
-# ------------------------------------------------------------------
-
-.INCLUDE: target.mk
diff --git a/external/mingwheaders/makefile.mk b/external/mingwheaders/makefile.mk
deleted file mode 100644
index 0e74daa..0000000
--- a/external/mingwheaders/makefile.mk
+++ /dev/null
@@ -1,213 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org.  If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..
-PRJNAME=external
-TARGET=mingwheaders
-
-.INCLUDE :  settings.mk
-
-.IF "$(OS)$(COM)" == "WNTGCC"
-
-.IF "$(CROSS_COMPILING)" != "YES"
-
-# Don't do any of this for now. We support WNTGCC (MinGW) only as
-# cross-compiler. It is dubious whether it would be legal to copy
-# stuff from the Windows SDK to a cross-compilation build host
-# anyway. Some headers and/or import libraries missing in MinGW (or
-# mingw-w64 actually) we have copied from Wine in ../wine.
-
-MINGW_INCLUDE_DIR=$(COMPATH)$/include/
-MINGW_W32API_INCLUDE_DIR=$(COMPATH)$/include/
-MINGW_W32API_LIB_DIR=$(COMPATH)$/lib/
-
-SYS_INCLUDE_DIR=$(MINGW_INCLUDE_DIR)$/sys/
-
-PSDK_INCLUDE_DIR=$(PSDK_HOME)$/include$/
-
-ATL_INCLUDE_DIR=$(PSDK_HOME)$/include$/atl$/
-
-DIRECTXSDK_INCLUDE_DIR=$(DIRECTXSDK_HOME)$/include$/
-
-FILES_TO_COPY_FROM_MINGW= \
-    excpt.h \
-     tchar.h
-
-FILES_TO_COPY_FROM_W32API= \
-    amvideo.h \
-    basetyps.h \
-    objidl.h \
-    specstrings.h \
-    uxtheme.h \
-    winbase.h \
-    windef.h \
-    wininet.h \
-    winver.h \
-    wtypes.h
-
-FILES_TO_COPY_FROM_SYS= \
-    stat.h
-
-FILES_TO_COPY_FROM_PSDK= \
-    adoctint.h \
-    adodef.h \
-    adoguids.h \
-    adoint.h \
-    bcrypt.h \
-    commctrl.h \
-    control.h \
-    dispex.h \
-    filter.h \
-    gdiplusbitmap.h \
-    gdiplusbrush.h \
-    gdiplusenums.h \
-    gdiplusfont.h \
-    gdiplusheaders.h \
-    gdiplusimageattributes.h \
-    gdiplusimaging.h \
-    gdiplusmatrix.h \
-    gdipluspath.h \
-    gdipluspen.h \
-    gdiplusregion.h \
-    gdiplusstringformat.h \
-    imm.h \
-    imagehlp.h \
-    mapiwin.h \
-    msdasc.h \
-    msi.h \
-    msiquery.h \
-    multimon.h \
-    ntquery.h \
-    oaidl.h \
-    ocidl.h \
-    oleauto.h \
-    olectl.h \
-    oledb.h \
-    oleidl.h \
-    propidl.h \
-    propkeydef.h \
-    propsys.h \
-    propvarutil.h \
-    shlobj.h \
-    shobjidl.h \
-    shtypes.h \
-    sspi.h \
-    strmif.h \
-    strsafe.h \
-    structuredquery.h \
-    urlmon.h \
-    wincrypt.h \
-    winerror.h \
-    wingdi.h \
-    wintrust.h \
-    winuser.h \
-    wspiapi.h \
-    exdispid.h \
-    dshow.h \
-    gdiplus.h \
-    msxml.h \
-    ncrypt.h \
-    shlguid.h \
-    transact.h
-
-.IF "$(DISABLE_ATL)"==""
-MINGWHEADER_ATL_PATCH_TARGET=$(MISC)$/mingwheader_atl_patch
-MINGWHEADER_ATL_COPY_TARGET=$(MISC)$/mingwheader_atl_copy
-FILES_TO_COPY_FROM_ATL= \
-    atlbase.h \
-    atlcom.h \
-    atlconv.h \
-    atlctl.h \
-    atlwin.h \
-    statreg.h
-.ENDIF
-
-FILES_TO_COPY_FROM_DIRECTXSDK= \
-    d3dtypes.h \
-    d3dx9core.h \
-    d3dx9math.h \
-    d3dx9math.inl \
-    dxtrans.h \
-    d3dx9.h
-
-$(MISC)$/mingwheader_patch_all : $(MISC)$/mingwheader_patch $(MINGWHEADER_ATL_PATCH_TARGET) $(LB)$/libmsvcrt.a
-
-$(MISC)$/mingwheader_patch : $(MISC)$/mingwheader_copy
-    patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_headers.patch
-    $(TOUCH) $(MISC)$/mingwheader_patch
-
-.IF "$(DISABLE_ATL)"==""
-$(MINGWHEADER_ATL_PATCH_TARGET) : $(MINGWHEADER_ATL_COPY_TARGET)
-    patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_atl_headers.patch
-    $(TOUCH) $(MINGWHEADER_ATL_PATCH_TARGET)
-.ENDIF
-
-$(MISC)$/mingwheader_copy:
-    $(MKDIRHIER) $(MISC)$/mingw$/include
-    $(MKDIRHIER) $(MISC)$/mingw$/include/sys
-    $(COPY) $(FILES_TO_COPY_FROM_MINGW:^$(MINGW_INCLUDE_DIR)) $(MISC)$/mingw$/include
-    $(COPY) $(FILES_TO_COPY_FROM_W32API:^$(MINGW_W32API_INCLUDE_DIR)) $(MISC)$/mingw$/include
-    $(COPY) $(FILES_TO_COPY_FROM_SYS:^$(SYS_INCLUDE_DIR)) $(MISC)$/mingw$/include$/sys
-    $(COPY) $(FILES_TO_COPY_FROM_PSDK:^$(PSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include
-    $(COPY) $(FILES_TO_COPY_FROM_DIRECTXSDK:^$(DIRECTXSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include
-    $(TOUCH) $(MISC)$/mingwheader_copy
-
-.IF "$(DISABLE_ATL)"==""
-$(MINGWHEADER_ATL_COPY_TARGET):
-    $(MKDIRHIER) $(MISC)$/mingw$/include/atl
-    $(COPY) $(FILES_TO_COPY_FROM_ATL:^$(ATL_INCLUDE_DIR)) $(MISC)$/mingw$/include$/atl
-     $(TOUCH) $(MINGWHEADER_ATL_COPY_TARGET)
-.ENDIF
-
-$(LB)$/libmsvcrt.a:
-.IF "$(USE_MINGW)" == "cygwin"
-    $(COPY) $(COMPATH)$/lib/mingw/libmsvcrt.a $(LB)$/libmsvcrt_orig.a
-.ELSE
-    $(COPY) $(COMPATH)$/lib/libmsvcrt.a $(LB)$/libmsvcrt_orig.a
-.ENDIF
-    cd $(LB) && ar -x libmsvcrt_orig.a ofmt_stub.o
-    ar -d $(LB)$/libmsvcrt_orig.a ofmt_stub.o
-    nm -g --defined-only $(LB)$/libmsvcrt_orig.a > $(MISC)$/msvcrt.nm
-    echo EXPORTS > $(MISC)$/msvcrt.def
-    sed -ne 's/.* T _//p' $(MISC)$/msvcrt.nm | sort >> $(MISC)$/msvcrt.def
-    -sed -ne 's/.* I __imp__//p' $(MISC)$/msvcrt.nm | sort | diff - $(MISC)$/msvcrt.def | \
-        sed -ne 's/^< \(.*\)$/\1 DATA/p' > $(MISC)$/msvcrtdata.def
-    cat $(MISC)$/msvcrtdata.def >> $(MISC)$/msvcrt.def
-    dlltool --dllname msvcrt.dll --input-def=$(MISC)$/msvcrt.def --kill-at --output-lib=$(LB)$/libmsvcrt.a
-    cd $(LB) && ar -rs libmsvcrt.a ofmt_stub.o
-
-clean:
-    -$(RM) $(MISC)$/mingw$/include$/*.h
-    -$(RM) $(MISC)$/mingwheader_copy
-    -$(RM) $(MISC)$/mingwheader_patch
-
-.ENDIF
-
-.ENDIF
-
-.INCLUDE :  target.mk
-
diff --git a/external/mingwheaders/mingw_atl_headers.patch b/external/mingwheaders/mingw_atl_headers.patch
deleted file mode 100644
index bbcbb84..0000000
--- a/external/mingwheaders/mingw_atl_headers.patch
+++ /dev/null
@@ -1,1654 +0,0 @@
---- include/atl/atlbase.h.orig	2005-04-14 17:54:32.000000000 +0900
-+++ include/atl/atlbase.h	2007-12-23 14:38:02.467500000 +0900
-@@ -10,6 +10,9 @@
- 
- #ifndef __ATLBASE_H__
- #define __ATLBASE_H__
-+#if __GNUC__ >=3
-+#pragma GCC system_header
-+#endif
- 
- #ifndef __cplusplus
-         #error ATL requires C++ compilation (use a .cpp suffix)
-@@ -73,19 +76,47 @@
- #define _ATL_TYPELIB_INDEX_LENGTH 10
- #define _ATL_QUOTES_SPACE 2
- 
--#pragma pack(push, _ATL_PACKING)
-+#pragma pack(push, 8)
- 
- #if defined(_ATL_DLL)
-         #pragma comment(lib, "atl.lib")
- #endif
- 
--extern "C" const __declspec(selectany) GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
--extern "C" const __declspec(selectany) CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
--extern "C" const __declspec(selectany) IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
--extern "C" const __declspec(selectany) IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
--extern "C" const __declspec(selectany) IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
--extern "C" const __declspec(selectany) IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
--extern "C" const __declspec(selectany) IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
-+#define __uuidof(I) IID_##I
-+
-+#include <excpt.h>
-+
-+namespace ATL
-+{
-+inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
-+{
-+   return (
-+      ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
-+      ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
-+      ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
-+      ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
-+}
-+}
-+
-+#ifdef _INIT_ATL_COMMON_VARS
-+extern "C" const GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
-+extern "C" const CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
-+extern "C" const IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
-+extern "C" const IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
-+extern "C" const IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
-+extern "C" const IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
-+extern "C" const IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
-+#else
-+extern "C" {
-+extern const GUID LIBID_ATLLib;
-+extern const CLSID CLSID_Registrar;
-+extern const IID IID_IRegistrar;
-+extern const IID IID_IAxWinHostWindow;
-+extern const IID IID_IAxWinAmbientDispatch;
-+extern const IID IID_IInternalConnection;
-+extern const IID IID_IDocHostUIHandlerDispatch;
-+}
-+#endif
- 
- #ifndef _ATL_DLL_IMPL
- namespace ATL
-@@ -135,7 +166,7 @@
-                 IUnknown* p = NULL;
-                 if (pfnGetClassObject == NULL)
-                         return S_OK;
--                HRESULT hRes = pfnGetClassObject(pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
-+                HRESULT hRes = pfnGetClassObject((LPVOID)pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
-                 if (SUCCEEDED(hRes))
-                         hRes = CoRegisterClassObject(*pclsid, p, dwClsContext, dwFlags, &dwRegister);
-                 if (p != NULL)
-@@ -284,13 +315,15 @@
- };
- #pragma pack(pop)
- 
--PVOID __stdcall __AllocStdCallThunk(VOID);
--VOID  __stdcall __FreeStdCallThunk(PVOID);
-+//PVOID __stdcall __AllocStdCallThunk(VOID);
-+//VOID  __stdcall __FreeStdCallThunk(PVOID);
- 
--#define AllocStdCallThunk() __AllocStdCallThunk()
--#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
-+//#define AllocStdCallThunk() __AllocStdCallThunk()
-+//#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
- 
--#pragma comment(lib, "atlthunk.lib")
-+//#pragma comment(lib, "atlthunk.lib")
-+#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
-+#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
- 
- #elif defined (_M_AMD64)
- #pragma pack(push,2)
-@@ -465,7 +498,7 @@
-         return( HRESULT_FROM_WIN32( nError ) );
- }
- 
--inline void __declspec(noreturn) _AtlRaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags = EXCEPTION_NONCONTINUABLE )
-+inline void _AtlRaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags = EXCEPTION_NONCONTINUABLE )
- {
-         RaiseException( dwExceptionCode, dwExceptionFlags, 0, NULL );
- }
-@@ -658,6 +691,7 @@
- class _NoAddRefReleaseOnCComPtr : public T
- {
-         private:
-+                _NoAddRefReleaseOnCComPtr();
-                 STDMETHOD_(ULONG, AddRef)()=0;
-                 STDMETHOD_(ULONG, Release)()=0;
- };
-@@ -781,6 +815,7 @@
-         {
-                 return AtlAdvise(p, pUnk, iid, pdw);
-         }
-+#if 0
-         HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
-         {
-                 ATLASSERT(p == NULL);
-@@ -801,11 +836,12 @@
-                 ATLASSERT(pp != NULL && *pp == NULL);
-                 return p->QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         T* p;
- };
- 
- 
--template <class T, const IID* piid = &__uuidof(T)>
-+template <class T, const IID* piid>
- class CComQIPtr
- {
- public:
-@@ -933,6 +969,7 @@
-         {
-                 return AtlAdvise(p, pUnk, iid, pdw);
-         }
-+#if 0
-         HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
-         {
-                 ATLASSERT(p == NULL);
-@@ -953,6 +990,7 @@
-                 ATLASSERT(pp != NULL && *pp == NULL);
-                 return p->QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         T* p;
- };
- 
-@@ -1087,12 +1125,14 @@
-                         hr = ::CoCreateInstance(clsid, pUnkOuter, dwClsContext, __uuidof(IUnknown), (void**)&p);
-                 return hr;
-         }
-+#if 0
-         template <class Q>
-         HRESULT QueryInterface(Q** pp)
-         {
-                 ATLASSERT(pp != NULL && *pp == NULL);
-                 return p->QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         IUnknown* p;
- };
- 
-@@ -1257,21 +1297,26 @@
- 		LeaveCriticalSection(&m_sec);
- 		return S_OK;
- 	}
-+	static void _InitHandler(void *pData, LPEXCEPTION_POINTERS ep)
-+	  {
-+	    HRESULT &hRes=*reinterpret_cast<HRESULT*>(pData);
-+			if (STATUS_NO_MEMORY == ep->ExceptionRecord->ExceptionCode)
-+				hRes = E_OUTOFMEMORY;
-+			else
-+				hRes = E_FAIL;
-+	  }
- 	HRESULT Init() throw()
- 	{
- 		HRESULT hRes = S_OK;
--		__try
--		{
-+                jmp_buf _sejmpbuf;
-+                __SEHandler _sehandler;
-+                if (__builtin_setjmp(_sejmpbuf) == 0)
-+                {
-+                        _sehandler.Set(_sejmpbuf, &hRes, reinterpret_cast<__SEHandler::PF>(EXCEPTION_EXECUTE_HANDLER), _InitHandler);
- 			InitializeCriticalSection(&m_sec);
--		}
-+                }
- 		// structured exception may be raised in low memory situations
--		__except(EXCEPTION_EXECUTE_HANDLER)
--		{
--			if (STATUS_NO_MEMORY == GetExceptionCode())
--				hRes = E_OUTOFMEMORY;
--			else
--				hRes = E_FAIL;
--		}
-+                _sehandler.Reset();
- 		return hRes;
- 	}
- 
-@@ -2799,10 +2844,19 @@
- 
- 
- class CComModule;
--__declspec(selectany) CComModule* _pModule=NULL;
-+#ifdef _INIT_ATL_COMMON_VARS
-+CComModule* _pModule=NULL;
-+#else
-+extern CComModule* _pModule;
-+#endif
-+
- 
- // {B62F5910-6528-11d1-9611-0000F81E0D0D}
--_declspec(selectany) GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
-+#ifdef _INIT_ATL_COMMON_VARS
-+GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
-+#else
-+extern GUID GUID_ATLVer30;
-+#endif
- 
- class CComModule : public _ATL_MODULE
- {
-@@ -4286,7 +4340,9 @@
- 
- #endif
- 
--__declspec(selectany) GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
-+#ifdef _INIT_ATL_COMMON_VARS
-+GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
-+#endif
- 
- #ifdef _ATL_STATIC_REGISTRY
- #define UpdateRegistryFromResource UpdateRegistryFromResourceS
-@@ -4355,7 +4411,9 @@
-         LONG m_nLockCnt;
- };
- 
--__declspec(selectany) UINT CComApartment::ATL_CREATE_OBJECT = 0;
-+#ifdef _INIT_ATL_COMMON_VARS
-+UINT CComApartment::ATL_CREATE_OBJECT = 0;
-+#endif
- 
- class CComSimpleThreadAllocator
- {
-@@ -5855,6 +5913,10 @@
-                 }
- 
-         }
-+        static int _Except(void *pThis, LPEXCEPTION_POINTERS lpEP)
-+        {
-+	  return reinterpret_cast<CVirtualBuffer *>(pThis)->Except(lpEP);
-+	}
-         void Seek(int nElement)
-         {
-                 if(nElement < 0 || nElement >= m_nMaxElements)
-@@ -5866,41 +5928,53 @@
-         {
-                 if(nElement < 0 || nElement >= m_nMaxElements)
-                         _AtlRaiseException((DWORD)EXCEPTION_ARRAY_BOUNDS_EXCEEDED);                
--                __try
-+                jmp_buf _sejmpbuf;
-+                __SEHandler _sehandler;
-+                if (__builtin_setjmp(_sejmpbuf) == 0)
-                 {
-+                        _sehandler.Set(_sejmpbuf, this, _Except);
-                         T* p = &m_pBase[nElement];
-                         *p = Element;
-                         m_pTop = p > m_pTop ? p : m_pTop;
-                 }
--                __except(Except(GetExceptionInformation()))
-+                else
-                 {
-                 }
-+                _sehandler.Reset();
- 
-         }
-         template <class Q>
-         void WriteBulk(Q& helper)
-         {
--                __try
-+                jmp_buf _sejmpbuf;
-+                __SEHandler _sehandler;
-+                if (__builtin_setjmp(_sejmpbuf) == 0)
-                 {
-+                        _sehandler.Set(_sejmpbuf, this, _Except);
-                         m_pCurrent = helper(m_pBase);
-                         m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop;
-                 }
--                __except(Except(GetExceptionInformation()))
-+                else
-                 {
-                 }
-+                _sehandler.Reset();
-         }
-         void Write(const T& Element)
-         {
-             if (m_pCurrent < &m_pBase[m_nMaxElements]) {
--                __try
-+                jmp_buf _sejmpbuf;
-+                __SEHandler _sehandler;
-+                if (__builtin_setjmp(_sejmpbuf) == 0)
-                 {
-+                    _sehandler.Set(_sejmpbuf, this, _Except);
-                     *m_pCurrent = Element;
-                     m_pCurrent++;
-                     m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop; 
-                 }
--                __except(Except(GetExceptionInformation()))
-+                else
-                 {
-                 }
-+                _sehandler.Reset();
-             }
-         }
-         T& Read()
-@@ -5910,14 +5984,18 @@
-         operator BSTR()
-         {
-                 BSTR bstrTemp = NULL ;
--                __try
-+                jmp_buf _sejmpbuf;
-+                __SEHandler _sehandler;
-+                if (__builtin_setjmp(_sejmpbuf) == 0)
-                 {
-+                        _sehandler.Set(_sejmpbuf, this, _Except);
-                         bstrTemp = SysAllocStringByteLen((char*) m_pBase,
-                                 (UINT) ((BYTE*)m_pTop - (BYTE*)m_pBase));
-                 }
--                __except(Except(GetExceptionInformation()))
-+                else
-                 {
-                 }
-+                _sehandler.Reset();
-                 return bstrTemp;
-         }
-         const T& operator[](int nElement) const
-@@ -6336,6 +6414,11 @@
- //Although these functions are big, they are only used once in a module
- //so we should make them inline.
- 
-+ATLINLINE int atlmoduleinitfilter(void *, LPEXCEPTION_POINTERS ep)
-+{
-+  return ep->ExceptionRecord->ExceptionCode == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
-+}
-+
- ATLINLINE ATLAPI AtlModuleInit(_ATL_MODULE* pM, _ATL_OBJMAP_ENTRY* p, HINSTANCE h)
- {
-         ATLASSERT(pM != NULL);
-@@ -6352,32 +6435,43 @@
-         pM->m_hInst = pM->m_hInstTypeLib = pM->m_hInstResource = h;
-         pM->m_nLockCnt=0L;
-         pM->m_hHeap = NULL;
--        __try {
-+        jmp_buf _sejmpbuf;
-+        __SEHandler _sehandler;
-+        if (__builtin_setjmp(_sejmpbuf) == 0) {
-+            _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
-             InitializeCriticalSection(&pM->m_csTypeInfoHolder);
--        } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
-+        } else {
-             ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
--            return STATUS_NO_MEMORY;
-+            _sehandler.Reset();
-+	    return STATUS_NO_MEMORY;
-         }
-+        _sehandler.Reset();
- 
--        __try {
-+        if (__builtin_setjmp(_sejmpbuf) == 0) {
-+            _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
-             InitializeCriticalSection(&pM->m_csWindowCreate);
--        } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
-+        } else {
-             DeleteCriticalSection(&pM->m_csTypeInfoHolder);
-             ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
-             ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
-+            _sehandler.Reset();
-             return STATUS_NO_MEMORY;
-         }
-+        _sehandler.Reset();
- 
--        __try {
-+        if (__builtin_setjmp(_sejmpbuf) == 0) {
-+            _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
-             InitializeCriticalSection(&pM->m_csObjMap);
--        } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
-+        } else {
-             DeleteCriticalSection(&pM->m_csWindowCreate);
-             DeleteCriticalSection(&pM->m_csTypeInfoHolder);
-             ZeroMemory(&pM->m_csObjMap, sizeof(pM->m_csObjMap));
-             ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
-             ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
-+            _sehandler.Reset();
-             return STATUS_NO_MEMORY;
-         }
-+        _sehandler.Reset();
- #ifdef _ATL_DLL_IMPL
-         if (pM->cbSize > _nAtlModuleVer21Size)
- #endif
-@@ -6450,6 +6544,11 @@
-         return hRes;
- }
- 
-+ATLINLINE void atlfinalleavecriticalsection(void *pData)
-+{
-+  LeaveCriticalSection(reinterpret_cast<LPCRITICAL_SECTION>(pData));
-+}
-+
- ATLINLINE ATLAPI AtlModuleGetClassObject(_ATL_MODULE* pM, REFCLSID rclsid, REFIID riid, LPVOID* ppv)
- {
-         ATLASSERT(pM != NULL);
-@@ -6473,15 +6572,15 @@
-                         if (pEntry->pCF == NULL)
-                         {
-                                 EnterCriticalSection(&pM->m_csObjMap);
--                                __try
-+                                jmp_buf _sejmpbuf;
-+                                __SEHandler _sehandler;
-+                                if (__builtin_setjmp(_sejmpbuf) == 0)
-                                 {
-+                                        _sehandler.Set(_sejmpbuf, &pM->m_csObjMap, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
-                                         if (pEntry->pCF == NULL)
--                                                hRes = pEntry->pfnGetClassObject(pEntry->pfnCreateInstance, IID_IUnknown, (LPVOID*)&pEntry->pCF);
--                                }
--                                __finally
--                                {
--                                        LeaveCriticalSection(&pM->m_csObjMap);
-+						hRes = pEntry->pfnGetClassObject((void *)(pEntry->pfnCreateInstance), IID_IUnknown, (LPVOID*)&pEntry->pCF);
-                                 }
-+                                _sehandler.Reset();
-                         }
-                         if (pEntry->pCF != NULL)
-                                 hRes = pEntry->pCF->QueryInterface(riid, ppv);
---- include/atl/atlcom.h.orig	2005-04-14 17:54:32.000000000 +0900
-+++ include/atl/atlcom.h	2007-12-03 22:43:54.833375000 +0900
-@@ -10,6 +10,9 @@
- 
- #ifndef __ATLCOM_H__
- #define __ATLCOM_H__
-+#if __GNUC__ >=3
-+#pragma GCC system_header
-+#endif
- 
- #ifndef __cplusplus
-         #error ATL requires C++ compilation (use a .cpp suffix)
-@@ -19,7 +22,10 @@
-         #error atlcom.h requires atlbase.h to be included first
- #endif
- 
--#pragma pack(push, _ATL_PACKING)
-+#include <algorithm>
-+using ::std::min;
-+
-+#pragma pack(push, 8)
- 
- EXTERN_C const IID IID_ITargetFrame;
- 
-@@ -2191,19 +2197,23 @@
- // override it in your class and call each base class' version of this
- #define BEGIN_COM_MAP(x) public: \
-         typedef x _ComMapClass; \
-+        static void _CacheFinal(void *pData)\
-+        {\
-+                reinterpret_cast<_ComMapClass*>(pData)->Unlock();\
-+        }\
-         static HRESULT WINAPI _Cache(void* pv, REFIID iid, void** ppvObject, DWORD_PTR dw)\
-         {\
-                 _ComMapClass* p = (_ComMapClass*)pv;\
-                 p->Lock();\
-                 HRESULT hRes = E_FAIL; \
--                __try \
-+                jmp_buf _sejmpbuf; \
-+                __SEHandler _sehandler; \
-+                if (__builtin_setjmp(_sejmpbuf) == 0) \
-                 { \
-+                        _sehandler.Set(_sejmpbuf, p, EXCEPTION_CONTINUE_SEARCH, NULL, _CacheFinal);\
-                         hRes = CComObjectRootBase::_Cache(pv, iid, ppvObject, dw);\
-                 } \
--                __finally \
--                { \
--                        p->Unlock();\
--                } \
-+                _sehandler.Reset();\
-                 return hRes;\
-         }\
-         IUnknown* _GetRawUnknown() \
-@@ -2339,7 +2349,7 @@
-    return( pMap ); }
- 
- #define BEGIN_OBJECT_MAP(x) static _ATL_OBJMAP_ENTRY x[] = {
--#define END_OBJECT_MAP()   {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
-+#define END_OBJECT_MAP()   {NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL}};
- #define OBJECT_ENTRY(clsid, class) {&clsid, class::UpdateRegistry, class::_ClassFactoryCreatorClass::CreateInstance, class::_CreatorClass::CreateInstance, NULL, 0, class::GetObjectDescription, class::GetCategoryMap, class::ObjectMain },
- #define OBJECT_ENTRY_NON_CREATEABLE(class) {&CLSID_NULL, class::UpdateRegistry, NULL, NULL, NULL, 0, NULL, class::GetCategoryMap, class::ObjectMain },
- 
-@@ -2492,9 +2502,9 @@
- public:
-         typedef ThreadModel _ThreadModel;
- #ifdef OLD_ATL_CRITSEC_CODE
--        typename typedef _ThreadModel::AutoCriticalSection _CritSec;
-+        typedef typename _ThreadModel::AutoCriticalSection _CritSec;
- #else
--    	typename typedef _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
-+    	typedef typename _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
- #endif  /* OLD_ATL_CRITSEC_CODE */
-         typedef CComObjectLockT<_ThreadModel> ObjectLock;
- 
-@@ -2638,8 +2648,8 @@
-         // Set refcount to 1 to protect destruction
-         ~CComObject()
-         {
--                m_dwRef = 1L;
--                FinalRelease();
-+                this->m_dwRef = 1L;
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-@@ -2647,22 +2657,24 @@
-         }
-         //If InternalAddRef or InternalRelease is undefined then your class
-         //doesn't derive from CComObjectRoot
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-         }
-         //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
-         STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
--        {return _InternalQueryInterface(iid, ppvObject);}
-+        {return this->_InternalQueryInterface(iid, ppvObject);}
-+#if 0
-         template <class Q>
-         HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
-         {
-                 return QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
- 
-         static HRESULT WINAPI CreateInstance(CComObject<Base>** pp);
- };
-@@ -2719,8 +2731,8 @@
- #endif  /* OLD_ATL_CRITSEC_CODE */
-         ~CComObjectCached()
-         {
--                m_dwRef = 1L;
--                FinalRelease();
-+                this->m_dwRef = 1L;
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-@@ -2729,14 +2741,14 @@
-         //doesn't derive from CComObjectRoot
-         STDMETHOD_(ULONG, AddRef)()
-         {
--                ULONG l = InternalAddRef();
-+                ULONG l = this->InternalAddRef();
-                 if (l == 2)
-                         _Module.Lock();
-                 return l;
-         }
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 else if (l == 1)
-@@ -2745,7 +2757,7 @@
-         }
-         //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
-         STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
--        {return _InternalQueryInterface(iid, ppvObject);}
-+        {return this->_InternalQueryInterface(iid, ppvObject);}
- #ifndef OLD_ATL_CRITSEC_CODE
-     	CComGlobalsThreadModel::AutoDeleteCriticalSection m_csCached;
- #endif  /* OLD_ATL_CRITSEC_CODE */
-@@ -2762,8 +2774,8 @@
-         // Set refcount to 1 to protect destruction
-         ~CComObjectNoLock()
-         {
--                m_dwRef = 1L;
--                FinalRelease();
-+                this->m_dwRef = 1L;
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-@@ -2771,17 +2783,17 @@
- 
-         //If InternalAddRef or InternalRelease is undefined then your class
-         //doesn't derive from CComObjectRoot
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-         }
-         //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
-         STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
--        {return _InternalQueryInterface(iid, ppvObject);}
-+        {return this->_InternalQueryInterface(iid, ppvObject);}
- };
- 
- // It is possible for Base not to derive from CComObjectRoot
-@@ -2794,14 +2806,14 @@
-         CComObjectGlobal(void* = NULL)
-         {
- #ifndef OLD_ATL_CRITSEC_CODE
--			m_hResFinalConstruct = _AtlInitialConstruct();
-+			m_hResFinalConstruct = this->_AtlInitialConstruct();
- 			if (SUCCEEDED(m_hResFinalConstruct))
- #endif  /* OLD_ATL_CRITSEC_CODE */
--                m_hResFinalConstruct = FinalConstruct();
-+                m_hResFinalConstruct = this->FinalConstruct();
-         }
-         ~CComObjectGlobal()
-         {
--                FinalRelease();
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-@@ -2810,7 +2822,7 @@
-         STDMETHOD_(ULONG, AddRef)() {return _Module.Lock();}
-         STDMETHOD_(ULONG, Release)(){return _Module.Unlock();}
-         STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
--        {return _InternalQueryInterface(iid, ppvObject);}
-+        {return this->_InternalQueryInterface(iid, ppvObject);}
-         HRESULT m_hResFinalConstruct;
- };
- 
-@@ -2824,14 +2836,14 @@
-         CComObjectStack(void* = NULL)
-         {
- #ifndef OLD_ATL_CRITSEC_CODE
--			m_hResFinalConstruct = _AtlInitialConstruct();
-+			m_hResFinalConstruct = this->_AtlInitialConstruct();
- 			if (SUCCEEDED(m_hResFinalConstruct))
- #endif  /* OLD_ATL_CRITSEC_CODE */
--                m_hResFinalConstruct = FinalConstruct();
-+                m_hResFinalConstruct = this->FinalConstruct();
-         }
-         ~CComObjectStack()
-         {
--                FinalRelease();
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-@@ -2850,6 +2862,8 @@
- {
- public:
-         typedef Base _BaseClass;
-+        using Base::_GetRawUnknown;
-+        using Base::m_pOuterUnknown;
-         CComContainedObject(void* pv) {m_pOuterUnknown = (IUnknown*)pv;}
- #ifdef _ATL_DEBUG_INTERFACES
-         ~CComContainedObject()
-@@ -2859,20 +2873,22 @@
-         }
- #endif
- 
--        STDMETHOD_(ULONG, AddRef)() {return OuterAddRef();}
--        STDMETHOD_(ULONG, Release)() {return OuterRelease();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->OuterAddRef();}
-+        STDMETHOD_(ULONG, Release)() {return this->OuterRelease();}
-         STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
-         {
--                HRESULT hr = OuterQueryInterface(iid, ppvObject);
-+                HRESULT hr = this->OuterQueryInterface(iid, ppvObject);
-                 if (FAILED(hr) && _GetRawUnknown() != m_pOuterUnknown)
--                        hr = _InternalQueryInterface(iid, ppvObject);
-+                        hr = this->_InternalQueryInterface(iid, ppvObject);
-                 return hr;
-         }
-+#if 0
-         template <class Q>
-         HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
-         {
-                 return QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         //GetControllingUnknown may be virtual if the Base class has declared
-         //DECLARE_GET_CONTROLLING_UNKNOWN()
-         IUnknown* GetControllingUnknown()
-@@ -2915,18 +2931,18 @@
-         // override it in your class and call each base class' version of this
-         HRESULT FinalConstruct()
-         {
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-                 return m_contained.FinalConstruct();
-         }
-         void FinalRelease()
-         {
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-                 m_contained.FinalRelease();
-         }
-         // Set refcount to 1 to protect destruction
-         ~CComAggObject()
-         {
--                m_dwRef = 1L;
-+                this->m_dwRef = 1L;
-                 FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(this);
-@@ -2934,10 +2950,10 @@
-                 _Module.Unlock();
-         }
- 
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-@@ -2959,11 +2975,13 @@
-                         hRes = m_contained._InternalQueryInterface(iid, ppvObject);
-                 return hRes;
-         }
-+#if 0
-         template <class Q>
-         HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
-         {
-                 return QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComAggObject<contained>** pp)
-         {
-                 _ATL_VALIDATE_OUT_POINTER(pp);
-@@ -3023,21 +3041,21 @@
-         // override it in your class and call each base class' version of this
-         HRESULT FinalConstruct()
-         {
--                InternalAddRef();
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-+                this->InternalAddRef();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-                 HRESULT hr = m_contained.FinalConstruct();
--                InternalRelease();
-+                this->InternalRelease();
-                 return hr;
-         }
-         void FinalRelease()
-         {
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-                 m_contained.FinalRelease();
-         }
-         // Set refcount to 1 to protect destruction
-         ~CComPolyObject()
-         {
--                m_dwRef = 1L;
-+                this->m_dwRef = 1L;
-                 FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(this);
-@@ -3045,10 +3063,10 @@
-                 _Module.Unlock();
-         }
- 
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-@@ -3072,11 +3090,13 @@
-                         hRes = m_contained._InternalQueryInterface(iid, ppvObject);
-                 return hRes;
-         }
-+#if 0
-         template <class Q>
-         HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
-         {
-                 return QueryInterface(__uuidof(Q), (void**)pp);
-         }
-+#endif
-         static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComPolyObject<contained>** pp)
-         {
-                 _ATL_VALIDATE_OUT_POINTER(pp);
-@@ -3111,27 +3131,28 @@
- class CComTearOffObject : public Base
- {
- public:
-+        using Base::m_pOwner;
-         CComTearOffObject(void* pv)
-         {
-                 ATLASSERT(m_pOwner == NULL);
--                m_pOwner = reinterpret_cast<CComObject<Base::_OwnerClass>*>(pv);
-+                m_pOwner = reinterpret_cast<CComObject<typename Base::_OwnerClass>*>(pv);
-                 m_pOwner->AddRef();
-         }
-         // Set refcount to 1 to protect destruction
-         ~CComTearOffObject()
-         {
--                m_dwRef = 1L;
--                FinalRelease();
-+                this->m_dwRef = 1L;
-+                this->FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
- #endif
-                 m_pOwner->Release();
-         }
- 
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-@@ -3150,27 +3171,27 @@
- public:
-         typedef contained _BaseClass;
-         CComCachedTearOffObject(void* pv) :
--                m_contained(((contained::_OwnerClass*)pv)->GetControllingUnknown())
-+                m_contained(((typename contained::_OwnerClass*)pv)->GetControllingUnknown())
-         {
-                 ATLASSERT(m_contained.m_pOwner == NULL);
--                m_contained.m_pOwner = reinterpret_cast<CComObject<contained::_OwnerClass>*>(pv);
-+                m_contained.m_pOwner = reinterpret_cast<CComObject<typename contained::_OwnerClass>*>(pv);
-         }
-         //If you get a message that this call is ambiguous then you need to
-         // override it in your class and call each base class' version of this
-         HRESULT FinalConstruct()
-         {
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
-                 return m_contained.FinalConstruct();
-         }
-         void FinalRelease()
-         {
--                CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-+                CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
-                 m_contained.FinalRelease();
-         }
-         // Set refcount to 1 to protect destruction
-         ~CComCachedTearOffObject()
-         {
--                m_dwRef = 1L;
-+                this->m_dwRef = 1L;
-                 FinalRelease();
- #ifdef _ATL_DEBUG_INTERFACES
-                 _Module.DeleteNonAddRefThunk(this);
-@@ -3178,10 +3199,10 @@
-         }
- 
- 
--        STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
-+        STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
-         STDMETHOD_(ULONG, Release)()
-         {
--                ULONG l = InternalRelease();
-+                ULONG l = this->InternalRelease();
-                 if (l == 0)
-                         delete this;
-                 return l;
-@@ -3260,7 +3281,9 @@
- {
- public:
-         typedef license _LicenseClass;
--        typedef CComClassFactory2<license> _ComMapClass;
-+        using license::IsLicenseValid;
-+        using license::GetLicenseKey;
-+//        typedef CComClassFactory2<license> _ComMapClass;
- BEGIN_COM_MAP(CComClassFactory2<license>)
-         COM_INTERFACE_ENTRY(IClassFactory)
-         COM_INTERFACE_ENTRY(IClassFactory2)
-@@ -3297,7 +3320,7 @@
-                 if (ppvObject == NULL)
-                         return E_POINTER;
-                 *ppvObject = NULL;
--                if ( ((bstrKey != NULL) && !VerifyLicenseKey(bstrKey)) ||
-+                if ( ((bstrKey != NULL) && !this->VerifyLicenseKey(bstrKey)) ||
-                          ((bstrKey == NULL) && !IsLicenseValid()) )
-                         return CLASS_E_NOTLICENSED;
-                 if ((pUnkOuter != NULL) && !InlineIsEqualUnknown(riid))
-@@ -3363,7 +3386,7 @@
-                         if (pUnkOuter != NULL)
-                                 hRes = CLASS_E_NOAGGREGATION;
-                         else
--                                hRes = _Module.CreateInstance(m_pfnCreateInstance, riid, ppvObj);
-+                                hRes = _Module.CreateInstance((LPVOID)m_pfnCreateInstance, riid, ppvObj);
-                 }
-                 return hRes;
-         }
-@@ -3454,6 +3477,7 @@
-                         lpszHelpFile, iid, hRes);
-         }
- #endif
-+#if 0
-         template <class Q>
-         static HRESULT CreateInstance(IUnknown* punkOuter, Q** pp)
-         {
-@@ -3464,6 +3488,7 @@
-         {
-                 return T::_CreatorClass::CreateInstance(NULL, __uuidof(Q), (void**) pp);
-         }
-+#endif
- };
- 
- // ATL doesn't support multiple LCID's at the same time
-@@ -3651,7 +3676,7 @@
-                         {
-                                 CComPtr<ITypeInfo> spInfo(spTypeInfo);
-                                 CComPtr<ITypeInfo2> spTypeInfo2;
--                                if (SUCCEEDED(spTypeInfo->QueryInterface(&spTypeInfo2)))
-+                                if (SUCCEEDED(spTypeInfo->QueryInterface(IID_ITypeInfo2, (void**)&spTypeInfo2)))
-                                         spInfo = spTypeInfo2;
- 
-                                 m_pInfo = spInfo.Detach();
-@@ -3760,6 +3785,9 @@
- /////////////////////////////////////////////////////////////////////////////
- // IDispEventImpl
- 
-+template <class T>
-+struct _ATL_EVENT_ENTRY;
-+
- #ifdef _ATL_DLL
- ATLAPI AtlGetObjectSourceInterface(IUnknown* punkObj, GUID* plibid, IID* piid, unsigned short* pdwMajor, unsigned short* pdwMinor);
- #else
-@@ -3909,16 +3937,17 @@
- #else
- 
- #pragma warning(disable:4740)       // flow in/out of inline disables global opts
--inline void __declspec(naked) __stdcall CComStdCallThunkHelper()
-+inline void __stdcall CComStdCallThunkHelper()
- {
--        __asm
--        {
--                mov eax, [esp+4];       // get pThunk
--                mov edx, [eax+4];       // get the pThunk->pThis
--                mov [esp+4], edx;       // replace pThunk with pThis
--                mov eax, [eax+8];       // get pThunk->pfn
--                jmp eax;                // jump pfn
--        };
-+  asm(
-+      " movl $8(%ebp), %eax\n"       // get pThunk
-+      " movl $4(%eax), edx\n"       // get the pThunk->pThis
-+      " movl %edx, $8(%ebp)\n"       // replace pThunk with pThis
-+      " movl $8(%eax), %eax\n"       // get pThunk->pfn
-+      "	movl %ebp, %esp\n"
-+      "	popl %ebp\n"
-+      "	jmp %eax"                // jump pfn
-+      );
- }
- #pragma warning(default:4740)
- #endif
-@@ -3985,6 +4014,7 @@
- class ATL_NO_VTABLE IDispEventSimpleImpl : public _IDispEventLocator<nID, pdiid>
- {
- public:
-+        using _IDispEventLocator<nID, pdiid>::m_dwEventCookie;
-         STDMETHOD(_LocDEQueryInterface)(REFIID riid, void ** ppvObject)
-         {
-                 _ATL_VALIDATE_OUT_POINTER(ppvObject);
-@@ -3992,7 +4022,7 @@
-                 if (InlineIsEqualGUID(riid, *pdiid) || 
-                         InlineIsEqualUnknown(riid) ||
-                         InlineIsEqualGUID(riid, IID_IDispatch) ||
--                        InlineIsEqualGUID(riid, m_iid))
-+                        InlineIsEqualGUID(riid, this->m_iid))
-                 {
-                         *ppvObject = this;
-                         AddRef();
-@@ -4186,6 +4216,10 @@
- {
- public:
-         typedef tihclass _tihclass;
-+        using IDispEventSimpleImpl<nID, T, pdiid>::m_libid;
-+        using IDispEventSimpleImpl<nID, T, pdiid>::m_iid;
-+        using IDispEventSimpleImpl<nID, T, pdiid>::m_wMajorVerNum;
-+        using IDispEventSimpleImpl<nID, T, pdiid>::m_wMinorVerNum;
- 
-         IDispEventImpl()
-         {
-@@ -4475,6 +4509,11 @@
-         }
- };
- 
-+template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
-+class ATL_NO_VTABLE CComEnum;
-+template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
-+class ATL_NO_VTABLE CComEnumOnSTL;
-+
- 
- /////////////////////////////////////////////////////////////////////////////
- // CComEnumImpl
-@@ -4746,7 +4785,7 @@
-         return S_OK;
- }
- 
--template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
-+template <class Base, const IID* piid, class T, class Copy, class ThreadModel>
- class ATL_NO_VTABLE CComEnum :
-         public CComEnumImpl<Base, piid, T, Copy>,
-         public CComObjectRootEx< ThreadModel >
-@@ -4868,7 +4907,7 @@
-         return hRes;
- }
- 
--template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
-+template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel>
- class ATL_NO_VTABLE CComEnumOnSTL :
-         public IEnumOnSTLImpl<Base, piid, T, Copy, CollType>,
-         public CComObjectRootEx< ThreadModel >
-@@ -4901,7 +4940,7 @@
-                         return E_INVALIDARG;                        
-                 HRESULT hr = E_FAIL;
-                 Index--;
--                CollType::iterator iter = m_coll.begin();
-+                typename CollType::iterator iter = m_coll.begin();
-                 while (iter != m_coll.end() && Index > 0)
-                 {
-                         iter++;
-@@ -5314,7 +5353,7 @@
-                 if (InlineIsEqualGUID(riid, IID_IConnectionPoint) || InlineIsEqualUnknown(riid))
-                 {
-                         *ppvObject = this;
--                        AddRef();
-+                        this->AddRef();
- #ifdef _ATL_DEBUG_INTERFACES
-                         _Module.AddThunk((IUnknown**)ppvObject, _T("IConnectionPointImpl"), riid);
- #endif // _ATL_DEBUG_INTERFACES
---- include/atl/atlconv.h.orig	2005-04-14 17:54:32.000000000 +0900
-+++ include/atl/atlconv.h	2007-12-31 07:29:34.759750000 +0900
-@@ -10,6 +10,9 @@
- 
- #ifndef __ATLCONV_H__
- #define __ATLCONV_H__
-+#if __GNUC__ >=3
-+#pragma GCC system_header
-+#endif
- 
- #ifndef __cplusplus
-         #error ATL requires C++ compilation (use a .cpp suffix)
-@@ -30,7 +33,11 @@
- // Following code is to avoid alloca causing a stack overflow.
- // It is intended for use from the _ATL_SAFE_ALLOCA macros 
- // or Conversion macros.
--__declspec(selectany) DWORD _Atlosplatform = 0;
-+#ifdef _INIT_ATL_COMMON_VARS
-+DWORD _Atlosplatform = 0;
-+#else
-+extern DWORD _Atlosplatform;
-+#endif
- inline BOOL _AtlGetVersionEx()
- {
-         OSVERSIONINFO osi;
-@@ -156,8 +163,11 @@
- #pragma prefast(suppress:515, "Atlresetstkoflw is the same as resetstkoflw")
- 
- // Verifies if sufficient space is available on the stack.
--inline bool _AtlVerifyStackAvailable(SIZE_T Size)
-+inline bool _AtlVerifyStackAvailable(SIZE_T /*Size*/)
- {
-+#if 1
-+    return false;
-+#else
-     bool bStackAvailable = true;
- 
-     __try
-@@ -173,6 +183,7 @@
-         _Atlresetstkoflw();
-     }
-     return bStackAvailable;
-+#endif
- }
- 
- #pragma prefast(pop)
-@@ -281,15 +292,15 @@
- 
- #ifdef _CONVERSION_USES_THREAD_LOCALE
-         #ifndef _DEBUG
--                #define USES_CONVERSION int _convert; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
-+                #define USES_CONVERSION int _convert; (void)_convert; UINT _acp = GetACP(); (void)_acp; LPCWSTR _lpw; (void)_lpw; LPCSTR _lpa; (void)_lpa
-         #else
--                #define USES_CONVERSION int _convert = 0; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
-+                #define USES_CONVERSION int _convert = 0; (void)_convert; UINT _acp = GetACP(); (void)_acp; LPCWSTR _lpw = NULL; (void)_lpw; LPCSTR _lpa = NULL; (void)_lpa
-         #endif
- #else
-         #ifndef _DEBUG
--                #define USES_CONVERSION int _convert; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
-+                #define USES_CONVERSION int _convert; (void)_convert; UINT _acp = CP_ACP; (void)_acp; LPCWSTR _lpw; (void)_lpw; LPCSTR _lpa; (void)_lpa
-         #else
--                #define USES_CONVERSION int _convert = 0; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
-+                #define USES_CONVERSION int _convert = 0; (void)_convert; UINT _acp = CP_ACP; (void)_acp; LPCWSTR _lpw = NULL; (void)_lpw; LPCSTR _lpa = NULL; (void)_lpa
-         #endif
- #endif
- 
---- include/atl/atlctl.h.orig	2005-04-14 17:54:32.000000000 +0900
-+++ include/atl/atlctl.h	2009-04-19 13:31:15.146000000 +0900
-@@ -10,6 +10,9 @@
- 
- #ifndef __ATLCTL_H__
- #define __ATLCTL_H__
-+#if __GNUC__ >=3
-+#pragma GCC system_header
-+#endif
- 
- #ifndef __cplusplus
-         #error ATL requires C++ compilation (use a .cpp suffix)
-@@ -57,7 +60,7 @@
- namespace ATL
- {
- 
--#pragma pack(push, _ATL_PACKING)
-+#pragma pack(push, 8)
- 
- // Forward declarations
- //
-@@ -142,7 +145,9 @@
-         CComControlBase(HWND& h) : m_hWndCD(h)
-         {
-                 memset(this, 0, sizeof(CComControlBase));
--                m_phWndCD = &h;
-+		// previous element of m_hWndCD in this class is m_rcPos
-+		*reinterpret_cast<HWND **>(reinterpret_cast<DWORD>(reinterpret_cast<char *>(&m_rcPos)+sizeof(m_rcPos)+(__alignof__(m_hWndCD)-1))&(-(__alignof__(m_hWndCD))))=&h;
-+//                m_phWndCD = &h;
-                 m_sizeExtent.cx = 2*2540;
-                 m_sizeExtent.cy = 2*2540;
-                 m_sizeNatural = m_sizeExtent;
-@@ -530,13 +535,13 @@
-         SIZE m_sizeNatural; //unscaled size in himetric
-         SIZE m_sizeExtent;  //current extents in himetric
-         RECT m_rcPos; // position in pixels
--#pragma warning(disable: 4510 4610) // unnamed union
--        union
--        {
-+//#pragma warning(disable: 4510 4610) // unnamed union
-+//        union
-+//        {
-                 HWND& m_hWndCD;
--                HWND* m_phWndCD;
--        };
--#pragma warning(default: 4510 4610)
-+//                HWND* m_phWndCD;
-+//        };
-+//#pragma warning(default: 4510 4610)
-         union
-         {
-                 // m_nFreezeEvents is the only one actually used
-@@ -1362,7 +1367,7 @@
- class ATL_NO_VTABLE CComControl :  public CComControlBase, public WinBase
- {
- public:
--        CComControl() : CComControlBase(m_hWnd) {}
-+        CComControl() : CComControlBase(this->m_hWnd) {}
-         HRESULT FireOnRequestEdit(DISPID dispID)
-         {
-                 T* pT = static_cast<T*>(this);
-@@ -1401,6 +1406,8 @@
- class CComCompositeControl : public CComControl< T, CAxDialogImpl< T > >
- {
- public:
-+        using CComControl< T, CAxDialogImpl< T > >::m_hWnd;
-+        using CComControl< T, CAxDialogImpl< T > >::GetNextDlgTabItem;
-         CComCompositeControl()
-         {
-                 m_hbrBackground = NULL;
-@@ -1429,7 +1436,7 @@
-                         m_hbrBackground = NULL;
-                 }
-                 OLE_COLOR clr;
--                HRESULT hr = GetAmbientBackColor(clr);
-+                HRESULT hr = this->GetAmbientBackColor(clr);
-                 if (SUCCEEDED(hr))
-                 {
-                         COLORREF rgb;
-@@ -1443,7 +1450,7 @@
-         {
-                 CAxWindow wnd(hwnd);
-                 CComPtr<IAxWinAmbientDispatch> spDispatch;
--                wnd.QueryHost(&spDispatch);
-+                wnd.QueryHost(IID_IAxWinAmbientDispatch, (void**)&spDispatch);
-                 if (spDispatch != NULL)
-                         spDispatch->put_BackColor((OLE_COLOR)l);
-                 return TRUE;
-@@ -1458,10 +1465,10 @@
-         }
-         HWND Create(HWND hWndParent, RECT& /*rcPos*/, LPARAM dwInitParam = NULL)
-         {
--                CComControl< T, CAxDialogImpl< T > >::Create(hWndParent, dwInitParam);
-+                this->Create(hWndParent, dwInitParam);
-                 SetBackgroundColorFromAmbient();
-                 if (m_hWnd != NULL)
--                        ShowWindow(SW_SHOWNOACTIVATE);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list