summaryrefslogtreecommitdiff
path: root/external/firebird
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-10-17 19:42:29 +0200
committerDavid Tardon <dtardon@redhat.com>2013-10-18 06:54:47 +0000
commit1fdb6185a18990818199ad355b89c72102c6a0da (patch)
tree12faec1605c43726f9d13190afcd7720e67ad6d2 /external/firebird
parent1a6264aa1230239006296247c5b6f098b80b6455 (diff)
fdo#70393: move firebird to a subdir of external
Change-Id: I2cb4f4b63ab526c3d034adf8c006103cde7e7304 Reviewed-on: https://gerrit.libreoffice.org/6302 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'external/firebird')
-rw-r--r--external/firebird/ExternalPackage_firebird.mk24
-rw-r--r--external/firebird/ExternalProject_firebird.mk57
-rw-r--r--external/firebird/Makefile7
-rw-r--r--external/firebird/Module_firebird.mk18
-rw-r--r--external/firebird/UnpackedTarball_firebird.mk34
-rw-r--r--external/firebird/firebird-c++11.patch.1215
-rw-r--r--external/firebird/firebird-cygwin-msvc.patch.1794
-rw-r--r--external/firebird/firebird-icu.patch.128
-rw-r--r--external/firebird/firebird-macosx.patch.1100
-rw-r--r--external/firebird/firebird-rpath.patch.011
10 files changed, 1288 insertions, 0 deletions
diff --git a/external/firebird/ExternalPackage_firebird.mk b/external/firebird/ExternalPackage_firebird.mk
new file mode 100644
index 000000000000..6419c30ccc43
--- /dev/null
+++ b/external/firebird/ExternalPackage_firebird.mk
@@ -0,0 +1,24 @@
+# -*- 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_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,bin/ifbembed.dll,gen/firebird/bin/ifbembed.dll))
+$(eval $(call gb_ExternalPackage_add_file,firebird,lib/ifbembed.lib,gen/firebird/bin/ifbembed.lib))
+else ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_file,firebird,lib/libfbembed.dylib,gen/firebird/lib/libfbembed.dylib.2.5.2))
+else
+$(eval $(call gb_ExternalPackage_add_file,firebird,lib/libfbembed.so.2.5,gen/firebird/lib/libfbembed.so.2.5.2))
+$(eval $(call gb_ExternalPackage_add_file,firebird,lib/libfbembed.so,gen/firebird/lib/libfbembed.so.2.5.2))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk
new file mode 100644
index 000000000000..bf6b45368ba7
--- /dev/null
+++ b/external/firebird/ExternalProject_firebird.mk
@@ -0,0 +1,57 @@
+# -*- 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,firebird))
+
+$(eval $(call gb_ExternalProject_use_autoconf,firebird,build))
+
+$(eval $(call gb_ExternalProject_use_externals,firebird,\
+ boost_headers \
+ icu \
+ libatomic_ops \
+))
+
+$(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
+
+# do not set LDFLAGS - it is mysteriously not used by firebird on MacOSX
+$(call gb_ExternalProject_get_state_target,firebird,build):
+ $(call gb_ExternalProject_run,build,\
+ unset MAKEFLAGS \
+ && export PKG_CONFIG="" \
+ && export CXXFLAGS=" \
+ $(if $(filter NO,$(SYSTEM_BOOST)), \
+ -I$(call gb_UnpackedTarball_get_dir,boost),$(BOOST_CPPFLAGS) \
+ -L$(call gb_UnpackedTarball_get_dir,boost)/source/lib) \
+ $(if $(filter NO,$(SYSTEM_ICU)), \
+ -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 \
+ ,$(ICU_CPPFLAGS)) \
+ -L$(OUTDIR)/lib \
+ " \
+ && ./configure \
+ --without-editline \
+ --disable-superserver \
+ --with-system-icu --without-fbsample --without-fbsample-db \
+ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(if $(filter IOS ANDROID,$(OS)),--disable-shared,--disable-static) \
+ && $(if $(filter WNT,$(OS)),\
+ PATH="$(shell cygpath -u $(OUTDIR)/bin):$$PATH",\
+ $(gb_Helper_set_ld_path)) \
+ $(MAKE) firebird_embedded \
+ $(if $(filter MACOSX,$(OS)),&& $(PERL) \
+ $(SOLARENV)/bin/macosx-change-install-names.pl shl OOO \
+ $(gb_Package_SOURCEDIR_firebird)/gen/firebird/lib/libfbembed.dylib.2.5.2) \
+ )
+# vim: set noet sw=4 ts=4:
diff --git a/external/firebird/Makefile b/external/firebird/Makefile
new file mode 100644
index 000000000000..ccb1c85a04da
--- /dev/null
+++ b/external/firebird/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/firebird/Module_firebird.mk b/external/firebird/Module_firebird.mk
new file mode 100644
index 000000000000..d74963f7f4b5
--- /dev/null
+++ b/external/firebird/Module_firebird.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_Module_Module,firebird))
+
+$(eval $(call gb_Module_add_targets,firebird,\
+ ExternalPackage_firebird \
+ ExternalProject_firebird \
+ UnpackedTarball_firebird \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/firebird/UnpackedTarball_firebird.mk b/external/firebird/UnpackedTarball_firebird.mk
new file mode 100644
index 000000000000..c4119a022bb7
--- /dev/null
+++ b/external/firebird/UnpackedTarball_firebird.mk
@@ -0,0 +1,34 @@
+# -*- 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,firebird))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,firebird,$(FIREBIRD_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
+ external/firebird/firebird-icu.patch.1 \
+ external/firebird/firebird-rpath.patch.0 \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
+ external/firebird/firebird-c++11.patch.1 \
+))
+
+ifeq ($(OS)-$(COM),WNT-MSC)
+$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
+ external/firebird/firebird-cygwin-msvc.patch.1 \
+))
+endif
+
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
+ external/firebird/firebird-macosx.patch.1 \
+))
+endif
+# vim: set noet sw=4 ts=4:
diff --git a/external/firebird/firebird-c++11.patch.1 b/external/firebird/firebird-c++11.patch.1
new file mode 100644
index 000000000000..e8cb52d4d7fd
--- /dev/null
+++ b/external/firebird/firebird-c++11.patch.1
@@ -0,0 +1,215 @@
+# -*- Mode: Diff -*-
+--- firebird/src/gpre/c_cxx.cpp
++++ firebird/src/gpre/c_cxx.cpp
+@@ -876,7 +876,7 @@
+ if (based_on->bas_flags & BAS_segment)
+ {
+ if (*variable != '*')
+- fprintf(gpreGlob.out_file, "[%"SLONGFORMAT"]", length);
++ fprintf(gpreGlob.out_file, "[%" SLONGFORMAT "]", length);
+ }
+ else if (field->fld_array_info)
+ {
+@@ -885,7 +885,7 @@
+ for (const dim* dimension = field->fld_array_info->ary_dimension;
+ dimension; dimension = dimension->dim_next)
+ {
+- fprintf(gpreGlob.out_file, " [%"SLONGFORMAT"]", dimension->dim_upper - dimension->dim_lower + 1);
++ fprintf(gpreGlob.out_file, " [%" SLONGFORMAT "]", dimension->dim_upper - dimension->dim_lower + 1);
+ }
+
+ if (field->fld_array_info->ary_dtype <= dtype_varying && field->fld_length > 1)
+@@ -1577,7 +1577,7 @@
+ const gpre_dbb* db = (gpre_dbb*) action->act_object;
+ align(column);
+
+- fprintf(gpreGlob.out_file, "isc_drop_database (%s, %"SIZEFORMAT", \"%s\", rdb$k_db_type_gds);",
++ fprintf(gpreGlob.out_file, "isc_drop_database (%s, %" SIZEFORMAT ", \"%s\", rdb$k_db_type_gds);",
+ status_vector(action),
+ strlen(db->dbb_filename), db->dbb_filename);
+ set_sqlcode(action, column);
+@@ -3471,7 +3471,7 @@
+
+ static void gen_type( const act* action, int column)
+ {
+- printa(column, "%"SLONGFORMAT, (SLONG)(IPTR)action->act_object);
++ printa(column, "%" SLONGFORMAT, (SLONG)(IPTR)action->act_object);
+ }
+
+
+@@ -3623,7 +3623,7 @@
+ for (const dim* dimension = field->fld_array_info->ary_dimension; dimension;
+ dimension = dimension->dim_next)
+ {
+- fprintf(gpreGlob.out_file, " [%"SLONGFORMAT"]", dimension->dim_upper - dimension->dim_lower + 1);
++ fprintf(gpreGlob.out_file, " [%" SLONGFORMAT "]", dimension->dim_upper - dimension->dim_lower + 1);
+ }
+
+ if (field->fld_array_info->ary_dtype <= dtype_varying)
+--- firebird/src/gpre/exp.cpp
++++ firebird/src/gpre/exp.cpp
+@@ -398,7 +398,7 @@
+ if (gpreGlob.token_global.tok_type != tok_number)
+ CPR_s_error("<number>");
+
+- const char format[8] = "%"SQUADFORMAT;
++ const char format[8] = "%" SQUADFORMAT;
+ SINT64 n;
+ sscanf(gpreGlob.token_global.tok_string, format, &n);
+
+@@ -428,7 +428,7 @@
+
+ const SLONG n = atoi(gpreGlob.token_global.tok_string);
+ char buffer[32];
+- sprintf(buffer, "%"SLONGFORMAT, n);
++ sprintf(buffer, "%" SLONGFORMAT, n);
+ if (strcmp(buffer, gpreGlob.token_global.tok_string) != 0)
+ PAR_error("Numeric value out of range");
+
+@@ -478,7 +478,7 @@
+
+ const ULONG n = atoi(gpreGlob.token_global.tok_string);
+ char buffer[32];
+- sprintf(buffer, "%"ULONGFORMAT, n);
++ sprintf(buffer, "%" ULONGFORMAT, n);
+ if (strcmp(buffer, gpreGlob.token_global.tok_string) != 0)
+ PAR_error("Numeric value out of range");
+
+--- firebird/src/gpre/gpre.cpp
++++ firebird/src/gpre/gpre.cpp
+@@ -2525,9 +2525,9 @@
+ if (line_pending)
+ {
+ if (line == 1)
+- fprintf(gpreGlob.out_file, "#line %"SLONGFORMAT" \"%s\"\n", line, backlash_fixed_file_name);
++ fprintf(gpreGlob.out_file, "#line %" SLONGFORMAT " \"%s\"\n", line, backlash_fixed_file_name);
+ else
+- fprintf(gpreGlob.out_file, "\n#line %"SLONGFORMAT" \"%s\"", line, backlash_fixed_file_name);
++ fprintf(gpreGlob.out_file, "\n#line %" SLONGFORMAT " \"%s\"", line, backlash_fixed_file_name);
+
+ line_pending = false;
+ }
+@@ -2668,7 +2668,7 @@
+ {
+ if (c == '\n' && line_pending)
+ {
+- fprintf(gpreGlob.out_file, "\n#line %"SLONGFORMAT" \"%s\"", line + 1, backlash_fixed_file_name);
++ fprintf(gpreGlob.out_file, "\n#line %" SLONGFORMAT " \"%s\"", line + 1, backlash_fixed_file_name);
+ line_pending = false;
+ }
+ if (c == EOF)
+--- firebird/src/gpre/int_cxx.cpp
++++ firebird/src/gpre/int_cxx.cpp
+@@ -290,7 +290,7 @@
+ fprintf(gpreGlob.out_file, "if (!%s)", request->req_handle);
+ align(column);
+ fprintf(gpreGlob.out_file,
+- "%s = CMP_compile2 (tdbb, (UCHAR*) jrd_%"ULONGFORMAT", sizeof(jrd_%"ULONGFORMAT"), true);",
++ "%s = CMP_compile2 (tdbb, (UCHAR*) jrd_%" ULONGFORMAT ", sizeof(jrd_%" ULONGFORMAT "), true);",
+ request->req_handle, request->req_ident, request->req_ident);
+ }
+
+@@ -478,7 +478,7 @@
+ {
+
+ fprintf(gpreGlob.out_file,
+- "EXE_receive (tdbb, %s, %d, %d, (UCHAR*) &jrd_%"ULONGFORMAT");",
++ "EXE_receive (tdbb, %s, %d, %d, (UCHAR*) &jrd_%" ULONGFORMAT ");",
+ request->req_handle, port->por_msg_number, port->por_length,
+ port->por_ident);
+ }
+@@ -495,7 +495,7 @@
+ if (!(request->req_flags & REQ_exp_hand))
+ fprintf(gpreGlob.out_file, "static void\t*%s;\t// request handle \n", request->req_handle);
+
+- fprintf(gpreGlob.out_file, "static const UCHAR\tjrd_%"ULONGFORMAT" [%d] =",
++ fprintf(gpreGlob.out_file, "static const UCHAR\tjrd_%" ULONGFORMAT " [%d] =",
+ request->req_ident, request->req_length);
+ align(INDENT);
+ fprintf(gpreGlob.out_file, "{\t// blr string \n");
+@@ -588,7 +588,7 @@
+ }
+ align(column);
+
+- fprintf(gpreGlob.out_file, "EXE_send (tdbb, %s, %d, %d, (UCHAR*) &jrd_%"ULONGFORMAT");",
++ fprintf(gpreGlob.out_file, "EXE_send (tdbb, %s, %d, %d, (UCHAR*) &jrd_%" ULONGFORMAT ");",
+ request->req_handle, port->por_msg_number, port->por_length, port->por_ident);
+ }
+
+@@ -716,7 +716,7 @@
+ fprintf(gpreGlob.out_file, fmtstr, reference->ref_ident, name);
+ }
+ align(column);
+- fprintf(gpreGlob.out_file, "} jrd_%"ULONGFORMAT";", port->por_ident);
++ fprintf(gpreGlob.out_file, "} jrd_%" ULONGFORMAT ";", port->por_ident);
+ }
+
+
+--- firebird/src/gpre/pat.cpp
++++ firebird/src/gpre/pat.cpp
+@@ -417,7 +417,7 @@
+ }
+ }
+ else if (long_flag) {
+- sprintf(p, "%"SLONGFORMAT, long_value);
++ sprintf(p, "%" SLONGFORMAT , long_value);
+ }
+ else {
+ sprintf(p, "%d", value);
+--- firebird/src/common/classes/alloc.cpp
++++ firebird/src/common/classes/alloc.cpp
+@@ -1100,7 +1100,7 @@
+ if (blk->mbk_flags & MBK_LAST)
+ break;
+ }
+- fprintf(file, "Blocks %"SIZEFORMAT" min %"SIZEFORMAT" max %"SIZEFORMAT" size %"SIZEFORMAT" \n\n",
++ fprintf(file, "Blocks %" SIZEFORMAT " min %" SIZEFORMAT " max %" SIZEFORMAT " size %" SIZEFORMAT " \n\n",
+ cnt, min, max, sum);
+ }
+
+@@ -1303,7 +1303,7 @@
+ FreeMemoryBlock* freeBlock = blockToPtr<FreeMemoryBlock*>(blk);
+ freeBlock->fbk_next_fragment = NULL;
+
+- BlockInfo temp = {blockLength, freeBlock};
++ BlockInfo temp = {static_cast<size_t>(blockLength), freeBlock};
+ pool->freeBlocks.add(temp);
+ if (!pool->parent_redirect)
+ {
+--- firebird/src/common/cvt.cpp
++++ firebird/src/common/cvt.cpp
+@@ -144,7 +144,7 @@
+
+ #ifndef NATIVE_QUAD
+ #ifndef WORDS_BIGENDIAN
+-static const SQUAD quad_min_int = { 0, SLONG_MIN };
++static const SQUAD quad_min_int = { 0, static_cast<ULONG>(SLONG_MIN) };
+ static const SQUAD quad_max_int = { -1, SLONG_MAX };
+ #else
+ static const SQUAD quad_min_int = { SLONG_MIN, 0 };
+--- firebird/src/jrd/perf.cpp
++++ firebird/src/jrd/perf.cpp
+@@ -164,20 +164,20 @@
+ case 'b':
+ case 'c':
+ case 'x':
+- sprintf(p, "%"SQUADFORMAT, delta);
++ sprintf(p, "%" SQUADFORMAT , delta);
+ while (*p)
+ p++;
+ break;
+
+ case 'u':
+ case 's':
+- sprintf(p, "%"SQUADFORMAT".%.2"SQUADFORMAT, delta / TICK, (delta % TICK) * 100 / TICK);
++ sprintf(p, "%" SQUADFORMAT ".%.2" SQUADFORMAT , delta / TICK, (delta % TICK) * 100 / TICK);
+ while (*p)
+ p++;
+ break;
+
+ case 'e':
+- sprintf(p, "%"SQUADFORMAT".%.2"SQUADFORMAT, delta / 100, delta % 100);
++ sprintf(p, "%" SQUADFORMAT ".%.2" SQUADFORMAT , delta / 100, delta % 100);
+ while (*p)
+ p++;
+ break;
diff --git a/external/firebird/firebird-cygwin-msvc.patch.1 b/external/firebird/firebird-cygwin-msvc.patch.1
new file mode 100644
index 000000000000..5e2368b89bcf
--- /dev/null
+++ b/external/firebird/firebird-cygwin-msvc.patch.1
@@ -0,0 +1,794 @@
+diff -u firebird/builds/posix/make.defaults firebird/builds/posix/make.defaults
+--- firebird/builds/posix/make.defaults 2013-07-03 16:23:44.804062000 +0100
++++ firebird/builds/posix/make.defaults 2013-07-05 12:30:01.607151400 +0100
+@@ -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 +199,7 @@
+ vpath %.so $(LIB)
+ vpath %.a $(LIB)
+ vpath %.dll $(LIB)
++vpath %.lib $(LIB)
+
+ #_____________________________________________________________________________
+
+@@ -193,9 +214,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 +240,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)
+unchanged:
+--- firebird.org/builds/posix/make.shared.variables 2013-06-26 10:05:19.351343000 +0100
++++ firebird/builds/posix/make.shared.variables 2013-07-04 08:12:24.432879700 +0100
+@@ -291,7 +291,8 @@
+ OS_SPECIFIC_Sources += $(ROOT)/extern/binreloc/binreloc.c
+ endif
+ OS_SPECIFIC_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(OS_SPECIFIC_Sources))))
+-
++#FBCOMMON_ClientFiles+=$(OS_SPECIFIC_Files)
++#FBCOMMON_Objects+=$(OS_SPECIFIC_Objects)
+
+ #________________________________________________________________________
+ #
+unchanged:
+--- firebird/builds/posix/Makefile.in.examples 2013-07-04 14:22:42.262676600 +0100
++++ firebird/builds/posix/Makefile.in.examples 2013-07-05 10:14:02.897675100 +0100
+@@ -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
+@@ -168,0 +180,3 @@
++
++$(EXAMPLES_DEST)/%.obj: $(EXAMPLES_DEST)/%.c
++ $(CC) -c $(firstword $<) -Fo$@ $(WCFLAGS)
+\ No newline at end of file
+unchanged:
+--- firebird.org/builds/posix/Makefile.in.extlib 2013-06-26 10:05:19.366787100 +0100
++++ firebird/builds/posix/Makefile.in.extlib 2013-07-04 12:31:37.591067100 +0100
+@@ -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
+
+unchanged:
+--- firebird.org/builds/posix/Makefile.in.firebird 2013-06-26 10:05:19.382231200 +0100
++++ firebird/builds/posix/Makefile.in.firebird 2013-07-04 18:36:17.079544900 +0100
+@@ -145,7 +145,8 @@
+
+ firebird : firebird_@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
+
+
+@@ -301,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 +336,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 +452,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
+--- firebird.org/builds/posix/Makefile.in.intl 2013-06-26 10:05:19.382231200 +0100
++++ firebird/builds/posix/Makefile.in.intl 2013-07-04 12:26:09.029586700 +0100
+@@ -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 -u firebird/builds/posix/Makefile.in.libfbembed firebird/builds/posix/Makefile.in.libfbembed
+--- firebird/builds/posix/Makefile.in.libfbembed 2013-07-04 17:51:37.197367500 +0100
++++ firebird/builds/posix/Makefile.in.libfbembed 2013-07-05 12:55:58.287451400 +0100
+@@ -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
+
+unchanged:
+--- firebird.org/builds/posix/Makefile.in.libfbstatic 2013-06-26 10:05:19.382231200 +0100
++++ firebird/builds/posix/Makefile.in.libfbstatic 2013-07-03 16:23:14.103208000 +0100
+@@ -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) $@
+unchanged:
+--- firebird.org/builds/posix/prefix.mingw 2013-06-26 10:05:19.413119400 +0100
++++ firebird/builds/posix/prefix.mingw 2013-07-04 18:13:52.948234400 +0100
+@@ -20,8 +20,8 @@
+ #
+
+ # -Wno-unused-variable is used due to unused gpre generated variables
+-PROD_FLAGS=-O2 -march=i586 -DMINGW -mno-cygwin -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 -mno-cygwin -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 -mno-cygwin -Wall -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads
++DEV_FLAGS=-ggdb -march=i586 -DMINGW -mno-cygwin -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
+unchanged:
+--- firebird.org/configure 2013-06-26 10:05:19.675669100 +0100
++++ firebird/configure 2013-06-26 10:14:11.490867900 +0100
+@@ -2796,7 +2796,7 @@
+ SHRLIB_EXT=so
+ ;;
+
+- *-*-mingw*)
++ *-*-mingw* | *-*-cygwin*)
+ MAKEFILE_PREFIX=mingw
+ PLATFORM=win32
+
+@@ -8934,6 +8934,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.
+@@ -9882,7 +9885,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'
+@@ -14675,7 +14678,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'
+@@ -16452,7 +16455,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'
+@@ -16522,7 +16525,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'
+@@ -19067,7 +19070,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'
+@@ -19137,7 +19140,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'
+unchanged:
+--- firebird.org/configure.in 2013-06-26 10:05:19.675669100 +0100
++++ firebird/configure.in 2013-06-26 14:16:35.816845700 +0100
+@@ -1,30 +1,4 @@
+-dnl ############################# INITIALISATION ###############################
+-
+-AC_PREREQ(2.56)
+-AC_INIT(src)
+-
+-AC_CONFIG_AUX_DIR(builds/make.new/config)
+-AC_CACHE_VAL(ac_cv_prog_make_set, [AC_PROG_MAKE_SET])
+-AC_PREFIX_DEFAULT(/usr/local/firebird)
+-
+-m4_ifdef([AC_CONFIG_MACRO_DIR],
+- [],
+- [m4_define([AC_CONFIG_MACRO_DIR], [])])
+-AC_CONFIG_MACRO_DIR(m4)
+-
+-AC_CONFIG_HEADER(src/include/gen/autoconfig.h:builds/make.new/config/config.h.in)
+-
+-dnl XE_APPEND(value, varname)
+-define([XE_APPEND],[[$2]="$[$2] [$1]"])
+-
+-dnl XE_PREPEND(value, varname)
+-define([XE_PREPEND],[[$2]="[$1] $[$2]"])
+-
+-dnl XE_CONF_DIR(param, help, variable, default)
+-define([XE_CONF_DIR],[
+-AC_ARG_WITH([$1],
+- [AC_HELP_STRING([--with-$1], [$2])],
+- [[$3]="$withval"
++NO
+ AC_DEFINE_UNQUOTED([$3], "$[$3]", [$2])],
+ [[$3]="[`if test ""x$prefix"" = ""xNONE"" ; then echo ""$ac_default_prefix""; else echo ""$prefix""; fi`][$4]"
+ AC_DEFINE_UNQUOTED([$3], [""], [$2])]
+@@ -37,8 +11,8 @@
+
+ dnl ############################# ADD TESTS BELOW ##############################
+
+-AC_CANONICAL_SYSTEM
+-CPU_TYPE=$target_cpu
++AC_CANONICAL_HOST
++CPU_TYPE=$host_cpu
+ AC_SUBST(CPU_TYPE)
+
+
+@@ -61,7 +35,7 @@
+ dnl Test for special ar options?
+ AR_OPT_CHECK=false
+
+-case "$target" in
++case "$host" in
+ i*86-*-darwin*)
+ dnl MAKEFILE_PREFIX=darwin_i386
+ MAKEFILE_PREFIX=darwin_x86_64
+@@ -112,7 +86,7 @@
+
+ amd64-*-freebsd* | x86_64*-*-freebsd* | x86_64*-*-k*bsd*-gnu)
+ MAKEFILE_PREFIX=freebsd_amd64
+- case "$target" in
++ case "$host" in
+ x86_64*-*-k*bsd-gnu) # Debian/kFreeBSD
+ PLATFORM=GENTOOFREEBSD
+ INSTALL_PREFIX=linux
+@@ -138,7 +112,7 @@
+
+ *-*-freebsd* | *-*-k*bsd*-gnu)
+ MAKEFILE_PREFIX=freebsd
+- case "$target" in
++ case "$host" in
+ *-*-k*bsd-gnu) # Debian/kFreeBSD
+ PLATFORM=GENTOOFREEBSD
+ INSTALL_PREFIX=linux
+@@ -394,7 +368,7 @@
+ SHRLIB_EXT=so
+ ;;
+
+- *-*-mingw*)
++ *-*-mingw* | *-*-cygwin*)
+ MAKEFILE_PREFIX=mingw
+ PLATFORM=win32
+ AC_DEFINE(WIN_NT, 1, [Define this if OS is Windows NT])
+@@ -756,7 +730,25 @@
+ AC_CHECK_FUNCS(swab _swab)
+ AC_FUNC_MMAP
+ AC_FUNC_FORK
+-AC_FUNC_SETPGRP
++
++dnl AC_FUNC_SETPGRP does not work if cross compiling
++dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
++if test "$cross_compiling" = no; then
++ AC_FUNC_SETPGRP
++else
++ AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
++ [AC_TRY_COMPILE([
++#include <unistd.h>
++], [
++ if (setpgrp(1,1) == -1)
++ exit (0);
++ else
++ exit (1);
++], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
++if test $ac_cv_func_setpgrp_void = yes; then
++ AC_DEFINE(SETPGRP_VOID, 1)
++fi
++fi
+ AC_CHECK_FUNCS(setpgid)
+ AC_FUNC_GETPGRP
+ AC_CHECK_FUNCS(flock)
+@@ -822,7 +814,9 @@
+ [AC_DEFINE(WORKING_SEM_INIT,1,[Define this if sem_init() works on the platform])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+-AC_SEARCH_LIBS(sem_open, rt)])
++AC_SEARCH_LIBS(sem_open, rt)],
++[AC_DEFINE(WORKING_SEM_INIT,1,[Define this if sem_init() works on the platform])
++AC_MSG_RESULT(cross-compiling, assuming yes)])
+ fi
+ fi
+
+@@ -885,27 +879,13 @@
+
+ dnl EKU: try to determine the alignment of long and double
+ dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h
+-AC_MSG_CHECKING(alignment of long)
+-AC_TRY_RUN([main () {
+- struct s {
+- char a;
+- long long b;
+- };
+- exit((int)&((struct s*)0)->b);
+-}], ac_cv_c_alignment=$ac_status, ac_cv_c_alignment=$ac_status)
+-AC_MSG_RESULT($ac_cv_c_alignment)
+-AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_c_alignment, [Alignment of long])
+-
+-AC_MSG_CHECKING(alignment of double)
+-AC_TRY_RUN([main () {
+- struct s {
+- char a;
+- double b;
+- };
+- exit((int)&((struct s*)0)->b);
+-}], ac_cv_c_double_align=$ac_status, ac_cv_c_double_align=$ac_status)
+-AC_MSG_RESULT($ac_cv_c_double_align)
+-AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_c_double_align, [Alignment of double])
++AC_CHECK_ALIGNOF(long long)
++AC_MSG_RESULT($ac_cv_alignof_long_long)
++AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_alignof_long_long, [Alignment of long])
++
++AC_CHECK_ALIGNOF(double)
++AC_MSG_RESULT($ac_cv_alignof_double)
++AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_alignof_double, [Alignment of double])
+
+ dnl EKU: don't know how to convert this into an autoconf test:
+ dnl #define FB_ALIGN(n,b) ...
+@@ -980,7 +960,7 @@
+ #define FB_PIPE_NAME "interbas"])
+ AC_DEFINE_UNQUOTED(FB_PIPE_NAME,"$FB_PIPE_NAME")
+ AC_SUBST(FB_PIPE_NAME)
+- XE_PREPEND( -mno-cygwin -mthreads -lmpr -lversion -lws2_32 -lole32,LIBS)
++ XE_PREPEND( -mthreads -lmpr -lversion -lws2_32 -lole32,LIBS)
+ ;;
+
+ *)
+unchanged:
+--- firebird.org/extern/btyacc/main.c 2013-06-26 10:05:19.907330600 +0100
++++ firebird/extern/btyacc/main.c 2013-06-26 10:25:20.065917200 +0100
+@@ -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>
+unchanged:
+--- firebird.org/src/burp/mvol.cpp 2013-06-26 10:05:24.089577700 +0100
++++ firebird/src/burp/mvol.cpp 2013-07-03 15:29:42.818271200 +0100
+@@ -47,7 +47,7 @@
+ #include <fcntl.h>
+ #include <sys/types.h>
+
+-#ifdef HAVE_IO_H
++#if defined(HAVE_IO_H) || defined(WIN_NT)
+ #include <io.h> // isatty
+ #endif
+
+unchanged:
+--- firebird.org/src/burp/restore.epp 2013-06-26 10:05:24.089577700 +0100
++++ firebird/src/burp/restore.epp 2013-07-03 15:25:34.792722000 +0100
+@@ -54,6 +54,10 @@
+ #include "../common/classes/SafeArg.h"
+ #include "memory_routines.h"
+
++#ifdef WIN_NT
++#define snprintf _snprintf
++#endif
++
+ using MsgFormat::SafeArg;
+
+
+unchanged:
+--- firebird.org/src/common/classes/BaseStream.cpp 2013-06-26 10:05:24.106566100 +0100
++++ firebird/src/common/classes/BaseStream.cpp 2013-06-27 19:12:19.694346700 +0100
+@@ -28,6 +28,10 @@
+ #include "BaseStream.h"
+ #include <string.h>
+
++#if defined(WIN_NT)
++#include <io.h>
++#endif
++
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+unchanged:
+--- firebird.org/src/common/classes/fb_string.cpp 2013-06-26 10:05:24.123554500 +0100
++++ firebird/src/common/classes/fb_string.cpp 2013-07-03 18:12:28.168333200 +0100
+@@ -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
+unchanged:
+--- firebird.org/src/common/classes/FpeControl.h 2013-06-26 10:05:24.123554500 +0100
++++ firebird/src/common/classes/FpeControl.h 2013-06-28 13:19:21.411841900 +0100
+@@ -204,7 +204,7 @@
+ #ifdef WIN_NT
+ inline bool isinf(double x)
+ {
+- return (!_finite (x) && !isnan(x));
++ return (!_finite (x) && !_isnan(x));
+ }
+ #else
+ #ifndef isinf
+unchanged:
+--- firebird.org/src/isql/isql.epp 2013-06-26 10:05:24.718148500 +0100
++++ firebird/src/isql/isql.epp 2013-07-03 15:39:19.475181200 +0100
+@@ -98,6 +98,7 @@
+ #include "../jrd/common.h"
+ #if defined(WIN_NT)
+ #include <windows.h>
++#define isnan _isnan
+ #endif
+ #include "../jrd/ibase.h"
+ #include "../isql/isql.h"
+unchanged:
+--- firebird.org/src/jrd/divorce.cpp 2013-06-26 10:05:24.786102100 +0100
++++ firebird/src/jrd/divorce.cpp 2013-06-29 11:37:36.553854700 +0100
+@@ -54,7 +54,7 @@
+ #include "../jrd/divorce.h"
+ #include "../common/classes/semaphore.h"
+
+-#ifdef HAVE_IO_H
++#if defined(HAVE_IO_H) || defined(WIN_NT)
+ #include <io.h>
+ #endif
+
+unchanged:
+--- firebird.org/src/jrd/fun.epp 2013-06-26 10:05:24.888032500 +0100
++++ firebird/src/jrd/fun.epp 2013-06-29 11:19:52.564078500 +0100
+@@ -733,7 +733,7 @@
+ status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
+ Arg::Gds(isc_udf_fp_overflow) << Arg::Str(function->fun_name));
+ }
+- else if (isnan(value->vlu_misc.vlu_double))
++ else if (_isnan(value->vlu_misc.vlu_double))
+ {
+ status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
+ Arg::Gds(isc_udf_fp_nan) << Arg::Str(function->fun_name));
+unchanged:
+--- firebird.org/src/jrd/gds.cpp 2013-06-26 10:05:24.888032500 +0100
++++ firebird/src/jrd/gds.cpp 2013-06-29 10:38:05.140333200 +0100
+@@ -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>
+@@ -121,7 +123,7 @@
+
+ #ifdef WIN_NT
+ #include <shlobj.h>
+-#include <shfolder.h>
++//#include <shfolder.h>
+ #define _WINSOCKAPI_
+ #include <share.h>
+ #include "err_proto.h"
+unchanged:
+--- firebird.org/src/jrd/isc.cpp 2013-06-26 10:05:24.922009300 +0100
++++ firebird/src/jrd/isc.cpp 2013-06-29 10:38:56.698423800 +0100
+@@ -58,7 +58,7 @@
+ /* Win32 specific stuff */
+
+ #ifdef WIN_NT
+-
++#pragma comment(lib, "User32")
+ #include <windows.h>
+ #include <aclapi.h>
+ #include <lmcons.h>
+unchanged:
+--- firebird.org/src/jrd/isc_sync.cpp 2013-06-26 10:05:24.938997700 +0100
++++ firebird/src/jrd/isc_sync.cpp 2013-06-30 18:45:43.811961300 +0100
+@@ -127,10 +127,10 @@
+ #include <sys/param.h>
+ #endif
+
+-#ifndef HAVE_GETPAGESIZE
++#if !defined(HAVE_GETPAGESIZE) && !defined(WIN_NT)
+ static size_t getpagesize()
+ {
+- return PAGESIZE;
++ return _PAGESIZE;
+ }
+ #endif
+
+@@ -4320,7 +4320,13 @@
+ *
+ **************************************/
+ char hostname[64];
+- const int rc = snprintf(buffer, bufsize, object_name, ISC_get_host(hostname, sizeof(hostname)));
++ const int rc =
++ #ifdef WIN_NT
++ _snprintf(
++ #else
++ snprintf(
++ #endif
++ buffer, bufsize, object_name, ISC_get_host(hostname, sizeof(hostname)));
+ if (size_t(rc) == bufsize || rc <= 0)
+ {
+ SetLastError(ERROR_FILENAME_EXCED_RANGE);
+unchanged:
+--- firebird.org/src/jrd/os/win32/mod_loader.cpp 2013-06-26 10:05:25.006951300 +0100
++++ firebird/src/jrd/os/win32/mod_loader.cpp 2013-06-27 18:30:42.642374700 +0100
+@@ -93,6 +93,10 @@
+ "msvcr80.dll",
+ #elif _MSC_VER == 1500
+ "msvcr90.dll",
++#elif _MSC_VER == 1600
++ "mscvr100.dll",
++#elif _MSC_VER == 1700
++ "mscvr110.dll",
+ #else
+ #error Specify CRT DLL name here !
+ #endif
+unchanged:
+--- firebird.org/src/jrd/trace/TraceConfigStorage.cpp 2013-06-26 10:05:25.754440900 +0100
++++ firebird/src/jrd/trace/TraceConfigStorage.cpp 2013-07-02 12:32:31.799779900 +0100
+@@ -42,9 +42,10 @@
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+-#ifdef HAVE_IO_H
++#if defined(HAVE_IO_H) || defined(WIN_NT)
+ #include <io.h>
+ #endif
++
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+unchanged:
+--- firebird.org/src/jrd/trace/TraceLog.cpp 2013-06-26 10:05:25.958301700 +0100
++++ firebird/src/jrd/trace/TraceLog.cpp 2013-07-02 12:32:49.747208200 +0100
+@@ -29,7 +29,7 @@
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+-#ifdef HAVE_IO_H
++#if defined(HAVE_IO_H) || defined(WIN_NT)
+ #include <io.h>
+ #endif
+ #include <fcntl.h>
+unchanged:
+--- firebird.org/src/misc/makeHeader.cpp 2013-06-26 10:05:26.230116100 +0100
++++ firebird/src/misc/makeHeader.cpp 2013-07-04 12:43:53.149081800 +0100
+@@ -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
+
+
+
+unchanged:
+--- firebird.org/extern/btyacc/Makefile 2013-07-05 07:58:12.591917200 +0100
++++ firebird/extern/btyacc/Makefile 2013-07-05 09:31:07.589691500 +0100
+@@ -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)
+
+unchanged:
+--- firebird.orig/builds/posix/make.rules 2013-08-04 19:06:02.208552600 +0900
++++ firebird/builds/posix/make.rules 2013-08-04 19:13:59.981368500 +0900
+@@ -116,4 +116,4 @@
+ # Rules for making resource files
+
+ $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
+- windres --output-format=coff --include-dir=$(<D) $< $@
++ windres --output-format=coff --include-dir=$(<D) --target=pe-i386 $< $@
+only in patch2:
diff --git a/external/firebird/firebird-icu.patch.1 b/external/firebird/firebird-icu.patch.1
new file mode 100644
index 000000000000..6045ee19f0b0
--- /dev/null
+++ b/external/firebird/firebird-icu.patch.1
@@ -0,0 +1,28 @@
+diff -ur firebird.org/builds/posix/Makefile.in.examples firebird/builds/posix/Makefile.in.examples
+--- firebird.org/builds/posix/Makefile.in.examples 2013-06-21 20:47:17.047657633 +0100
++++ firebird/builds/posix/Makefile.in.examples 2013-06-21 21:01:45.297638456 +0100
+@@ -53,10 +53,10 @@
+ export PATH
+
+ ifeq ($(PLATFORM),DARWIN)
+-DYLD_LIBRARY_PATH := $(GEN_ROOT)/firebird/lib
++DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
+ export DYLD_LIBRARY_PATH
+ else
+-LD_LIBRARY_PATH := $(GEN_ROOT)/firebird/lib
++LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
+ export LD_LIBRARY_PATH
+ endif
+ GPRE_FLAGS= -r -m -z -n
+diff -ur firebird.org/builds/posix/Makefile.in.firebird firebird/builds/posix/Makefile.in.firebird
+--- firebird.org/builds/posix/Makefile.in.firebird 2013-06-21 20:47:17.060657632 +0100
++++ firebird/builds/posix/Makefile.in.firebird 2013-06-21 21:12:00.559624868 +0100
+@@ -44,7 +44,7 @@
+ TEST_PATH = @FIREBIRD_BUILD_DIR@
+ # Firebird libs path set at link time (-R) so do not override local requirements - nmcc 28/12/2002
+ #LD_LIBRARY_PATH=$(RealFirebirdPath)/lib
+-LD_LIBRARY_PATH=$(LIB)
++LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(LIB)
+
+ #export ISC_USER
+ #export ISC_PASSWORD
diff --git a/external/firebird/firebird-macosx.patch.1 b/external/firebird/firebird-macosx.patch.1
new file mode 100644
index 000000000000..adede1c98688
--- /dev/null
+++ b/external/firebird/firebird-macosx.patch.1
@@ -0,0 +1,100 @@
+# -*- 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_TRAGET=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
+@@ -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
+ cp ../gen/firebird/lib/libfbclient.dylib $(FB_FW)/Versions/A/Libraries/libfbclient.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
+@@ -68,8 +68,8 @@
+ $(FB_FW)/Resources/English.lproj/var/intl/fbintl.conf
+ chmod a+rx $(FB_FW)/Resources/English.lproj/var/intl/fbintl
+ mkdir -p $(FB_FW)/Resources/English.lproj/var/plugins
+- cp ../gen/firebird/plugins/libfbtrace.dylib \
+- $(FB_FW)/Resources/English.lproj/var/plugins/libfbtrace.dylib
++# cp ../gen/firebird/plugins/libfbtrace.dylib \
++# $(FB_FW)/Resources/English.lproj/var/plugins/libfbtrace.dylib
+ 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
+@@ -19,7 +19,7 @@
+ # 4. for CFLAGS, CXXFLAGS, LDFLAGS export '-m32 -arch i386'
+ # 5. export MACOSX_DEPLOYMENT_TARGET=10.6
+
+-DYLD_LIBRARY_PATH=$(FIREBIRD)/lib
++DYLD_LIBRARY_PATH:=$(FIREBIRD)/lib:$(DYLD_LIBRARY_PATH)
+ export DYLD_LIBRARY_PATH
+
+ MACOSX_DEPLOYMENT_TARGET=10.6
+@@ -32,8 +32,8 @@
+
+ OS_ServerFiles=inet_server.cpp
+
+-PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common -arch i386 -mmacosx-version-min=10.6
+-DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -arch i386 -mmacosx-version-min=10.6
++PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common
++DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall
+ CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -fno-weak
+ EMBED_UTIL_TARGETS=gstat gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr
+ CLIENT_UTIL_TARGETS=gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \
+--- firebird.org/builds/posix/prefix.darwin_x86_64
++++ firebird/builds/posix/prefix.darwin_x86_64
+@@ -19,7 +19,7 @@
+ #
+ # Default build from 10.6
+
+-DYLD_LIBRARY_PATH=$(FIREBIRD)/lib
++DYLD_LIBRARY_PATH:=$(FIREBIRD)/lib:$(DYLD_LIBRARY_PATH)
+ export DYLD_LIBRARY_PATH
+
+ MACOSX_DEPLOYMENT_TARGET=10.6
+@@ -27,8 +27,8 @@
+
+ OS_ServerFiles=inet_server.cpp
+
+-PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common -mmacosx-version-min=10.6
+-DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -mmacosx-version-min=10.6
++PROD_FLAGS=-O1 -DDARWIN -pipe -p -MMD -fPIC -fno-common
++DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall
+ CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -fno-weak
+ EMBED_UTIL_TARGETS=gstat gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr
+ CLIENT_UTIL_TARGETS=gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \
diff --git a/external/firebird/firebird-rpath.patch.0 b/external/firebird/firebird-rpath.patch.0
new file mode 100644
index 000000000000..a92f0064b20f
--- /dev/null
+++ b/external/firebird/firebird-rpath.patch.0
@@ -0,0 +1,11 @@
+--- builds/posix/make.defaults
++++ builds/posix/make.defaults
+@@ -255,7 +255,7 @@
+
+ LIB_PLATFORM_RPATH = -Wl,-rpath,$(1)
+ ifeq ($(strip @BINRELOC_CFLAGS@),)
+-LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,$(if $(subst intl,,$(1)),@FB_LIBDIR@,@FB_INTLDIR@))
++LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$ORIGIN')
+ else
+ LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,'$$$$ORIGIN/../$(1)')
+ endif