[Libreoffice-commits] core.git: configure.ac connectivity/source download.lst external/firebird external/libtommath external/Module_external.mk Makefile.fetch RepositoryExternal.mk

Wastack btomi96 at gmail.com
Wed Aug 17 13:06:04 UTC 2016


 Makefile.fetch                                               |    1 
 RepositoryExternal.mk                                        |   49 
 configure.ac                                                 |   29 
 connectivity/source/drivers/firebird/Driver.cxx              |   19 
 download.lst                                                 |    4 
 external/Module_external.mk                                  |    1 
 external/firebird/ExternalPackage_firebird.mk                |   11 
 external/firebird/ExternalProject_firebird.mk                |   45 
 external/firebird/UnpackedTarball_firebird.mk                |   11 
 external/firebird/firebird-Engine12.patch                    |   16 
 external/firebird/firebird-c++11.patch.1                     |   27 
 external/firebird/firebird-c++14.patch                       |   30 
 external/firebird/firebird-configure-x86-64-macosx.patch.1   |   12 
 external/firebird/firebird-cygwin-msvc.patch                 |  687 +++++++++++
 external/firebird/firebird-cygwin-msvc.patch.1               |  484 -------
 external/firebird/firebird-macosx.patch.1                    |  185 +-
 external/firebird/firebird-rpath.patch.0                     |   16 
 external/firebird/firebird.disable-ib-util-not-found.patch.1 |    8 
 external/libtommath/ExternalProject_libtommath.mk            |   36 
 external/libtommath/Makefile                                 |    7 
 external/libtommath/Module_libtommath.mk                     |   17 
 external/libtommath/README                                   |    6 
 external/libtommath/UnpackedTarball_libtommath.mk            |   20 
 external/libtommath/libtommath-msvc.patch                    |   12 
 24 files changed, 1060 insertions(+), 673 deletions(-)

New commits:
commit 45f42681f4d1260c42140a313560534e605f81a4
Author: Wastack <btomi96 at gmail.com>
Date:   Thu Jul 28 17:16:19 2016 +0200

    GSoC Upgrade firebird to 3.0
    
    Embedded firebird is now version 3.0.
    
    Supports MSVC 14.0.
    
    Instead of fbembed, there are now two libraries: fbclient and
    Engine12. fbclient is linked as fbembed before, Engine12 is loaded
    at runtime from fbclient.
    
    fb now needs system libtommath, which is supplied
    as a new ExternalProject of LO.
    
    Change-Id: I132939bdee745795b22f675e4265e9590079c45f
    Reviewed-on: https://gerrit.libreoffice.org/27642
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/Makefile.fetch b/Makefile.fetch
index ea7b343..dc2f648 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -160,6 +160,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,LIBLANGTAG,LANGTAGREG_TARBALL) \
 		$(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \
 		$(call fetch_Optional,LIBPNG,PNG_TARBALL) \
+		$(call fetch_Optional,LIBTOMMATH,LIBTOMMATH_TARBALL) \
 		$(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \
 		LIBXMLSEC_TARBALL \
 		$(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 806a5e8..0345edc 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2901,6 +2901,36 @@ endef
 
 endif # SYSTEM_OPENLDAP
 
+ifneq ($(SYSTEM_LIBTOMMATH),)
+
+define gb_LinkTarget__use_libtommath
+$(call gb_LinkTarget_set_include,$(1),\
+	$(LIBTOMMATH_CFLAGS) \
+	$$(INCLUDE) \
+)
+$(call gb_LinkTarget_add_libs,$(1),$(LIBTOMMATH_LIBS))
+
+endef
+
+else # !SYSTEM_LIBTOMMATH
+define gb_LinkTarget__use_libtommath
+$(call gb_LinkTarget_set_include,$(1),\
+	-I${WORKDIR}/UnpackedTarball/libtommath \
+	$$(INCLUDE) \
+)
+$(call gb_LinkTarget_add_libs,$(1),\
+	$(call gb_UnpackedTarball_get_dir,libtommath)/libtommath$(gb_StaticLibrary_PLAINEXT) \
+)
+$(call gb_LinkTarget_use_external_project,$(1),libtommath)
+
+endef
+
+endif # SYSTEM_LIBTOMMATH
+
+define gb_ExternalProject__use_libtommath
+$(call gb_ExternalProject_use_external_project,$(1),libtommath)
+
+endef
 
 ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE)
 
@@ -2915,38 +2945,29 @@ $(call gb_LinkTarget_add_libs,$(1),$(FIREBIRD_LIBS))
 
 endef
 
-# gb_LinkTarget__use_atomic_ops :=
-# gb_LinkTarget__use_tommath :=
-
 else # !SYSTEM_FIREBIRD
 
 #$(call gb_LinkTarget__use_libatomic_ops,$(1))
+#$(call gb_LinkTarget__use_libtommath,$(1))
 
 define gb_LinkTarget__use_libfbembed
 $(call gb_LinkTarget_use_package,$(1),firebird)
 $(call gb_LinkTarget_set_include,$(1),\
+	-I$(call gb_UnpackedTarball_get_dir,firebird)/gen/Release/firebird/include \
 	$$(INCLUDE) \
-	-I$(call gb_UnpackedTarball_get_dir,firebird)/gen/firebird/include \
 )
 ifeq ($(COM),MSC)
 $(call gb_LinkTarget_add_libs,$(1),\
-	$(call gb_UnpackedTarball_get_dir,firebird)/gen/firebird/bin/ifbembed.lib \
+	$(call gb_UnpackedTarball_get_dir,firebird)/gen/Release/firebird/bin/ifbclient.lib \
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-	-L$(call gb_UnpackedTarball_get_dir,firebird)/gen/firebird/lib -lfbembed \
+	-L$(call gb_UnpackedTarball_get_dir,firebird)/gen/Release/firebird/lib -lfbclient \
 )
 endif
 
 endef
 
-# define gb_LinkTarget__use_tommath
-# $(call gb_LinkTarget_set_include,$(1),\
-# 	$(TOMMATH_CFLAGS) \
-# 	$$(INCLUDE) \
-# )
-
-# $(call gb_LinkTarget_add_libs,$(1),$(TOMMATH_LIBS))
 
 # endef
 
@@ -2956,7 +2977,7 @@ else # !ENABLE_FIREBIRD_SDBC
 
 gb_LinkTarget__use_firebird :=
 # gb_LinkTarget__use_atomic_ops :=
-# gb_LinkTarget__use_tommath :=
+# gb_LinkTarget__use_libtommath :=
 
 endif # ENABLE_FIREBIRD_SDBC
 
diff --git a/configure.ac b/configure.ac
index 5d07254..e71670e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1776,6 +1776,11 @@ AC_ARG_WITH(system-firebird,
          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
     [with_system_firebird="$with_system_libs"])
 
+AC_ARG_WITH(system-libtommath,
+            AS_HELP_STRING([--with-system-libtommath],
+                           [Use libtommath already on system]),,
+            [with_system_libtommath="$with_system_libs"])
+
 AC_ARG_WITH(system-hsqldb,
     AS_HELP_STRING([--with-system-hsqldb],
         [Use hsqldb already on system.]))
@@ -8803,6 +8808,8 @@ int fb_api_is_30(void) { return 0; }
     elif test "$cross_compiling" = "yes"; then
         AC_MSG_RESULT([none])
     else
+        dnl Embedded Firebird has version 3.0
+        AC_DEFINE(HAVE_FIREBIRD_30, 1)
         dnl We need libatomic-ops for any non X86/X64 system
         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
             dnl ===================================================================
@@ -8823,8 +8830,22 @@ int fb_api_is_30(void) { return 0; }
 
         AC_MSG_RESULT([internal])
         SYSTEM_FIREBIRD=
-        FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
-        FIREBIRD_LIBS="-lfbembed"
+        FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
+        FIREBIRD_LIBS="-lfbclient"
+
+        if test "$with_system_libtommath" = "yes"; then
+            SYSTEM_LIBTOMMATH=TRUE
+            dnl check for tommath presence
+            save_LIBS=$LIBS
+            AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
+            AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
+            LIBS=$save_LIBS
+        else
+            SYSTEM_LIBTOMMATH=
+            LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
+            LIBTOMMATH_LIBS="-ltommath"
+            BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
+        fi
 
         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
         ENABLE_FIREBIRD_SDBC="TRUE"
@@ -8838,8 +8859,8 @@ AC_SUBST(SYSTEM_FIREBIRD)
 AC_SUBST(FIREBIRD_CFLAGS)
 AC_SUBST(FIREBIRD_LIBS)
 AC_SUBST(HAVE_FIREBIRD_30)
-dnl AC_SUBST([TOMMATH_CFLAGS])
-dnl AC_SUBST([TOMMATH_LIBS])
+AC_SUBST([TOMMATH_CFLAGS])
+AC_SUBST([TOMMATH_LIBS])
 
 dnl ===================================================================
 dnl Check for system curl
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index ab83b50..a3224e5 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -62,6 +62,9 @@ namespace {
 const char our_sFirebirdTmpVar[] = "FIREBIRD_TMP";
 const char our_sFirebirdLockVar[] = "FIREBIRD_LOCK";
 const char our_sFirebirdMsgVar[] = "FIREBIRD_MSG";
+#ifdef MACOSX
+const char our_sFirebirdLibVar[] = "LIBREOFFICE_FIREBIRD_LIB";
+#endif
 };
 
 FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
@@ -94,7 +97,16 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo
     OUString sMsgPath;
     ::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath);
     osl_setEnvironment(OUString(our_sFirebirdMsgVar).pData, sMsgPath.pData);
-#endif
+#ifdef MACOSX
+    // Set an env. variable to specify library location
+    // for dlopen used in fbclient.
+    OUString sLibURL("$LO_LIB_DIR");
+    ::rtl::Bootstrap::expandMacros(sLibURL);
+    OUString sLibPath;
+    ::osl::FileBase::getSystemPathFromFileURL(sLibURL, sLibPath);
+    osl_setEnvironment(OUString(our_sFirebirdLibVar).pData, sLibPath.pData);
+#endif /*MACOSX*/
+#endif /*!SYSTEM_FIREBIRD*/
 }
 
 FirebirdDriver::~FirebirdDriver()
@@ -120,7 +132,10 @@ void FirebirdDriver::disposing()
 
 #ifndef SYSTEM_FIREBIRD
     osl_clearEnvironment(OUString(our_sFirebirdMsgVar).pData);
-#endif
+#ifdef MACOSX
+    osl_clearEnvironment(OUString(our_sFirebirdLibVar).pData);
+#endif /*MACOSX*/
+#endif /*!SYSTEM_FIREBIRD*/
 
     OSL_VERIFY(fb_shutdown(0, 1));
 
diff --git a/download.lst b/download.lst
index 43954d1..4383abb 100644
--- a/download.lst
+++ b/download.lst
@@ -39,6 +39,8 @@ export FIREBIRD_MD5SUM := b0b5293991fcf07347b38431c80be1d4
 export FIREBIRD_TARBALL := Firebird-2.5.5.26952-0.tar.bz2
 # FIREBIRD_MD5SUM := b259c2d1c60a03bd104108405ae990a7
 # export FIREBIRD_TARBALL := Firebird-3.0-alpha1-20130302.tar.gz
+export FIREBIRD_MD5SUM := 821260b61dafc22899d1464d4e91ee6a
+export FIREBIRD_TARBALL := Firebird-3.0.0.32483-0.tar.bz2
 export FONTCONFIG_TARBALL := 77e15a92006ddc2adbb06f840d591c0e-fontconfig-2.8.0.tar.gz
 export FONT_CALADEA_TARBALL := 368f114c078f94214a308a74c7e991bc-crosextrafonts-20130214.tar.gz
 export FONT_CARLITO_TARBALL := c74b7223abe75949b4af367942d96c7a-crosextrafonts-carlito-20130920.tar.gz
@@ -94,6 +96,8 @@ export LIBGLTF_MD5SUM := d63a9f47ab048f5009d90693d6aa6424
 export LIBGLTF_TARBALL := libgltf-0.0.2.tar.bz2
 export LIBLANGTAG_TARBALL := aa899eff126216dafe721149fbdb511b-liblangtag-0.5.8.tar.bz2
 export LIBXMLSEC_TARBALL := 0fb1bb06d60d7708abc4797008209bcc-xmlsec1-1.2.22.tar.gz
+export LIBTOMMATH_MD5SUM := da283d2e3e72137d0c600ac36b991c9d
+export LIBTOMMATH_TARBALL := ltm-1.0.zip
 export LIBXML_TARBALL := ae249165c173b1ff386ee8ad676815f5-libxml2-2.9.4.tar.gz
 export LIBXSLT_TARBALL := a129d3c44c022de3b9dcf6d6f288d72e-libxslt-1.1.29.tar.gz
 export LPSOLVE_TARBALL := 26b3e95ddf3d9c077c480ea45874b3b8-lp_solve_5.5.tar.gz
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 1e3ce40..550fe03a 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -68,6 +68,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,LIBXML2,libxml2) \
 	$(call gb_Helper_optional,LIBXSLT,libxslt) \
 	$(call gb_Helper_optional,LPSOLVE,lpsolve) \
+	$(call gb_Helper_optional,LIBTOMMATH,libtommath) \
 	$(call gb_Helper_optional,MARIADB,libmariadb) \
 	$(call gb_Helper_optional,MDDS,mdds) \
 	$(call gb_Helper_optional,MDNSRESPONDER,mdnsresponder) \
diff --git a/external/firebird/ExternalPackage_firebird.mk b/external/firebird/ExternalPackage_firebird.mk
index 6e757d8..eb9438d 100644
--- a/external/firebird/ExternalPackage_firebird.mk
+++ b/external/firebird/ExternalPackage_firebird.mk
@@ -12,13 +12,16 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,firebird,firebird))
 $(eval $(call gb_ExternalPackage_use_external_project,firebird,firebird))
 
 ifeq ($(OS)-$(COM),WNT-MSC)
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/ifbembed.dll,gen/firebird/bin/ifbembed.dll))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/ifbclient.dll,gen/Release/firebird/bin/ifbclient.dll))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/Engine12.dll,gen/Release/firebird/plugins/Engine12.dll))
 else ifeq ($(OS),MACOSX)
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbembed.dylib,gen/firebird/lib/libfbembed.dylib.2.5.5))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.dylib.3.0.0,gen/Release/firebird/lib/libfbclient.dylib.3.0.0))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libEngine12.dylib,gen/Release/firebird/plugins/libEngine12.dylib))
 else ifeq ($(DISABLE_DYNLOADING),)
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbembed.so.2.5,gen/firebird/lib/libfbembed.so.2.5.5))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.so.2,gen/Release/firebird/lib/libfbclient.so.3.0.0))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libEngine12.so,gen/Release/firebird/plugins/libEngine12.so))
 endif
 
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_SHARE_FOLDER)/firebird/firebird.msg,gen/firebird/firebird.msg))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_SHARE_FOLDER)/firebird/firebird.msg,gen/Release/firebird/firebird.msg))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk
index 11817ee..82de2d3 100644
--- a/external/firebird/ExternalProject_firebird.mk
+++ b/external/firebird/ExternalProject_firebird.mk
@@ -15,15 +15,13 @@ $(eval $(call gb_ExternalProject_use_externals,firebird,\
 	boost_headers \
 	icu \
 	libatomic_ops \
+	libtommath \
 ))
 
 $(eval $(call gb_ExternalProject_register_targets,firebird,\
 	build \
 ))
 
-# note: this can intentionally only build against internal atomic_op
-# note: this can intentionally only build against internal tommath
-
 ifneq ($(OS),WNT)
 INVOKE_FPA:="CPU=\$$(EMPTY) $${FB_CPU_ARG}"
 endif
@@ -34,7 +32,8 @@ MAKE_PRE=$(if $(filter WNT,$(OS)),\
 
 MAKE_POST=$(if $(filter MACOSX,$(OS)),&& $(PERL) \
 			$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
-			$(gb_Package_SOURCEDIR_firebird)/gen/firebird/lib/libfbembed.dylib.2.5.5)
+			$(gb_Package_SOURCEDIR_firebird)/gen/Release/firebird/plugins/libEngine12.dylib \
+			$(gb_Package_SOURCEDIR_firebird)/gen/Release/firebird/lib/libfbclient.dylib.3.0.0)
 
 # do not set LDFLAGS - it is mysteriously not used by firebird on MacOSX
 $(call gb_ExternalProject_get_state_target,firebird,build):
@@ -46,23 +45,41 @@ $(call gb_ExternalProject_get_state_target,firebird,build):
 			$(if $(SYSTEM_LIBATOMIC_OPS),$(LIBATOMIC_OPS_CFLAGS), \
 				-I$(call gb_UnpackedTarball_get_dir,libatomic_ops)/src \
 			) \
+			$(if $(SYSTEM_LIBTOMMATH),$(LIBTOMMATH_CFLAGS), \
+				-I$(call gb_UnpackedTarball_get_dir,libtommath) \
+				-L$(call gb_UnpackedTarball_get_dir,libtommath) \
+			) \
+			$(if $(filter WNT MACOSX,$(OS)), \
+				$(if $(SYSTEM_ICU),$(ICU_CPPFLAGS), \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source/common \
+					-L$(call gb_UnpackedTarball_get_dir,icu)/source/lib \
+				)) \
 			" \
 		&& export CXXFLAGS=" \
 			$(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS), \
 				$(BOOST_CPPFLAGS) \
 				-L$(call gb_UnpackedTarball_get_dir,boost)/source/lib \
 			) \
-			$(if $(SYSTEM_ICU),$(ICU_CPPFLAGS), \
-				-I$(call gb_UnpackedTarball_get_dir,icu)/source \
-				-I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \
-				-I$(call gb_UnpackedTarball_get_dir,icu)/source/common \
-				-L$(call gb_UnpackedTarball_get_dir,icu)/source/lib \
+			$(if $(filter-out WNT MACOSX,$(OS)), \
+				$(if $(SYSTEM_ICU),$(ICU_CPPFLAGS), \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \
+					-I$(call gb_UnpackedTarball_get_dir,icu)/source/common \
+					-L$(call gb_UnpackedTarball_get_dir,icu)/source/lib \
+				)) \
+			$(if $(SYSTEM_LIBTOMMATH),$(LIBTOMMATH_CFLAGS), \
+				-L$(call gb_UnpackedTarball_get_dir,libtommath) \
 			) \
-			" \
+		" \
+		$(if $(filter MACOSX,$(OS)), \
+		&& export DYLD_LIBRARY_PATH="$(call gb_UnpackedTarball_get_dir,icu)/source/lib" \
+		)\
 		&& MAKE=$(MAKE) ./configure \
 			--without-editline \
-			--disable-superserver \
-			--with-system-icu --without-fbsample --without-fbsample-db \
+			--without-fbsample --without-fbsample-db \
+			--with-wire-compress=no \
 			$(if $(filter-out MSC,$(COM)),$(if $(ENABLE_DEBUG),--enable-debug)) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(DISABLE_DYNLOADING), \
@@ -71,9 +88,9 @@ $(call gb_ExternalProject_get_state_target,firebird,build):
 				--enable-shared --disable-static \
 			) \
 		&& if [ -n "$${FB_CPU_ARG}" ]; then \
-			   $(MAKE_PRE) $(MAKE) $(INVOKE_FPA) SHELL='$(SHELL)' firebird_embedded $(MAKE_POST); \
+			   $(MAKE_PRE) $(MAKE) $(INVOKE_FPA) SHELL='$(SHELL)' $(MAKE_POST); \
 			else \
-			   $(MAKE_PRE) $(MAKE) SHELL='$(SHELL)' firebird_embedded $(MAKE_POST); \
+			   $(MAKE_PRE) $(MAKE) SHELL='$(SHELL)' $(MAKE_POST); \
 			fi \
 	)
 # vim: set noet sw=4 ts=4:
diff --git a/external/firebird/UnpackedTarball_firebird.mk b/external/firebird/UnpackedTarball_firebird.mk
index d04a350a..eebe4d0 100644
--- a/external/firebird/UnpackedTarball_firebird.mk
+++ b/external/firebird/UnpackedTarball_firebird.mk
@@ -14,23 +14,22 @@ $(eval $(call gb_UnpackedTarball_set_tarball,firebird,$(FIREBIRD_TARBALL)))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,firebird,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
-	external/firebird/firebird-rpath.patch.0 \
-	external/firebird/firebird-c++11.patch.1 \
         external/firebird/firebird.disable-ib-util-not-found.patch.1 \
-	external/firebird/firebird-c++14.patch \
+		external/firebird/firebird-Engine12.patch \
+		external/firebird/firebird-rpath.patch.0 \
 ))
 
 ifeq ($(OS)-$(COM),WNT-MSC)
 $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
-	external/firebird/firebird-cygwin-msvc.patch.1 \
+	external/firebird/firebird-cygwin-msvc.patch \
 ))
 endif
 
 ifeq ($(OS),MACOSX)
 $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
-	external/firebird/firebird-macosx.patch.1 \
 	external/firebird/firebird-configure-x86-64-macosx.patch.1 \
-	external/firebird/macosx-elcapitan-dyld.patch \
+	external/firebird/firebird-macosx.patch.1 \
 ))
 endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/firebird/firebird-Engine12.patch b/external/firebird/firebird-Engine12.patch
new file mode 100644
index 0000000..f6590b3
--- /dev/null
+++ b/external/firebird/firebird-Engine12.patch
@@ -0,0 +1,16 @@
+--- src/common/utils.cpp 
++++ src/common/utils.cpp 
+@@ -1026,6 +1026,13 @@
+ 			PathUtils::concatPath(s, configDir[prefType], name);
+ 			return s;
+ 		}
++
++                // Set relative path to Engine12 dynamic library
++                if(prefType == Firebird::IConfigManager::DIR_PLUGINS)
++                {
++                    s = name;
++                    return s;
++                }
+ 	}
+ 
+ 	switch(prefType)
diff --git a/external/firebird/firebird-c++11.patch.1 b/external/firebird/firebird-c++11.patch.1
deleted file mode 100644
index 8f22616..0000000
--- a/external/firebird/firebird-c++11.patch.1
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- Mode: Diff -*-
---- firebird/src/dudley/exe.epp
-+++ firebird/src/dudley/exe.epp
-@@ -2884,9 +2884,9 @@
- 		blr_parameter, 0, 0, 0,
- 		blr_parameter, 0, 1, 0,
- 		blr_parameter, 1, 0, 0,
--		blr_end,
--		blr_end,
--		blr_end,
-+		SCHAR(blr_end),
-+		SCHAR(blr_end),
-+		SCHAR(blr_end),
- 		blr_eoc
- 	};
- 	static FB_API_HANDLE req_handle;
---- firebird/src/gpre/sqe.cpp
-+++ firebird/src/gpre/sqe.cpp
-@@ -2529,7 +2529,7 @@
- 		return par_stat(request);
- 
- 	if (MSC_match(KW_MINUS))
--		return MSC_unary(nod_negate, par_primitive_value(request, false, paren_count, false));
-+		return MSC_unary(nod_negate, par_primitive_value(request, false, paren_count, NULL));
- 
- 	MSC_match(KW_PLUS);
- 
diff --git a/external/firebird/firebird-c++14.patch b/external/firebird/firebird-c++14.patch
deleted file mode 100644
index d978cef..0000000
--- a/external/firebird/firebird-c++14.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- src/common/classes/alloc.cpp
-+++ src/common/classes/alloc.cpp
-@@ -2121,3 +2121,11 @@
- {
- 	Firebird::MemoryPool::globalFree(mem);
- }
-+void operator delete(void* mem, size_t) throw()
-+{
-+	Firebird::MemoryPool::globalFree(mem);
-+}
-+void operator delete[](void* mem, size_t) throw()
-+{
-+	Firebird::MemoryPool::globalFree(mem);
-+}
---- src/common/classes/alloc.h
-+++ src/common/classes/alloc.h
-@@ -491,13 +491,6 @@
- 
- inline static MemoryPool* getDefaultMemoryPool() { return Firebird::MemoryPool::processMemoryPool; }
- 
--// Global versions of operators new and delete
--void* operator new(size_t s) THROW_BAD_ALLOC;
--void* operator new[](size_t s) THROW_BAD_ALLOC;
--
--void operator delete(void* mem) throw();
--void operator delete[](void* mem) throw();
--
- #ifdef DEBUG_GDS_ALLOC
- inline void* operator new(size_t s, Firebird::MemoryPool& pool, const char* file, int line)
- {
diff --git a/external/firebird/firebird-configure-x86-64-macosx.patch.1 b/external/firebird/firebird-configure-x86-64-macosx.patch.1
index eddd0fa..99a7d2d 100644
--- a/external/firebird/firebird-configure-x86-64-macosx.patch.1
+++ b/external/firebird/firebird-configure-x86-64-macosx.patch.1
@@ -1,20 +1,20 @@
 --- firebird.org/configure	2015-03-27 16:00:42.000000000 +0200
-+++ firebird/configure	2015-06-09 15:33:26.000000000 +0300
-@@ -2373,7 +2373,7 @@
++++ firebird/configure 2015-06-09 15:33:26.000000000 +0300
+@@ -2903,7 +2903,7 @@
      ;;
  
-   i*86-*-darwin* | i*86_*-darwin*)
+   i*86-*-darwin*)
 -    MAKEFILE_PREFIX=darwin_i386
 +    MAKEFILE_PREFIX=darwin_x86_64
      MAKEFILE_POSTFIX=darwin
      PLATFORM=DARWIN
      INSTALL_PREFIX=darwin
-@@ -2386,7 +2386,7 @@
+@@ -2913,7 +2913,7 @@
+ 	LIBS="$LIBS -framework CoreFoundation"
      EDITLINE_FLG=Y
      SHRLIB_EXT=dylib
-     ICU_PLATFORM=MacOSX
 -    CPU_TYPE=i386
 +    CPU_TYPE=x86_64
+     EXPORT_SYMBOLS_STYLE=darwin
      ;;
  
-   powerpc-*-darwin*)
diff --git a/external/firebird/firebird-cygwin-msvc.patch b/external/firebird/firebird-cygwin-msvc.patch
new file mode 100644
index 0000000..10c1dfe
--- /dev/null
+++ b/external/firebird/firebird-cygwin-msvc.patch
@@ -0,0 +1,687 @@
+--- src/include/firebird.h	2016-07-15 11:31:27.151443500 +0200
++++ src/include/firebird.h	2016-07-17 14:50:04.043792400 +0200
+@@ -32,11 +32,7 @@
+ #ifndef INCLUDE_Firebird_H
+ #define INCLUDE_Firebird_H
+ 
+-#ifdef _MSC_VER
+-#include "gen/autoconfig_msvc.h"
+-#else
+ #include "gen/autoconfig.h"
+-#endif
+ 
+ // Using our debugging code is pointless when we may use Valgrind features
+ #if defined(DEV_BUILD) && !defined(USE_VALGRIND)
+--- src/misc/writeBuildNum.sh	2016-07-07 15:57:04.538983200 +0200
++++ src/misc/writeBuildNum.sh	2016-07-13 11:31:18.132820200 +0200
+@@ -95,9 +95,9 @@
+ createMakeVersion() {
+
+ OdsH="${Root}/src/jrd/ods.h"
+-Mini="/tmp/miniods.h"
+-TestCpp="/tmp/test.cpp"
+-AOut="/tmp/a.out"
++Mini=$(cygpath -m "/tmp/miniods.h")
++TestCpp=$(cygpath -m "/tmp/test.cpp")
++AOut=$(cygpath -m "/tmp/a.out")
+
+ grep ODS_VERSION $OdsH | grep -v ENCODE_ODS >$Mini
+
+--- builds/make.new/config/config.h.in	2016-07-07 15:55:55.693112800 +0200
++++ builds/make.new/config/config.h.in	2016-07-08 13:38:49.994986400 +0200
+@@ -396,7 +396,7 @@
+ #undef HAVE_SIGSET
+ 
+ /* Define to 1 if you have the `snprintf' function. */
+-#undef HAVE_SNPRINTF
++#define HAVE_SNPRINTF
+ 
+ /* Define to 1 if you have the <socket.h> header file. */
+ #undef HAVE_SOCKET_H
+@@ -551,7 +551,7 @@
+ #undef HAVE_VFORK_H
+ 
+ /* Define to 1 if you have the `vsnprintf' function. */
+-#undef HAVE_VSNPRINTF
++#define HAVE_VSNPRINTF
+ 
+ /* Define to 1 if you have the <winsock2.h> header file. */
+ #undef HAVE_WINSOCK2_H
+@@ -646,7 +646,7 @@
+ #undef TIME_WITH_SYS_TIME
+ 
+ /* Define this if OS is Windows NT */
+-#undef WIN_NT
++#define WIN_NT
+ 
+ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+    significant byte first (like Motorola and SPARC, unlike Intel). */
+@@ -703,3 +703,40 @@
+ #ifndef HAVE_SOCKLEN_T
+ typedef int socklen_t;
+ #endif
++
++/* taken from src/include/gen/autoconfig_msvc.h */
++#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
++/* target architecture */
++#if defined(_M_IX86)
++/* sizeof(void *) */
++#define SIZEOF_VOID_P 4
++/* sizeof(size_t) */
++#define SIZEOF_SIZE_T 4
++/* alignment of long */
++#define FB_ALIGNMENT 4
++#elif defined(_M_AMD64)
++#define AMD64
++/* sizeof(void *) */
++#define SIZEOF_VOID_P 8
++/* sizeof(size_t) */
++#define SIZEOF_SIZE_T 8
++/* alignment of long */
++#define FB_ALIGNMENT 8
++#else
++#error unknown target platform
++#endif
++
++#define HAVE_IO_H
++
++#define HAVE_GETPAGESIZE
++
++#if defined _MSC_VER
++#if _MSC_VER < 1500
++#define vsnprintf _vsnprintf
++#endif
++#define isnan _isnan
++#endif
++
++#if _MSC_VER < 1900
++#define snprintf _snprintf
++#endif
+--- src/common/common.h	2016-07-15 11:31:26.366735500 +0200
++++ src/common/common.h	2016-07-17 16:18:39.121579400 +0200
+@@ -551,15 +551,6 @@
+ #endif /* WIN_NT */
+ 
+ 
+-#ifndef FB_CPU
+-#error Define FB_CPU for your platform
+-#endif
+-#ifndef FB_OS
+-#error Define FB_OS for your platform
+-#endif
+-#ifndef FB_CC
+-#error Define FB_CC for your platform
+-#endif
+ 
+ 
+ /*****************************************************
+diff -ur builds/posix/make.defaults builds/posix/make.defaults
+--- builds/posix/make.defaults	2016-07-07 13:56:13.036235166 +0200
++++ builds/posix/make.defaults	2016-07-07 14:29:52.368289242 +0200
+@@ -55,7 +55,11 @@
+ else
+   FIREBIRD=$(FB_BUILD)
+ endif
+-FIREBIRD_LOCK=$(FIREBIRD)
++ifeq (@PLATFORM@,win32)
++  FIREBIRD_LOCK=$(shell cygpath -w $(FIREBIRD) )
++else
++  FIREBIRD_LOCK=$(FIREBIRD)
++endif
+ 
+ export FIREBIRD
+ export FIREBIRD_LOCK
+@@ -152,7 +156,11 @@
+ CD=			cd
+ CAT=			cat
+ AR=			ar @AR_OPTIONS@
+-LN=			@LN_S@
++ifeq (@PLATFORM@,win32)
++  LN=                   cp
++else
++  LN=		        @LN_S@
++endif
+ RANLIB=			@RANLIB@
+ BTYACC=$(ROOT)/extern/btyacc/btyacc
+ CLOOP=$(GEN_ROOT)/$(TARGET)/cloop/release/bin/cloop
+@@ -174,10 +182,10 @@
+ 
+ # Default extensions
+ 
+-ARCH_EXT=		.a
++ARCH_EXT=		.lib
+ EXEC_EXT=		@EXEEXT@
+ SHRLIB_EXT=@SHRLIB_EXT@
+-LIB_PREFIX=		lib
++LIB_PREFIX=
+ SHRLIB_FOREIGN_EXT=	$(SHRLIB_EXT)
+ 
+ #_____________________________________________________________________________
+@@ -203,6 +211,7 @@
+ vpath %.so $(LIB)
+ vpath %.a $(LIB)
+ vpath %.dll $(LIB)
++vpath %.lib $(LIB)
+ 
+ #_____________________________________________________________________________
+ 
+@@ -216,9 +225,9 @@
+ #
+ 
+ #LibraryFileName=libfbclient
+-LibraryFileName=libfbclient
+-LibraryFullName=$(LibraryFileName).${SHRLIB_EXT}.${FirebirdVersion}
+-LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}.2
++LibraryFileName=ifbclient
++LibraryFullName=$(LibraryFileName).${SHRLIB_EXT}
++LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}
+ LibraryBaseName=$(LibraryFileName).${SHRLIB_EXT}
+ 
+ LIBFIREBIRD_FULLNAME = $(LIB)/$(LibraryFullName)
+@@ -227,7 +236,7 @@
+ 
+ # The firebird engine library name
+ 
+-EngineFileName=libEngine${OdsVersion}
++EngineFileName=Engine12
+ EngineSoName=$(EngineFileName).${SHRLIB_EXT}
+ ENGINE_SONAME = $(PLUGINS)/$(EngineSoName)
+ 
+@@ -241,7 +250,7 @@
+   ifeq ($(STD_EDITLINE), true)
+ 	LIBEDITLINE := -l$(READLINE)
+   else
+-	LIBEDITLINE := $(LIB)/libedit.a
++	LIBEDITLINE := $(LIB)/edit.lib
+   endif
+ endif
+ 
+@@ -289,7 +298,7 @@
+ LIB_PATH_OPTS = $(call LIB_LINK_RPATH,lib) $(call LIB_LINK_RPATH,intl)
+ LIB_LINK_SONAME= -Wl,-soname,$(1)
+ LIB_LINK_MAPFILE= -Wl,--version-script,$(1)
+-FIREBIRD_LIBRARY_LINK= -L$(LIB) -lfbclient $(MATHLIB)
++FIREBIRD_LIBRARY_LINK= -L$(LIB) -lifbclient $(MATHLIB)
+ 
+ EXE_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) $(LINK_EMPTY_SYMBOLS)
+ LIB_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) -shared
+@@ -329,7 +338,8 @@
+ 
+ # Pay attention - we place common library into obj, not lib dir
+ # It's just a set of object files, prepared to be used by ld, not an output library
+-COMMON_LIB	= $(OBJ)/common.a
++
++COMMON_LIB      = $(OBJ)/common.lib
+ 
+ # From utilities
+ CREATE_DB	= $(RBIN)/create_db$(EXEC_EXT)
+--- builds/posix/Makefile.in	2016-07-07 15:56:06.459221300 +0200
++++ builds/posix/Makefile.in	2016-07-13 12:44:57.134217200 +0200
+@@ -33,7 +33,8 @@
+ #		Alex Peshkoff - created single makefile based on Mark's files
+ # 
+ 
+-ROOT=$(shell cd ..; pwd)
++#ROOT=$(shell cd ..; pwd)
++ROOT=$(shell cygpath -m '$(shell cd ..; pwd)')
+
+ include     make.defaults
+ ifeq ($(CROSS_OUT), Y)
+@@ -163,7 +164,7 @@
+ .PHONY:	cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest
+ 
+ master_process:
+-	ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
++	cp -f $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
+ 	$(MAKE) updateBuildNum
+ 	$(MAKE) export_lists
+ 	$(MAKE) extern
+@@ -186,10 +187,10 @@
+ 	(cd $(BIN); $(LN) $(notdir $(GPRE)) $(notdir $(GPRE_CURRENT)))
+ ifeq ($(IsDeveloper), Y)
+ # In developer mode we must regenerate various files in include/gen
+-	$(MAKE) codes
++#	$(MAKE) codes
+ endif
+-	$(MAKE) plugins
+-	$(MAKE) examples
++#	$(MAKE) plugins
++	$(MAKE) include_generic
+ 	$(MAKE) rest
+ 
+ 
+@@ -198,7 +199,7 @@
+ 	$(MAKE) CROSS_OUT=Y cross2
+ 
+ cross1:
+-	ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
++	cp -f $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
+ 	$(MAKE) updateBuildNum
+ 	$(MAKE) export_lists
+ 	$(MAKE) extern
+@@ -223,7 +224,7 @@
+ 	$(MAKE) -f Makefile.examples -C $(GEN_ROOT)/examples/
+ 
+ cross2:
+-	ln -sf $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h
++	cp -f $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h
+ 	$(MAKE) prerequisites
+ 	$(MAKE) tommath
+ 	$(MAKE) yvalve
+@@ -275,7 +275,8 @@
+ 
+ # remote redirector is statically linked in main FB library
+ $(LIBFIREBIRD_FULLNAME):	$(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
+-	$(LINK_FIREBIRD) -o $@ $^ $(LINK_FIREBIRD_LIBS)
++	@echo 'compile: $(LINK_FIREBIRD) $(CPPFLAGS) -o $@ $^ $(LINK_FIREBIRD_LIBS)'
++	$(LINK_FIREBIRD) $(CPPFLAGS) -o $@ $^ $(LINK_FIREBIRD_LIBS)
+ 
+ 
+ #___________________________________________________________________________
+@@ -284,7 +286,8 @@
+ engine: $(ENGINE_SONAME)
+ 
+ $(ENGINE_SONAME):	$(Engine_Objects) $(SVC_Objects) $(COMMON_LIB)
+-	$(LINK_ENGINE) -o $@ $^ $(LINK_ENGINE_LIBS)
++	@echo 'compile engine: $(LINK_ENGINE) $(CPPFLAGS) -o $@ $^ $(LINK_ENGINE_LIBS)'
++	$(LINK_ENGINE) $(CPPFLAGS) -o $@ $^ $(YValve_Objects) $(Remote_Client_Objects) $(LINK_ENGINE_LIBS)
+ 
+ 
+ #___________________________________________________________________________
+@@ -294,7 +297,7 @@
+ fbintl: $(LIBFBINTL_SO)
+ 
+ $(LIBFBINTL_SO):	$(INTL_Objects) $(COMMON_LIB)
+-	$(LINK_INTL) -o $@ $^ $(LINK_INTL_LIBS)
++	$(LINK_INTL) $(CPPFLAGS) -o $@ $^ $(YValve_Objects) $(Remote_Client_Objects) $(LINK_INTL_LIBS)
+ 
+ 
+ #___________________________________________________________________________
+@@ -393,7 +396,7 @@
+ 
+ .PHONY:	firebird_server fb_lock_print fbguard fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup
+ 
+-utilities: firebird_server fb_lock_print fbguard fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup udfsupport
++utilities: gbak gfix isql
+ 
+ firebird_server:	$(FB_DAEMON)
+ 
+@@ -540,7 +543,7 @@
+ GBAK_FILES := $(FDB_FILES:.fdb=.gbak) $(FIREBIRD)/msg.gbak
+ GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES))
+ 
+-rest:	qli message_file
++rest:	message_file
+ 
+ cross_rest:	qli gbak_files
+ 	$(MAKE) $(BUILD_FILE)
+@@ -593,7 +595,7 @@
+ IBASE_ExtraFiles = include/types_pub.h include/consts_pub.h dsql/sqlda_pub.h common/dsc_pub.h jrd/ibase.h jrd/inf_pub.h jrd/blr.h include/gen/iberror.h
+ SRC_IBASE_ExtraFiles = $(addprefix $(SRC_ROOT)/, $(IBASE_ExtraFiles))
+ MAKE_HEADER_Src = $(addprefix $(SRC_ROOT)/, misc/makeHeader.cpp)
+-MAKE_HEADER_Bin = ./makeHeader
++MAKE_HEADER_Bin = ./makeHeader.exe
+ 
+ $(INCLUDE_DEST)/ibase.h: $(SRC_IBASE_ExtraFiles)
+ 	$(STATICEXE_LINK) -o $(MAKE_HEADER_Bin) $(MAKE_HEADER_Src)
+diff -ur builds/posix/Makefile.in.examples builds/posix/Makefile.in.examples
+--- builds/posix/Makefile.in.examples	2016-07-07 13:56:13.048235166 +0200
++++ builds/posix/Makefile.in.examples	2016-07-07 14:37:36.904301682 +0200
+@@ -65,10 +65,13 @@
+ EXAMPLES_DEST=	$(GEN_ROOT)/examples
+ EXAMPLES_SRC=	$(ROOT)/examples
+
+-
++ifeq ($(PLATFORM),win32)
++EMPBLD_Objects=	$(EXAMPLES_DEST)/empbuild.obj
++INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.obj
++else
+ EMPBLD_Objects=	$(EXAMPLES_DEST)/empbuild.o
+-
+ INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.o
++endif
+
+ INPUT_Files   =	empddl.sql empdml.sql indexoff.sql indexon.sql \
+ 		job.inp lang.inp proj.inp qtr.inp
+@@ -172,3 +175,5 @@
+ 
+ $(EXAMPLES_DEST)/%.h: $(EXAMPLES_SRC)/common/%.h
+ 	$(CP) $^ $@
++$(EXAMPLES_DEST)/%.obj: $(EXAMPLES_DEST)/%.c
++	$(CC) -c $(firstword $<) -Fo$@ $(WCFLAGS)
+diff -ur builds/posix/make.rules builds/posix/make.rules
+--- builds/posix/make.rules	2016-07-07 13:56:13.036235166 +0200
++++ builds/posix/make.rules	2016-07-07 14:31:16.116291485 +0200
+@@ -88,22 +88,20 @@
+ 
+ $(OBJ)/%.o: $(SRC_ROOT)/%.c
+ 	$(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+-	@sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+ 
+ $(OBJ)/%.o: $(OBJ)/%.cpp
+ 	$(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+-	@sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+ 
+ $(OBJ)/%.o: $(SRC_ROOT)/%.cpp
+ 	$(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+-	@sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+ 
+ .SUFFIXES: .epp .e
+ 
+ # Rules for making resource files
+ 
+ $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
+-	windres --output-format=coff --include-dir=$(<D) $< $@
++	mkdir -p $(@D)
++	rc.exe $(SOLARINC) /fo $@ $<
+ 
+ # Rule for making gbak files when cross-compiling
+ 
+--- src/common/utils.cpp	2016-07-15 11:31:26.746871100 +0200
++++ src/common/utils.cpp	2016-07-19 19:14:45.370689300 +0200
+@@ -880,15 +880,15 @@
+ 	FILETIME utime, stime, dummy;
+ 	if (GetProcessTimes(GetCurrentProcess(), &dummy, &dummy, &stime, &utime))
+ 	{
+-		LARGE_INTEGER lint;
++		LARGE_INTEGER myLargeInt;
+ 
+-		lint.HighPart = stime.dwHighDateTime;
+-		lint.LowPart = stime.dwLowDateTime;
+-		sysTime = lint.QuadPart / 10000;
+-
+-		lint.HighPart = utime.dwHighDateTime;
+-		lint.LowPart = utime.dwLowDateTime;
+-		userTime = lint.QuadPart / 10000;
++		myLargeInt.HighPart = stime.dwHighDateTime;
++		myLargeInt.LowPart = stime.dwLowDateTime;
++		sysTime = myLargeInt.QuadPart / 10000;
++
++		myLargeInt.HighPart = utime.dwHighDateTime;
++		myLargeInt.LowPart = utime.dwLowDateTime;
++		userTime = myLargeInt.QuadPart / 10000;
+ 	}
+ 	else
+ 	{
+diff -ur builds/posix/prefix.mingw builds/posix/prefix.mingw
+--- builds/posix/prefix.mingw	2016-07-07 13:56:13.048235166 +0200
++++ builds/posix/prefix.mingw	2016-07-07 14:50:54.704323046 +0200
+@@ -20,8 +20,8 @@
+ # 
+
+ # -Wno-unused-variable is used due to unused gpre generated variables
+-PROD_FLAGS=-O2  -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads -Wno-non-virtual-dtor
+-DEV_FLAGS=-ggdb -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads -Wno-non-virtual-dtor
++PROD_FLAGS=-O2  -DMINGW  -Dlint -DWIN32_LEAN_AND_MEAN
++DEV_FLAGS=-ggdb  -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN
+
+ PLATFORM_PATH=os/win32
+
+@@ -29,6 +29,7 @@
+ LIB_LINK=$(LD)
+
+ LIB_LINK_OPTIONS+=-Wl,--enable-stdcall-fixup
++LIB_PLATFORM_RPATH=
+
+ # Strip symbols from release versions to decrease size
+ ifeq ($(IsProdTypeBuild),Y)
+@@ -36,6 +37,9 @@
+ LIB_LINK_OPTIONS+=-Wl,-s
+ endif
+
++LIB_LINK_OPTIONS=
++LINK_OPTS=
++
+ # Generation of fbclient_ms.lib
+ LIB_LINK_IMPLIB:=-Wl,--out-implib,firebird/lib/fbclient_ms.lib
+ LIB_GUI:= -mwindows -lcomctl32 -lgdi32
+@@ -55,7 +59,8 @@
+ ClientLibrarySoName := $(ClientLibraryName)
+
+ # Looks like MinGW 3 does not support version scripts but support def-files
+-LINK_FIREBIRD_SYMBOLS = $(BLD_ROOT)/win32/defs/fbclient_s.def $(BLD_ROOT)/win32/defs/fbclient.def
++LINK_FIREBIRD_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/fbclient_s.def /def:$(BLD_ROOT)/win32/defs/firebird.def
++LINK_PLUGIN_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/plugin.def
+
+ # This is required for newly built executable to find newly built shared
+ # libraries because on Win32 there is no such thing as LD_LIBRARY_PATH
+--- builds/posix/make.shared.variables	2016-07-22 17:07:46.650672300 +0200
++++ builds/posix/make.shared.variables	2016-07-23 10:44:41.311454600 +0200
+@@ -56,6 +56,7 @@
+ Remote_Server:= $(call dirObjects,remote/server) $(call dirObjects,auth/SecureRemotePassword/server)
+ Remote_Client:= $(call dirObjects,remote/client) $(call dirObjects,auth/SecureRemotePassword/client) \
+ 				$(call makeObjects,auth/SecurityDatabase,LegacyClient.cpp) \
++				$(call dirObjects,auth/trusted) \
+ 				$(call dirObjects,plugins/crypt/arc4)
+ Remote_Server_Objects:= $(Remote_Common) $(Remote_Server)
+ Remote_Client_Objects:= $(Remote_Common) $(Remote_Client)
+diff -ur configure configure
+--- configure	2016-07-07 13:55:54.976234682 +0200
++++ configure	2016-07-07 14:54:30.012328812 +0200
+@@ -3337,6 +3337,14 @@
+     SHRLIB_EXT=dll
+     ;;
+
++  *-*-cygwin*)
++    MAKEFILE_PREFIX=mingw
++    PLATFORM=win32
++    EDITLINE_FLG=N
++    RAW_DEVICES_FLG=N
++    SHRLIB_EXT=dll
++    ;;
++
+   *)
+     as_fn_error $? "unsupported platform ${build}" "$LINENO" 5
+     ;;
+@@ -8432,6 +8432,9 @@
+ mingw*)
+   opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+   ;;
++cygwin*)
++  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
++  ;;
+ esac
+
+ # Try without a prefix underscore, then with it.
+diff -ur extern/btyacc/main.c extern/btyacc/main.c
+--- extern/btyacc/main.c	2016-07-07 13:55:55.448234695 +0200
++++ extern/btyacc/main.c	2016-07-07 14:56:03.560331317 +0200
+@@ -2,7 +2,7 @@
+ #include <signal.h>
+ #include <stdio.h>
+
+-#if defined(WIN32)
++#if defined(WIN32) || defined(_WIN32)
+ #include <io.h>
+ #else
+ #include <unistd.h>
+diff -ur extern/btyacc/Makefile extern/btyacc/Makefile
+--- extern/btyacc/Makefile	2016-07-07 13:55:55.448234695 +0200
++++ extern/btyacc/Makefile	2016-07-07 14:57:42.284333961 +0200
+@@ -42,7 +42,10 @@
+ all:		$(PROGRAM)
+
+ $(PROGRAM):     $(OBJS) $(LIBS)
+-		$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
++		$(CC) -o $(PROGRAM).exe $(OBJS) $(LIBS) $(LDFLAGS)
++
++%.o: %.c
++		$(CC)  -c $< -Fo$@ $(CCFLAGS)
+
+ clean:;		rm -f $(OBJS)
+
+--- extern/cloop/src/tests/test1/CppTest.cpp	2016-07-07 15:56:27.948015300 +0200
++++ extern/cloop/src/tests/test1/CppTest.cpp	2016-07-13 18:58:48.529822600 +0200
+@@ -24,6 +24,7 @@
+ #include <stdio.h>
+ #include <assert.h>
+ 
++#define WIN32
+ #ifdef WIN32
+ #include <windows.h>
+ #define DLL_EXPORT __declspec(dllexport)
+--- extern/cloop/src/tests/test1/CTest.c	2016-07-07 15:56:27.611791300 +0200
++++ extern/cloop/src/tests/test1/CTest.c	2016-07-13 17:04:22.805090300 +0200
+@@ -23,6 +23,7 @@
+ #include <malloc.h>
+ #include <stdio.h>
+ 
++#define WIN32
+ #ifdef WIN32
+ #include <windows.h>
+ #define DLL_EXPORT __declspec(dllexport)
+--- extern/cloop/Makefile	2016-07-07 15:56:28.279136300 +0200
++++ extern/cloop/Makefile	2016-07-13 16:22:38.493479800 +0200
+@@ -4,15 +4,15 @@
+ 
+ TARGET	:= release
+ 
+-CC	:= gcc
+-CXX	:= g++
+-LD	:= $(CXX)
++#CC	:= gcc
++#CXX	:= g++
++#LD	:= $(CXX)
+ 
+ SRC_DIR		:= src
+ BUILD_DIR	:= build
+ OUT_DIR		:= output
+-SHRLIB_EXT	:= .so
+-EXE_EXT		:=
++SHRLIB_EXT	:= .dll
++EXE_EXT		:= .exe
+ 
+ OBJ_DIR := $(BUILD_DIR)/$(TARGET)
+ BIN_DIR := $(OUT_DIR)/$(TARGET)/bin
+@@ -27,17 +27,17 @@
+ OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
+ OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
+ 
+-C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
++C_FLAGS := -fPIC
+ CXX_FLAGS := $(C_FLAGS)
+ FPC_FLAGS := -Mdelphi
+ 
+-ifeq ($(TARGET),release)
+-	CXX_FLAGS += -O3
+-endif
+-
+-ifeq ($(TARGET),debug)
+-	FPC_FLAGS += -g
+-endif
++#ifeq ($(TARGET),release)
++#	CXX_FLAGS += -O3
++#endif
++
++#ifeq ($(TARGET),debug)
++#	FPC_FLAGS += -g
++#endif
+ 
+ vpath %.c $(SRC_DIRS)
+ vpath %.cpp $(SRC_DIRS)
+@@ -53,7 +53,7 @@
+ .PHONY: all mkdirs clean
+ 
+ all: mkdirs \
+-	$(BIN_DIR)/cloop	\
++	$(BIN_DIR)/cloop$(EXE_EXT)	\
+ 	$(BIN_DIR)/test1-c$(SHRLIB_EXT)	\
+ 	$(BIN_DIR)/test1-c$(EXE_EXT)	\
+ 	$(BIN_DIR)/test1-cpp$(SHRLIB_EXT)	\
+@@ -74,7 +74,7 @@
+ -include $(addsuffix .d,$(basename $(OBJS_C)))
+ -include $(addsuffix .d,$(basename $(OBJS_CPP)))
+ 
+-$(BIN_DIR)/cloop: \
++$(BIN_DIR)/cloop$(EXE_EXT): \
+ 	$(OBJ_DIR)/cloop/Expr.o \
+ 	$(OBJ_DIR)/cloop/Generator.o \
+ 	$(OBJ_DIR)/cloop/Lexer.o \
+@@ -83,20 +83,20 @@
+ 
+ 	$(LD) $^ -o $@
+ 
+-$(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
+-	$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
++$(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl
++	$(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
+ 
+-$(SRC_DIR)/tests/test1/CalcCApi.c: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl $(SRC_DIR)/tests/test1/CalcCApi.h
+-	$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-impl $@ CalcCApi.h CALC_I
++$(SRC_DIR)/tests/test1/CalcCApi.c: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl $(SRC_DIR)/tests/test1/CalcCApi.h
++	$(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c-impl $@ CalcCApi.h CALC_I
+ 
+-$(SRC_DIR)/tests/test1/CalcCppApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
+-	$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c++ $@ CALC_CPP_API_H calc I
++$(SRC_DIR)/tests/test1/CalcCppApi.h: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl
++	$(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c++ $@ CALC_CPP_API_H calc I
+ 
+-$(SRC_DIR)/tests/test1/CalcPascalApi.pas: $(BIN_DIR)/cloop \
++$(SRC_DIR)/tests/test1/CalcPascalApi.pas: $(BIN_DIR)/cloop$(EXE_EXT) \
+ 	$(SRC_DIR)/tests/test1/Interface.idl \
+ 	$(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
+ 	$(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas
+-	$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl pascal $@ CalcPascalApi \
++	$(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl pascal $@ CalcPascalApi \
+ 		--uses "SysUtils" \
+ 		--interfaceFile $(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
+ 		--implementationFile $(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas \
+@@ -108,23 +108,23 @@
+ 	$(OBJ_DIR)/tests/test1/CalcCApi.o \
+ 	$(OBJ_DIR)/tests/test1/CTest.o \
+ 
+-	$(LD) $^ -shared -ldl -o $@
++	$(LD) $^ -o $@
+ 
+ $(BIN_DIR)/test1-c$(EXE_EXT): \
+ 	$(OBJ_DIR)/tests/test1/CalcCApi.o \
+ 	$(OBJ_DIR)/tests/test1/CTest.o \
+ 
+-	$(LD) $^ -ldl -o $@
++	$(LD) $^ -o $@
+ 
+ $(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \
+ 	$(OBJ_DIR)/tests/test1/CppTest.o \
+ 
+-	$(LD) $^ -shared -ldl -o $@
++	$(LD) $^ -o $@
+ 
+ $(BIN_DIR)/test1-cpp$(EXE_EXT): \
+ 	$(OBJ_DIR)/tests/test1/CppTest.o \
+ 
+-	$(LD) $^ -ldl -o $@
++	$(LD) $^ -o $@
+ 
+ $(BIN_DIR)/test1-pascal$(SHRLIB_EXT): \
+ 	$(SRC_DIR)/tests/test1/PascalClasses.pas \
+diff -ur src/common/classes/fb_string.cpp src/common/classes/fb_string.cpp
+--- src/common/classes/fb_string.cpp	2016-07-07 13:55:56.064234711 +0200
++++ src/common/classes/fb_string.cpp	2016-07-07 14:59:01.516336083 +0200
+@@ -32,6 +32,12 @@
+ #include <ctype.h>
+ #include <stdarg.h>
+ 
++#ifdef WIN_NT
++#pragma comment(lib, "User32.lib")
++#pragma comment(lib, "advapi32")
++#pragma comment(lib, "shell32.lib")
++#endif
++
+ #ifdef HAVE_STRCASECMP
+ #define STRNCASECMP strncasecmp
+ #else
+diff -ur src/misc/makeHeader.cpp src/misc/makeHeader.cpp
+--- src/misc/makeHeader.cpp	2016-07-07 13:56:00.100234819 +0200
++++ src/misc/makeHeader.cpp	2016-07-07 15:00:14.780338045 +0200
+@@ -1,9 +1,9 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+-//#ifdef HAVE_UNISTD_H
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+-//#endif
++#endif
+
+
+
diff --git a/external/firebird/firebird-cygwin-msvc.patch.1 b/external/firebird/firebird-cygwin-msvc.patch.1
deleted file mode 100644
index 565e178..0000000
--- a/external/firebird/firebird-cygwin-msvc.patch.1
+++ /dev/null
@@ -1,484 +0,0 @@
-diff -ur firebird.org/builds/make.new/config/config.h.in firebird/builds/make.new/config/config.h.in
---- firebird.org/builds/make.new/config/config.h.in	2015-07-30 18:57:00.826593100 +0200
-+++ firebird/builds/make.new/config/config.h.in	2015-07-30 19:27:52.139226300 +0200
-@@ -668,3 +668,37 @@
- #ifndef HAVE_SOCKLEN_T
- typedef int socklen_t;
- #endif
-+
-+/* taken from src/include/gen/autoconfig_msvc.h */
-+#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
-+/* target architecture */
-+#if defined(_M_IX86)
-+/* sizeof(void *) */
-+#define SIZEOF_VOID_P 4
-+/* sizeof(size_t) */
-+#define SIZEOF_SIZE_T 4
-+/* alignment of long */
-+#define FB_ALIGNMENT 4
-+#elif defined(_M_AMD64)
-+#define AMD64
-+/* sizeof(void *) */
-+#define SIZEOF_VOID_P 8
-+/* sizeof(size_t) */
-+#define SIZEOF_SIZE_T 8
-+/* alignment of long */
-+#define FB_ALIGNMENT 8
-+#else
-+#error unknown target platform
-+#endif
-+
-+#define HAVE_IO_H
-+
-+#define HAVE_GETPAGESIZE
-+
-+#if defined _MSC_VER
-+#if _MSC_VER < 1500
-+#define vsnprintf _vsnprintf
-+#endif
-+#define isnan _isnan
-+#endif
-+#define snprintf _snprintf
-diff -ur firebird.org/builds/posix/make.defaults firebird/builds/posix/make.defaults
---- firebird.org/builds/posix/make.defaults	2015-07-30 18:56:58.936120900 +0200
-+++ firebird/builds/posix/make.defaults	2015-07-30 19:29:23.420338600 +0200
-@@ -49,7 +49,11 @@
- 
- FIREBIRD=$(GEN_ROOT)/firebird
- INTERBASE=$(FIREBIRD)
-+ifeq (@PLATFORM@,win32)
-+FIREBIRD_LOCK=$(shell cygpath -w $(shell cd $(FIREBIRD); pwd) )
-+else
- FIREBIRD_LOCK=$(shell cd $(FIREBIRD); pwd)
-+endif
- 
- export INTERBASE
- export FIREBIRD
-@@ -135,7 +139,11 @@
- CD=			cd
- CAT=			cat
- AR=			ar @AR_OPTIONS@ crsu
-+ifeq (@PLATFORM@,win32)
-+LN=			cp
-+else
- LN=			@LN_S@
-+endif
- RANLIB=			@RANLIB@
- BTYACC=$(ROOT)/extern/btyacc/btyacc
- 
-@@ -152,16 +160,32 @@
- STATICEXE_LINK:= @CXX@ $(GLOB_OPTIONS) $(CXXFLAGS)
- 
- LINK_LIBS = @LIBS@
-+ifeq ($(PLATFORM),win32)
-+ifeq ($(MSVC_USE_DEBUG_RUNTIME),TRUE)
-+ICU_LIBS = -licuucd -licudtd -licuind
-+else
-+ICU_LIBS = -licuuc -licudt -licuin
-+endif
-+else
- ICU_LIBS = -licuuc -licudata -licui18n
-+endif
- STATICLINK_LIBS = @LIBS@
- SO_LINK_LIBS = @LIBS@
- 
- # Default extensions
- 
-+ifeq (@PLATFORM@,win32)
-+ARCH_EXT=		.lib
-+else
- ARCH_EXT=		.a
-+endif
- EXEC_EXT=		@EXEEXT@
- SHRLIB_EXT=@SHRLIB_EXT@
-+ifeq (@PLATFORM@,win32)
-+LIB_PREFIX=		
-+else
- LIB_PREFIX=		lib
-+endif
- SHRLIB_FOREIGN_EXT=	$(SHRLIB_EXT)
- 
- #_____________________________________________________________________________
-@@ -179,6 +203,7 @@
- vpath %.so $(LIB)
- vpath %.a $(LIB)
- vpath %.dll $(LIB)
-+vpath %.lib $(LIB)
- 
- #_____________________________________________________________________________
- 
-@@ -193,9 +218,9 @@
- #     Scold me, but I don't want library names to be in configure.in
- # 
- 
--SharedLibraryName=libfbembed.${SHRLIB_EXT}.${FirebirdVersion}
--SharedLibrarySoName=libfbembed.${SHRLIB_EXT}.${MajorVer}.${MinorVer}
--SharedLibraryBaseName=libfbembed.${SHRLIB_EXT}
-+SharedLibraryName=ifbembed.${SHRLIB_EXT}
-+SharedLibrarySoName=ifbembed.${SHRLIB_EXT}
-+SharedLibraryBaseName=ifbembed.${SHRLIB_EXT}
- 
- LIBFBEMBED_SO = $(LIB)/$(SharedLibraryName)
- LIBFBEMBED_SOBASENAME = $(LIB)/$(SharedLibrarySoName)
-@@ -219,7 +244,11 @@
- 
- LIBFBINTL_SO = $(FIREBIRD)/intl/$(LIB_PREFIX)fbintl.$(SHRLIB_EXT)
- 
-+ifeq ($(PLATFORM),win32)
-+LIBFBSTATIC_A = $(LIB)/fbstatic.lib
-+else
- LIBFBSTATIC_A = $(LIB)/libfbstatic.a
-+endif
- 
- ifeq ($(EDITLINE_FLG),Y)
-   ifeq ($(STD_EDITLINE), true)
-diff -ur firebird.org/builds/posix/make.rules firebird/builds/posix/make.rules
---- firebird.org/builds/posix/make.rules	2015-07-30 18:56:58.404726100 +0200
-+++ firebird/builds/posix/make.rules	2015-07-30 19:29:24.404796300 +0200
-@@ -116,4 +116,4 @@
- # Rules for making resource files
- 
- $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
--	windres --output-format=coff --include-dir=$(<D) $< $@
-+	rc.exe $(SOLARINC) /fo $@ $<
-diff -ur firebird.org/builds/posix/Makefile.in.examples firebird/builds/posix/Makefile.in.examples
---- firebird.org/builds/posix/Makefile.in.examples	2015-07-30 18:56:58.982902900 +0200
-+++ firebird/builds/posix/Makefile.in.examples	2015-07-30 19:29:23.436010500 +0200
-@@ -64,10 +64,13 @@
- EXAMPLES_DEST=	$(GEN_ROOT)/examples
- EXAMPLES_SRC=	$(ROOT)/examples
- 
--
-+ifeq ($(PLATFORM),win32)
-+EMPBLD_Objects=	$(EXAMPLES_DEST)/empbuild.obj
-+INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.obj
-+else
- EMPBLD_Objects=	$(EXAMPLES_DEST)/empbuild.o
--
- INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.o
-+endif
- 
- INPUT_Files   =	empddl.sql empdml.sql indexoff.sql indexon.sql \
- 		job.inp lang.inp proj.inp qtr.inp
-@@ -166,3 +169,6 @@
- 
- $(EXAMPLES_DEST)/%.h: $(EXAMPLES_SRC)/common/%.h
- 	$(CP) $^ $@
-+
-+$(EXAMPLES_DEST)/%.obj: $(EXAMPLES_DEST)/%.c 
-+	$(CC) -c $(firstword $<) -Fo$@ $(WCFLAGS)
-\ No newline at end of file
-diff -ur firebird.org/builds/posix/Makefile.in.extlib firebird/builds/posix/Makefile.in.extlib
---- firebird.org/builds/posix/Makefile.in.extlib	2015-07-30 18:56:58.936120900 +0200
-+++ firebird/builds/posix/Makefile.in.extlib	2015-07-30 19:29:23.483041600 +0200
-@@ -76,14 +76,20 @@
- lib_ib_udf: $(LIBIBUTIL_SO) $(UDF)/ib_udf.$(SHRLIB_EXT)
- 
- $(UDF)/ib_udf.$(SHRLIB_EXT): $(UDF_Objects)
--	$(call LINK_UDF,ib_udf) -o $@ $^ $(LINK_UDF_LIBS)
-+	@CXX@ $^ -o $@ -LD -L$(LIB) $(GLOB_OPTIONS) $(CXXFLAGS) -lib_util \
-+	$(LINK_UDF_LIBS) $(LIB_LINK_OPTIONS) $(call LIB_LINK_SONAME,ib_udf.$(SHRLIB_EXT))\
-+	$(call LIB_LINK_RPATH,lib) \
-+	/link /dll
- 
- # ib_util
- 
- lib_ib_util: $(LIBIBUTIL_SO)
- 
- $(LIBIBUTIL_SO): $(UTIL_Objects)
--	$(LINK_IB_UTIL) -o $@ $^ $(LINK_IB_UTIL_LIBS)
-+	@CXX@ $^ -o $@ -LD \
-+	$(call LIB_LINK_RPATH,lib)  $(GLOB_OPTIONS) $(CXXFLAGS) $(LINK_IBUTIL_SYMBOLS) \
-+	$(LIB_LINK_OPTIONS) $(LINK_IB_UTIL_LIBS) $(call LIB_LINK_SONAME,$(IbUtilLibraryName)) \
-+	/link /dll
- 
- include $(ROOT)/gen/make.shared.targets
- 
-diff -ur firebird.org/builds/posix/Makefile.in.firebird firebird/builds/posix/Makefile.in.firebird
---- firebird.org/builds/posix/Makefile.in.firebird	2015-07-30 18:56:58.357870500 +0200
-+++ firebird/builds/posix/Makefile.in.firebird	2015-07-30 19:29:23.514113100 +0200
-@@ -145,7 +145,8 @@
- 
- firebird : firebird_ at FIREBIRD_ARCH_TYPE@ $(PLATFORM_POSTBUILD_TARGET)
- 
--firebird_classic firebird_embedded: firebird_basic classic_targets fbtrace
-+firebird_classic firebird_embedded: firebird_basic classic_targets
-+#fbtrace
- firebird_super firebird_server: firebird_basic super_targets fbtrace
- 
- 
-@@ -300,7 +301,7 @@
- .PHONY: ref_databases msgs msgs_intl generated_headers intl extlib includes
- 
- basic_targets: ref_databases msgs msgs_intl generated_headers \
--               intl extlib includes examples_cp
-+               intl extlib includes
- 
- # hack to make code regeneration work
- generated_headers :
-@@ -331,8 +332,9 @@
- .PHONY: libfbembed inet_server fb_smp_server embed_gfix embed_gbak embed_isql 
- .PHONY: embed_gpre embed_util
- 
--classic_targets: $(PLAT_CLASSIC_PRE_TARGET) libfbembed inet_server fb_smp_server embed_gfix embed_gbak embed_isql \
--	embed_gpre libfbclient embed_util embed_gdef embed_qli embed_fbudf $(PLAT_CLASSIC_POST_TARGET)
-+classic_targets: $(PLAT_CLASSIC_PRE_TARGET) libfbembed
-+#inet_server fb_smp_server embed_gfix embed_gbak embed_isql \
-+#	embed_gpre libfbclient embed_util embed_gdef embed_qli embed_fbudf $(PLAT_CLASSIC_POST_TARGET)
- 
- libfbembed:
- 	$(MAKE) $(CPU_OPTION) -f $(GEN_ROOT)/Makefile.libfbembed $@
-@@ -446,7 +448,7 @@
- MAKE_HEADER_Bin = ./makeHeader
- 
- $(INCLUDE_DEST)/ibase.h: $(SRC_IBASE_ExtraFiles)
--	$(STATICEXE_LINK) -o $(MAKE_HEADER_Bin) $(MAKE_HEADER_Src)
-+	$(STATICEXE_LINK) -o $(MAKE_HEADER_Bin)$(EXEC_EXT) $(MAKE_HEADER_Src)
- 	$(CP) $^ .
- 	$(MAKE_HEADER_Bin) <ibase.h >$@
- 	$(RM) -f ibase.h
-diff -ur firebird.org/builds/posix/Makefile.in.intl firebird/builds/posix/Makefile.in.intl
---- firebird.org/builds/posix/Makefile.in.intl	2015-07-30 18:56:58.936120900 +0200
-+++ firebird/builds/posix/Makefile.in.intl	2015-07-30 19:29:23.576732800 +0200
-@@ -81,8 +81,13 @@
- libfbintl : $(LIBFBINTL_SO)
- 
- $(LIBFBINTL_SO):	$(INTL_Objects) $(FBCOMMON_ClientObjects) $(FBCLASSES_ClientObjects)
-+ifeq (@PLATFORM@,win32)
-+	@CXX@ $^ -o $@  -LD $(GLOB_OPTIONS) $(CXXFLAGS) $(LINK_INTL_LIBS)\
-+	$(LINK_FBINTL_SYMBOLS) $(LIB_LINK_OPTIONS) -lfbstatic $(call LIB_LINK_SONAME,libintl.$(SHRLIB_EXT).1)\
-+	$(call LIB_LINK_RPATH,lib) /link /dll
-+else
- 	$(LINK_INTL) -o $@ $^ $(LINK_INTL_LIBS)
--
-+endif
- 
- include $(ROOT)/gen/make.shared.targets
- 
-diff -ur firebird.org/builds/posix/Makefile.in.libfbembed firebird/builds/posix/Makefile.in.libfbembed
---- firebird.org/builds/posix/Makefile.in.libfbembed	2015-07-30 18:56:58.826768300 +0200
-+++ firebird/builds/posix/Makefile.in.libfbembed	2015-07-30 19:29:23.670532500 +0200
-@@ -62,13 +62,19 @@
- libfbembed : $(LIBIBUTIL_SO) $(LIBFBEMBED_SONAME)
- 
- $(LIBFBEMBED_SO): $(LIBFBEMBED_Objects) $(SERVER_Objects) $(COMMON_Objects)
-+ifeq ($(PLATFORM),win32)
-+	@CXX@ $^ -o $@ $(LINK_EMBED_LIBS)  $(GLOB_OPTIONS) $(CXXFLAGS)\
-+	$(LINK_FIREBIRD_EMBED_SYMBOLS) $(LIB_LINK_OPTIONS) $(LIB_EMBED_LINK_OPTIONS)\
-+	$(call LIB_LINK_SONAME,$(SharedLibrarySoName)) $(call LIB_LINK_RPATH,lib)
-+else
- 	$(LINK_EMBED) -o $@ $^ $(LINK_EMBED_LIBS)
-+endif
- 
- $(LIBFBEMBED_SOBASENAME): $(LIBFBEMBED_SO)
--	(cd $(LIB) && $(LN) -f $(SharedLibraryName) $(SharedLibrarySoName) )
-+#	(cd $(LIB) && $(LN) -f $(SharedLibraryName) $(SharedLibrarySoName) )
- 
- $(LIBFBEMBED_SONAME): $(LIBFBEMBED_SOBASENAME)
--	(cd $(LIB) && $(LN) -f $(SharedLibrarySoName) $(SharedLibraryBaseName) )
-+#	(cd $(LIB) && $(LN) -f $(SharedLibrarySoName) $(SharedLibraryBaseName) )
- 
- include $(ROOT)/gen/make.shared.targets
- 
-diff -ur firebird.org/builds/posix/Makefile.in.libfbstatic firebird/builds/posix/Makefile.in.libfbstatic
---- firebird.org/builds/posix/Makefile.in.libfbstatic	2015-07-30 18:56:58.826768300 +0200
-+++ firebird/builds/posix/Makefile.in.libfbstatic	2015-07-30 19:29:23.717391000 +0200
-@@ -57,9 +57,9 @@
- # will not be different from the above fbmem_boot.a library
- # compile time macros being the main (if there) difference
- 
--libfbstatic: $(PARSE_Sources) $(LIB)/libfbstatic.a
-+libfbstatic: $(PARSE_Sources) $(LIB)/$(LIB_PREFIX)fbstatic$(ARCH_EXT)
- 
--$(LIB)/libfbstatic.a:	$(LIBFBSTATIC_Objects)
-+$(LIB)/$(LIB_PREFIX)fbstatic$(ARCH_EXT):	$(LIBFBSTATIC_Objects)
- 	-$(RM) $@
- 	$(AR) $@ $^
- 	-$(RANLIB) $@
-diff -ur firebird.org/builds/posix/prefix.mingw firebird/builds/posix/prefix.mingw
---- firebird.org/builds/posix/prefix.mingw	2015-07-30 18:56:59.029762200 +0200
-+++ firebird/builds/posix/prefix.mingw	2015-07-30 19:29:23.779759400 +0200
-@@ -20,8 +20,8 @@
- # 
- 
- # -Wno-unused-variable is used due to unused gpre generated variables
--PROD_FLAGS=-O2  -march=i586 -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads
--DEV_FLAGS=-ggdb -march=i586 -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads
-+PROD_FLAGS=-O2  -march=i586 -DMINGW -Wall -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads
-+DEV_FLAGS=-ggdb -march=i586 -DMINGW -Wall -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads
- 
- PLATFORM_PATH=os/win32
- 
-@@ -33,13 +33,15 @@
- LIB_LINK=$(LD)
- 
- LIB_LINK_OPTIONS+=-Wl,--enable-stdcall-fixup
-+LIB_PLATFORM_RPATH=
- 
- # Strip symbols from release versions to decrease size
- ifeq ($(IsProdTypeBuild),Y)
- LINK_OPTS+=-Wl,-s
- LIB_LINK_OPTIONS+=-Wl,-s
- endif
--
-+LIB_LINK_OPTIONS=
-+LINK_OPTS=
- # Generation of fbclient_ms.lib
- LIB_LINK_IMPLIB:=-Wl,--out-implib,firebird/lib/fbclient_ms.lib
- LIB_GUI:= -mwindows -lcomctl32 -lgdi32
-@@ -65,7 +67,7 @@
- ClientLibrarySoName := $(ClientLibraryName)
- 
- # Looks like MinGW 3 does not support version scripts but support def-files
--LINK_FIREBIRD_SYMBOLS = $(BLD_ROOT)/win32/defs/fbclient_s.def $(BLD_ROOT)/win32/defs/fbclient.def
-+LINK_FIREBIRD_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/fbclient_s.def /def:$(BLD_ROOT)/win32/defs/fbclient.def
- 
- # This is required for newly built executable to find newly built shared
- # libraries because on Win32 there is no such thing as LD_LIBRARY_PATH
-diff -ur firebird.org/configure firebird/configure
---- firebird.org/configure	2015-07-30 18:57:33.826760500 +0200
-+++ firebird/configure	2015-07-30 19:29:23.873496600 +0200
-@@ -9016,6 +9016,9 @@
- mingw*)
-   opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-   ;;
-+cygwin*)
-+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-+  ;;
- esac
- 
- # If we're using GNU nm, then use its standard symbol codes.
-@@ -9964,7 +9967,7 @@
-        esac
-        ;;
- 
--    mingw* | pw32* | os2*)
-+    mingw* | cygwin* | pw32* | os2*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic='-DDLL_EXPORT'
-@@ -14757,7 +14760,7 @@
-     beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-       # PIC is the default for these OSes.
-       ;;
--    mingw* | os2* | pw32*)
-+    mingw* | cygwin* | os2* | pw32*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
-@@ -16534,7 +16537,7 @@
-       # PIC is the default for these OSes.
-       ;;
- 
--    mingw* | pw32* | os2*)
-+    mingw* | cygwin* | pw32* | os2*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-@@ -16604,7 +16607,7 @@
-        esac
-        ;;
- 
--    mingw* | pw32* | os2*)
-+    mingw* | cygwin* | pw32* | os2*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-@@ -19149,7 +19152,7 @@
-       # PIC is the default for these OSes.
-       ;;
- 
--    mingw* | pw32* | os2*)
-+    mingw* | cygwin* | pw32* | os2*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
-@@ -19219,7 +19222,7 @@
-        esac
-        ;;
- 
--    mingw* | pw32* | os2*)
-+    mingw* | cygwin* | pw32* | os2*)
-       # This hack is so that the source file can tell whether it is being
-       # built for inclusion in a dll (and should export symbols for example).
-       lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
-diff -ur firebird.org/extern/btyacc/main.c firebird/extern/btyacc/main.c
---- firebird.org/extern/btyacc/main.c	2015-07-30 18:57:01.029880800 +0200
-+++ firebird/extern/btyacc/main.c	2015-07-30 19:29:23.920389000 +0200
-@@ -2,7 +2,7 @@
- #include <signal.h>
- #include <stdio.h>
- 
--#if defined(WIN32)
-+#if defined(WIN32) || defined(_WIN32)
- #include <io.h>
- #else
- #include <unistd.h>
-diff -ur firebird.org/extern/btyacc/Makefile firebird/extern/btyacc/Makefile
---- firebird.org/extern/btyacc/Makefile	2015-07-30 18:57:01.201632400 +0200
-+++ firebird/extern/btyacc/Makefile	2015-07-30 19:29:24.326742400 +0200
-@@ -42,7 +42,10 @@
- all:		$(PROGRAM)
- 
- $(PROGRAM):     $(OBJS) $(LIBS)
--		$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
-+		$(CC) -o $(PROGRAM).exe $(OBJS) $(LIBS) $(LDFLAGS)
-+
-+%.o: %.c
-+	$(CC)  -c $< -Fo$@ $(CCFLAGS)
- 
- clean:;		rm -f $(OBJS)
- 
-diff -ur firebird.org/src/common/classes/fb_string.cpp firebird/src/common/classes/fb_string.cpp
---- firebird.org/src/common/classes/fb_string.cpp	2015-07-30 18:57:31.357886800 +0200
-+++ firebird/src/common/classes/fb_string.cpp	2015-07-30 19:29:24.045626200 +0200
-@@ -32,6 +32,10 @@
- #include <ctype.h>
- #include <stdarg.h>
- 
-+#ifdef WIN_NT
-+#pragma comment(lib, "User32.lib")
-+#endif
-+
- #ifdef HAVE_STRCASECMP
- #define STRNCASECMP strncasecmp
- #else
-diff -ur firebird.org/src/jrd/gds.cpp firebird/src/jrd/gds.cpp
---- firebird.org/src/jrd/gds.cpp	2015-07-30 18:57:25.045586000 +0200
-+++ firebird/src/jrd/gds.cpp	2015-07-30 19:29:24.092207700 +0200
-@@ -71,6 +71,8 @@
- #include <stdarg.h>
- 
- #if defined(WIN_NT)
-+#pragma comment(lib, "advapi32")
-+#pragma comment(lib, "Shell32")
- #include <io.h> // umask, close, lseek, read, open, _sopen
- #include <process.h>
- #include <sys/types.h>
-diff -ur firebird.org/src/jrd/isc.cpp firebird/src/jrd/isc.cpp
---- firebird.org/src/jrd/isc.cpp	2015-07-30 18:57:24.186115300 +0200
-+++ firebird/src/jrd/isc.cpp	2015-07-30 19:29:24.123769900 +0200
-@@ -60,7 +60,7 @@
- /* Win32 specific stuff */
- 
- #ifdef WIN_NT
--
-+#pragma comment(lib, "User32")
- #include <windows.h>
- #include <aclapi.h>
- #include <lmcons.h>
-diff -ur firebird.org/src/misc/makeHeader.cpp firebird/src/misc/makeHeader.cpp
---- firebird.org/src/misc/makeHeader.cpp	2015-07-30 18:57:26.498503700 +0200
-+++ firebird/src/misc/makeHeader.cpp	2015-07-30 19:29:24.279812900 +0200
-@@ -1,9 +1,9 @@
- #include <stdio.h>
- #include <string.h>
- #include <errno.h>
--//#ifdef HAVE_UNISTD_H
-+#ifdef HAVE_UNISTD_H
- #include <unistd.h>
--//#endif
-+#endif
- 
- 
- 
diff --git a/external/firebird/firebird-macosx.patch.1 b/external/firebird/firebird-macosx.patch.1
index b947373..75f86e2 100644
--- a/external/firebird/firebird-macosx.patch.1
+++ b/external/firebird/firebird-macosx.patch.1
@@ -1,35 +1,46 @@
-# -*- Mode: Diff -*-
---- firebird.org/builds/posix/darwin.defaults
-+++ firebird/builds/posix/darwin.defaults
-@@ -32,17 +32,17 @@
- LINK_EMPTY_SYMBOLS=$(LIB_LINK_MAPFILE)$(ROOT)/builds/posix/empty.darwin.vers
- LINK_FIREBIRD_SYMBOLS=$(LIB_LINK_MAPFILE)$(ROOT)/builds/posix/firebird.darwin.vers
- 
--LIB_LINK_RPATH:=-install_name /Library/Frameworks/Firebird.framework/Versions/A/Libraries/
--LIB_EMBED_LINK_OPTIONS:=-install_name /Library/Frameworks/Firebird.framework/Versions/A/Firebird
--LIB_CLIENT_LINK_OPTIONS:=-install_name /Library/Frameworks/Firebird.framework/Versions/A/Firebird
--FBEMBED_LINK:=-F../gen/firebird -framework Firebird -L$(LIB) -lfbembed $(ICU_LIBS)
-+LIB_LINK_RPATH:=
-+LIB_EMBED_LINK_OPTIONS:=-install_name @__________________________________________________OOO/libfbembed.dylib
-+LIB_CLIENT_LINK_OPTIONS:=
-+FBEMBED_LINK:=-L$(LIB) -lfbembed $(ICU_LIBS)
- PLATFORM_FALLBACK=os/posix
- 
--PLAT_CLASSIC_PRE_TARGET=darwin_setup_framework
--PLAT_CLASSIC_POST_TARGET=darwin_finish_cs_framework
-+PLAT_CLASSIC_PRE_TARGET=
-+PLAT_CLASSIC_POST_TARGET=
- 
--PLAT_SUPER_PRE_TARGET=darwin_setup_framework
--PLAT_SUPER_POST_TARGET=darwin_finish_ss_framework
-+PLAT_SUPER_PRE_TARGET=
-+PLAT_SUPER_POST_TRAGET=
- 
- PLATFORM_POSTBUILD_TARGET=darwin_postbuild_target
- 
-diff -ur firebird.org/builds/posix/postfix.darwin firebird/builds/posix/postfix.darwin
---- firebird.org/builds/posix/postfix.darwin	2013-07-12 20:55:46.000000000 +0200
-+++ firebird/builds/posix/postfix.darwin	2013-07-15 12:07:36.000000000 +0200
+--- firebird.org/extern/cloop/src/tests/test1/CTest.c	2016-08-01 22:55:35.000000000 +0200
++++ firebird/extern/cloop/src/tests/test1/CTest.c	2016-08-02 21:11:31.000000000 +0200
+@@ -20,7 +20,7 @@
+  */
+ 
+ #include "CalcCApi.h"
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <stdio.h>
+ 
+ #ifdef WIN32
+--- firebird.org/builds/posix/prefix.darwin_x86_64	2016-08-01 20:02:48.000000000 +0200
++++ firebird/builds/posix/prefix.darwin_x86_64	2016-08-01 21:42:45.000000000 +0200
+@@ -19,7 +19,7 @@
+ #
+ # Default build from 10.7 using Clang
+ 
+-DYLD_LIBRARY_PATH=$(HOME)/icu54/icu/source/lib
++DYLD_LIBRARY_PATH:=$(HOME)/icu54/icu/source/lib:$(DYLD_LIBRARY_PATH)
+ export DYLD_LIBRARY_PATH
+ 
+ #DYLD_PRINT_ENV=1
+@@ -31,15 +31,15 @@
+ MACOSX_DEPLOYMENT_TARGET=10.7
+ export MACOSX_DEPLOYMENT_TARGET
+ 
+-PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common -mmacosx-version-min=10.7
+-DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-omit-frame-pointer -fno-common -Wall -fno-optimize-sibling-calls -mmacosx-version-min=10.7 -Wno-non-virtual-dtor
++PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common
++DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-omit-frame-pointer -fno-common -Wall -fno-optimize-sibling-calls -Wno-non-virtual-dtor
+ CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden 
+ 
+ EXE_LINK_OPTIONS:= 
+ UNDEF_PLATFORM=
+ 
+ LINK_LIBS+=-liconv
+-MATHLIB=/opt/local/lib/libtommath.a
++MATHLIB=-ltommath
+ SO_LINK_LIBS+=-liconv
+ 
+ include $(ROOT)/gen/darwin.defaults
+--- firebird.org/builds/posix/postfix.darwin	2016-08-01 20:02:48.000000000 +0200
++++ firebird/builds/posix/postfix.darwin	2016-08-01 22:17:49.000000000 +0200
 @@ -54,9 +54,9 @@
  	cp -r ../gen/firebird/include $(FB_FW)/Versions/A/Headers
  	cp ../gen/firebird/lib/libfbembed.dylib $(FB_FW)/Versions/A/Firebird
@@ -37,9 +48,9 @@ diff -ur firebird.org/builds/posix/postfix.darwin firebird/builds/posix/postfix.
 -	cp ../gen/firebird/lib/libicudata.dylib $(FB_FW)/Versions/A/Libraries/libicudata.dylib
 -	cp ../gen/firebird/lib/libicui18n.dylib $(FB_FW)/Versions/A/Libraries/libicui18n.dylib
 -	cp ../gen/firebird/lib/libicuuc.dylib $(FB_FW)/Versions/A/Libraries/libicuuc.dylib
-+	#cp ../gen/firebird/lib/libicudata.dylib $(FB_FW)/Versions/A/Libraries/libicudata.dylib
-+	#cp ../gen/firebird/lib/libicui18n.dylib $(FB_FW)/Versions/A/Libraries/libicui18n.dylib
-+	#cp ../gen/firebird/lib/libicuuc.dylib $(FB_FW)/Versions/A/Libraries/libicuuc.dylib
++#	cp ../gen/firebird/lib/libicudata.dylib $(FB_FW)/Versions/A/Libraries/libicudata.dylib
++#	cp ../gen/firebird/lib/libicui18n.dylib $(FB_FW)/Versions/A/Libraries/libicui18n.dylib
++#	cp ../gen/firebird/lib/libicuuc.dylib $(FB_FW)/Versions/A/Libraries/libicuuc.dylib
  	cp ../gen/firebird/lib/libib_util.dylib $(FB_FW)/Versions/A/Libraries/libib_util.dylib
  	cp ../gen/firebird/firebird.msg \
  			$(FB_FW)/Resources/English.lproj/var/firebird.msg
@@ -54,48 +65,84 @@ diff -ur firebird.org/builds/posix/postfix.darwin firebird/builds/posix/postfix.
  	cp -r ../gen/firebird/help $(FB_FW)/Resources/English.lproj/var/help
  	cp ../gen/firebird/security2.fdb $(FB_FW)/Resources/English.lproj/var
  	mkdir -p $(FB_FW)/Resources/doc
---- firebird.org/builds/posix/prefix.darwin_i386
-+++ firebird/builds/posix/prefix.darwin_i386
-@@ -24,7 +24,7 @@
+--- firebird.org/builds/posix/prefix.darwin_i386	2016-08-01 22:55:34.000000000 +0200
++++ firebird/builds/posix/prefix.darwin_i386	2016-08-01 23:02:46.000000000 +0200
+@@ -26,14 +26,14 @@
  # 4. for  CFLAGS, CXXFLAGS, LDFLAGS export '-m32 -arch i386'
- # 5. export MACOSX_DEPLOYMENT_TARGET=10.7
+ # 5. export MACOSX_DEPLOYMENT_TARGET=10.7 
  
 -DYLD_LIBRARY_PATH=$(FIREBIRD)/lib
 +DYLD_LIBRARY_PATH:=$(FIREBIRD)/lib:$(DYLD_LIBRARY_PATH)
  export DYLD_LIBRARY_PATH
  
  MACOSX_DEPLOYMENT_TARGET=10.7
-@@ -34,8 +34,8 @@
- 
- OS_ServerFiles=inet_server.cpp
- 
--PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common -arch i386 -mmacosx-version-min=10.7
--DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -arch i386 -mmacosx-version-min=10.7
-+PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common -arch i386
-+DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -arch i386
- CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden
- EMBED_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr
- CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr fbtracemgr
---- firebird.org/builds/posix/prefix.darwin_x86_64
-+++ firebird/builds/posix/prefix.darwin_x86_64
-@@ -19,7 +19,7 @@
- #
- # Default build from 10.7 using Clang
+ export MACOSX_DEPLOYMENT_TARGET
  
--DYLD_LIBRARY_PATH=$(FIREBIRD)/lib
-+DYLD_LIBRARY_PATH:=$(FIREBIRD)/lib:$(DYLD_LIBRARY_PATH)
- export DYLD_LIBRARY_PATH
+-PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common -arch i386 -mmacosx-version-min=10.7
+-DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-common -Wall -arch i386 -mmacosx-version-min=10.7 -Wno-non-virtual-dtor
++PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common -arch i386
++DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-common -Wall -arch i386 -Wno-non-virtual-dtor
+ CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -fno-weak
  
- MACOSX_DEPLOYMENT_TARGET=10.7
-@@ -27,8 +27,8 @@
+ EXE_LINK_OPTIONS:=-m32
+--- firebird.org/builds/posix/Makefile.in	2016-08-08 17:58:20.000000000 +0200
++++ firebird/builds/posix/Makefile.in	2016-08-08 17:57:17.000000000 +0200
+@@ -191,6 +191,9 @@
+ 	$(MAKE) plugins
+ 	$(MAKE) examples
+ 	$(MAKE) rest
++	install_name_tool -id @__________________________________________________OOO/libfbclient.dylib.3.0.0 $(LIB)/libfbclient.dylib
++	install_name_tool -id @__________________________________________________OOO/libEngine12.dylib $(PLUGINS)/libEngine12.dylib
++	install_name_tool -change $(LIB)/libfbclient.dylib.3.0.0 @loader_path/libfbclient.dylib.3.0.0 $(PLUGINS)/libEngine12.dylib
  
- OS_ServerFiles=inet_server.cpp
  
--PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common -mmacosx-version-min=10.7
--DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-common -Wall -mmacosx-version-min=10.7
-+PROD_FLAGS=-O1 -DDARWIN -pipe -MMD -fPIC -fno-common
-+DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-common -Wall
- CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden
- EMBED_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr
- CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr fbtracemgr 
-
+ cross_process:
+--- firebird.org/src/common/unicode_util.cpp	2016-07-07 13:55:55.992234709 +0200
++++ firebird/src/common/unicode_util.cpp	2016-08-10 11:25:46.422331020 +0200
+@@ -63,8 +63,8 @@
+ #elif defined(DARWIN)
+ //const char* const inTemplate = "/Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicui18n.dylib";
+ //const char* const ucTemplate = "/Library/Frameworks/Firebird.framework/versions/A/Libraries/libicuuc.dylib";
+-const char* const inTemplate = "libicui18n.dylib";
+-const char* const ucTemplate = "libicuuc.dylib";
++const char* const inTemplate = "libicui18n.dylib.%s";
++const char* const ucTemplate = "libicuuc.dylib.%s";
+ #elif defined(HPUX)
+ const char* const inTemplate = "libicui18n.sl.%s";
+ const char* const ucTemplate = "libicuuc.sl.%s";
+@@ -353,6 +353,12 @@
+ 		s.printf("%d%d", majorVersion, minorVersion);
+ 
+ 	filename.printf(templateName, s.c_str());
++	const char * const envpath = getenv("LIBREOFFICE_FIREBIRD_LIB");
++	if(envpath != nullptr)
++	{
++		s = filename.c_str();
++		PathUtils::concatPath(filename, envpath, s.c_str());
++	}
+ }
+ 
+ 
+--- firebird.org/src/common/utils.cpp	2016-08-16 10:11:10.000000000 +0200
++++ firebird/src/common/utils.cpp	2016-08-16 11:27:09.000000000 +0200
+@@ -1027,10 +1027,18 @@
+ 			return s;
+ 		}
+ 
+-                // Set relative path to Engine12 dynamic library
++                // Set path to Engine12 dynamic library.
+                 if(prefType == Firebird::IConfigManager::DIR_PLUGINS)
+                 {
+-                    s = name;
++                    const char * const envpath = getenv("LIBREOFFICE_FIREBIRD_LIB");
++                    if(envpath != nullptr)
++                    {
++                        PathUtils::concatPath(s, envpath, name);
++                    }
++                    else
++                    {
++                        s = name;
++                    }
+                     return s;
+                 }
+ 	}
diff --git a/external/firebird/firebird-rpath.patch.0 b/external/firebird/firebird-rpath.patch.0
index a92f006..a730e72 100644
--- a/external/firebird/firebird-rpath.patch.0
+++ b/external/firebird/firebird-rpath.patch.0
@@ -1,11 +1,11 @@
 --- builds/posix/make.defaults
 +++ builds/posix/make.defaults
-@@ -255,7 +255,7 @@
+@@ -279,7 +279,7 @@
  
- LIB_PLATFORM_RPATH = -Wl,-rpath,$(1)
- ifeq ($(strip @BINRELOC_CFLAGS@),)
--LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,$(if $(subst intl,,$(1)), at FB_LIBDIR@, at FB_INTLDIR@))
-+LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$ORIGIN')
- else
- LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$$$ORIGIN/../$(1)')
- endif
+ ifeq (@USE_RPATH@,1)
+     ifeq ($(strip @BINRELOC_CFLAGS@),)
+-        LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,$(if $(subst intl,,$(1)), at FB_LIBDIR@, at FB_INTLDIR@))
++        LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$ORIGIN')
+     else
+         LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$ORIGIN/../$(1)')
+     endif
diff --git a/external/firebird/firebird.disable-ib-util-not-found.patch.1 b/external/firebird/firebird.disable-ib-util-not-found.patch.1
index c0c4bb6..86dedd0 100644
--- a/external/firebird/firebird.disable-ib-util-not-found.patch.1
+++ b/external/firebird/firebird.disable-ib-util-not-found.patch.1
@@ -1,19 +1,17 @@
 --- firebird.org/src/jrd/fun.epp	2015-01-23 22:11:26.751475044 +0100
 +++ firebird/src/jrd/fun.epp	2015-01-23 22:16:42.507322568 +0100
-@@ -160,10 +160,14 @@
+@@ -164,10 +164,14 @@
  	if (tryLibrary(LIBNAME, message[3]))
  		return;
  
 +        /* fdo#72543: quote from https://bugs.freedesktop.org/show_bug.cgi?id=72543#c8
 +           "we don't need UDF support for embedded firebird,
-+             hence the lack of ib_util isn't an issue and can safely be ignored"
++            hence the lack of ib_util isn't an issue and can safely be ignored"
  	// all failed - log error
  	gds__log("ib_util init failed, UDFs can't be used - looks like firebird misconfigured\n"
  			 "\t%s\n\t%s\n\t%s\n\t%s", message[0].c_str(), message[1].c_str(),
  									   message[2].c_str(), message[3].c_str());
 +        */
- #endif	// !BOOT_BUILD
  }
  
-Seulement dans firebird/src/misc: codes.cpp
-Seulement dans firebird: temp
+ void* IbUtil::alloc(long size)
diff --git a/external/libtommath/ExternalProject_libtommath.mk b/external/libtommath/ExternalProject_libtommath.mk
new file mode 100644
index 0000000..955adc8
--- /dev/null
+++ b/external/libtommath/ExternalProject_libtommath.mk
@@ -0,0 +1,36 @@
+# -*- 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_ExternalProject_ExternalProject,libtommath))
+
+$(eval $(call gb_ExternalProject_register_targets,libtommath,\
+	build \
+))
+
+$(eval $(call gb_ExternalProject_use_nmake,libtommath,build))
+
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,libtommath,build):
+	$(call gb_ExternalProject_run,build,\
+		export CC="$(shell cygpath -w $(filter-out -%,$(CC))) $(filter -%,$(CC))" \
+		&& export LIB="$(ILIB)" \
+		&& nmake -nologo -f makefile.msvc \
+	)
+else
+$(call gb_ExternalProject_get_state_target,libtommath,build) :
+	$(call gb_ExternalProject_run,build,\
+		unset MAKEFLAGS \
+		&& export CFLAGS=" \
+			-fPIC \
+		" \
+		&& $(MAKE) \
+	)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/Makefile b/external/libtommath/Makefile
new file mode 100644
index 0000000..e4968cf8
--- /dev/null
+++ b/external/libtommath/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/libtommath/Module_libtommath.mk b/external/libtommath/Module_libtommath.mk
new file mode 100644
index 0000000..def67f8
--- /dev/null
+++ b/external/libtommath/Module_libtommath.mk
@@ -0,0 +1,17 @@
+# -*- 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,libtommath))
+
+$(eval $(call gb_Module_add_targets,libtommath,\
+	ExternalProject_libtommath \
+	UnpackedTarball_libtommath \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/README b/external/libtommath/README
new file mode 100644
index 0000000..0da3128
--- /dev/null
+++ b/external/libtommath/README
@@ -0,0 +1,6 @@
+LibTomMath is a free open source portable number theoretic multiple-precision
+integer library written entirely in C.
+
+Used by embedded firebird (external/firebird).
+
+http://www.libtom.org/LibTomMath/
diff --git a/external/libtommath/UnpackedTarball_libtommath.mk b/external/libtommath/UnpackedTarball_libtommath.mk
new file mode 100644
index 0000000..2a3184c
--- /dev/null
+++ b/external/libtommath/UnpackedTarball_libtommath.mk
@@ -0,0 +1,20 @@
+# -*- 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,libtommath))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libtommath,$(LIBTOMMATH_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libtommath,0))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libtommath,\
+	external/libtommath/libtommath-msvc.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/libtommath-msvc.patch b/external/libtommath/libtommath-msvc.patch
new file mode 100644
index 0000000..0788487
--- /dev/null
+++ b/external/libtommath/libtommath-msvc.patch
@@ -0,0 +1,12 @@
+--- makefile.msvc	2016-02-05 23:25:32.000000000 +0100
++++ makefile.msvc	2016-07-21 11:34:20.618390100 +0200
+@@ -38,3 +38,9 @@
+ 
+ library: $(OBJECTS)
+ 	lib /out:tommath.lib $(OBJECTS)
++
++.cc.obj:
++	$(CC) /nologo $(CFLAGS) /c $<
++
++.c.obj:
++	$(CC) /nologo $(CFLAGS) /c $<


More information about the Libreoffice-commits mailing list