summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-11-13 18:45:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-11-26 15:06:59 +0100
commit86744f03992213af162df6954313c9f9e44e3a0a (patch)
treeac3eb1d28ad78a81ad8d453c560415059540c0c0
parent952242a20cdc4a0248a95c1e1d61b1c213ae270a (diff)
firebird: update to 3.0.7
This tries to get rid of a lot of cruft from older builds and it also aims to build as much as possible on Windows. The firebird-cygwin-msvc-warnings.patch should be optional. It gets rid of various compiler warnings on Windows, either by disableing or fixing them: - fix: D9002 - ignoring unknown option '-fno-rtti' - fix: D9024 - unrecognized source file type <filename>, object file assumed - ign: C4291 - <declaration>: no matching operator delete found; memory will not be freed if initialization throws an exception - ign: C4477 - <function>: format string <string> requires an argument of type <type>, but variadic argument number has type <type> And I explicitly got rid of the "win32" handling and simply use arch depending patches on Windows, which strips additional stuff. sberg adds: I have no idea how in an upstream macOS build the empbuild executible in gen/examples should now find @rpath/lib/libfbclient.dylib, as it does not have an RPATH set. So add an appropriate one in external/firebird/firebird-macosx.patch.1's patch of builds/posix/Makefile.in.examples (which needs to know whether we do a Debug or a Release build; an attempt of using firebird's $(IsDeveloper) for that caused other failures, see bca0dc97bf3d1348c928bdaf4964524374835823 "Revert 'external/firebird: Pass --enable-developer into configure'", so use LO's $(ENABLE_DEBUG) and rely on that being exported from LO's make into firebird's make). Also, the fbclient and Engine12 dylibs now have RPATHs set which we do not need in LO (where we still stick to our general use of @loader_path), so drop them in external/firebird/ExternalProject_firebird.mk (even though leaving them in should be harmless). Change-Id: Id34bb88900d15f89adda03e34af2ac3d4f6aa085 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105440 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--download.lst4
-rw-r--r--external/firebird/0001-Avoid-hangup-in-SS-when-error-happens-at-system-atta.patch.151
-rw-r--r--external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.11013
-rw-r--r--external/firebird/ExternalPackage_firebird.mk4
-rw-r--r--external/firebird/ExternalProject_firebird.mk6
-rw-r--r--external/firebird/UnpackedTarball_firebird.mk8
-rw-r--r--external/firebird/asan.patch2
-rw-r--r--external/firebird/c++17.patch66
-rw-r--r--external/firebird/firebird-307.patch.112
-rw-r--r--external/firebird/firebird-cloop-compiler.patch.112
-rw-r--r--external/firebird/firebird-configure-x86-64-macosx.patch.120
-rw-r--r--external/firebird/firebird-cygwin-msvc-warnings.patch300
-rw-r--r--external/firebird/firebird-cygwin-msvc.patch236
-rw-r--r--external/firebird/firebird-gcc6.patch.119
-rw-r--r--external/firebird/firebird-macosx.patch.179
-rw-r--r--external/firebird/firebird-rpath.patch.04
-rw-r--r--external/firebird/firebird-vs2017.patch.19
-rw-r--r--external/firebird/libc++.patch11
-rw-r--r--external/firebird/macos-arm64.patch.010
-rw-r--r--external/firebird/sanitizer.patch23
-rw-r--r--external/firebird/ubsan.patch10
-rw-r--r--external/firebird/wnt-dbgutil.patch18
22 files changed, 551 insertions, 1366 deletions
diff --git a/download.lst b/download.lst
index aa49f99d3e33..bae2a7332c21 100644
--- a/download.lst
+++ b/download.lst
@@ -54,8 +54,8 @@ export ETONYEK_VERSION_MICRO := 9
export ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz
export EXPAT_SHA256SUM := 9a130948b05a82da34e4171d5f5ae5d321d9630277af02c8fa51e431f6475102
export EXPAT_TARBALL := expat-2.2.8.tar.bz2
-export FIREBIRD_SHA256SUM := 6994be3555e23226630c587444be19d309b25b0fcf1f87df3b4e3f88943e5860
-export FIREBIRD_TARBALL := Firebird-3.0.0.32483-0.tar.bz2
+export FIREBIRD_SHA256SUM := acb85cedafa10ce106b1823fb236b1b3e5d942a5741e8f8435cc8ccfec0afe76
+export FIREBIRD_TARBALL := Firebird-3.0.7.33374-0.tar.bz2
export FONTCONFIG_SHA256SUM := 19e5b1bc9d013a52063a44e1307629711f0bfef35b9aca16f9c793971e2eb1e5
export FONTCONFIG_TARBALL := fontconfig-2.13.91.tar.gz
export FONT_CALADEA_SHA256SUM := c48d1c2fd613c9c06c959c34da7b8388059e2408d2bb19845dc3ed35f76e4d09
diff --git a/external/firebird/0001-Avoid-hangup-in-SS-when-error-happens-at-system-atta.patch.1 b/external/firebird/0001-Avoid-hangup-in-SS-when-error-happens-at-system-atta.patch.1
deleted file mode 100644
index e569fccdced6..000000000000
--- a/external/firebird/0001-Avoid-hangup-in-SS-when-error-happens-at-system-atta.patch.1
+++ /dev/null
@@ -1,51 +0,0 @@
-From 36a7a2634669075be3294a1d075524a0b6f80962 Mon Sep 17 00:00:00 2001
-From: hvlad <hvlad@users.sourceforge.net>
-Date: Wed, 17 Aug 2016 15:45:30 +0300
-Subject: [PATCH] Avoid hangup in SS when error happens at system attachment
- initialization time
-
----
- src/jrd/cch.cpp | 7 ++++++-
- src/jrd/vio.cpp | 5 +++++
- 2 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp
-index 35ea096..643cf4d 100644
---- a/src/jrd/cch.cpp
-+++ b/src/jrd/cch.cpp
-@@ -2963,10 +2963,15 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
- iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector);
- }
-
-- bcb->bcb_flags &= ~(BCB_cache_writer | BCB_writer_start);
-+ bcb->bcb_flags &= ~BCB_cache_writer;
-
- try
- {
-+ if (bcb->bcb_flags & BCB_writer_start)
-+ {
-+ bcb->bcb_flags &= ~BCB_writer_start;
-+ bcb->bcb_writer_init.release();
-+ }
- bcb->bcb_writer_fini.release();
- }
- catch (const Firebird::Exception& ex)
-diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp
-index a8cf0fc..3d35a27 100644
---- a/src/jrd/vio.cpp
-+++ b/src/jrd/vio.cpp
-@@ -4988,6 +4988,11 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
- try
- {
- // Notify the finalization caller that we're finishing.
-+ if (dbb->dbb_flags & DBB_gc_starting)
-+ {
-+ dbb->dbb_flags &= ~DBB_gc_starting;
-+ dbb->dbb_gc_init.release();
-+ }
- dbb->dbb_gc_fini.release();
- }
- catch (const Firebird::Exception& ex)
---
-2.9.3
-
diff --git a/external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.1 b/external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.1
deleted file mode 100644
index c55df4d0ae71..000000000000
--- a/external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.1
+++ /dev/null
@@ -1,1013 +0,0 @@
-From 40f782ae3e918c4f3842571ff8064be1c4f54961 Mon Sep 17 00:00:00 2001
-From: AlexPeshkoff <peshkoff@mail.ru>
-Date: Fri, 13 Jan 2017 14:29:54 +0300
-Subject: [PATCH] Backported fix for CORE-5452: Segfault when engine's dynamic
- library is unloaded right after closing worker threads (GC and/or cache
- writer)
-
----
- src/alice/alice_meta.epp | 1 -
- src/burp/burp.h | 2 -
- src/common/ThreadStart.h | 86 ++++++++++++++++++++++++++++
- src/common/classes/Synchronize.h | 5 +-
- src/common/classes/misc/class_perf.cpp | 1 -
- src/common/xdr.cpp | 2 -
- src/gpre/boot/gpre_meta_boot.cpp | 1 -
- src/gpre/std/gpre_meta.epp | 1 -
- src/include/fb_exception.h | 1 -
- src/include/firebird.h | 1 -
- src/isql/OptionsBase.cpp | 1 -
- src/isql/extract.epp | 1 -
- src/isql/isql.epp | 5 --
- src/jrd/Attachment.h | 1 +
- src/jrd/Database.h | 6 +-
- src/jrd/Mapping.cpp | 26 +++++----
- src/jrd/cch.cpp | 31 +++++-----
- src/jrd/cch.h | 14 ++++-
- src/jrd/event.cpp | 13 +++--
- src/jrd/event_proto.h | 7 +--
- src/jrd/intl.cpp | 1 -
- src/jrd/trace/TraceConfigStorage.h | 1 +
- src/jrd/vio.cpp | 23 ++++----
- src/lock/lock.cpp | 29 ++++++----
- src/lock/lock_proto.h | 8 +--
- src/qli/command.cpp | 1 -
- src/qli/dtr.h | 1 -
- src/qli/lex.cpp | 4 --
- src/qli/meta.epp | 1 -
- src/utilities/gsec/gsecswi.h | 1 -
- src/utilities/gstat/dba.epp | 1 +
- src/utilities/nbackup/nbkswi.h | 1 -
- src/utilities/ntrace/os/win32/FileObject.cpp | 1 -
- src/yvalve/gds.cpp | 1 +
- src/yvalve/preparse.cpp | 1 -
- 35 files changed, 182 insertions(+), 99 deletions(-)
-
-diff --git a/src/alice/alice_meta.epp b/src/alice/alice_meta.epp
-index d0f59bc..65dc37e 100644
---- a/src/alice/alice_meta.epp
-+++ b/src/alice/alice_meta.epp
-@@ -30,7 +30,6 @@
- #include "firebird.h"
- #include <stdio.h>
- #include "../jrd/ibase.h"
--//#include "../jrd/license.h"
- #include "../alice/alice.h"
- #include "../alice/alice_meta.h"
- #include "../yvalve/gds_proto.h"
-diff --git a/src/burp/burp.h b/src/burp/burp.h
-index 293a91f..fe26335 100644
---- a/src/burp/burp.h
-+++ b/src/burp/burp.h
-@@ -769,8 +769,6 @@ struct burp_meta_obj
- // I need to review if we tolerate different lengths for different OS's here.
- const unsigned int MAX_FILE_NAME_SIZE = 256;
-
--//#include "../jrd/svc.h"
--
- #include "../burp/std_desc.h"
-
- #ifdef WIN_NT
-diff --git a/src/common/ThreadStart.h b/src/common/ThreadStart.h
-index 85e6a38..823c5c1 100644
---- a/src/common/ThreadStart.h
-+++ b/src/common/ThreadStart.h
-@@ -31,6 +31,7 @@
- #define JRD_THREADSTART_H
-
- #include "../common/ThreadData.h"
-+#include "../common/classes/semaphore.h"
-
- #ifdef WIN_NT
- #include <windows.h>
-@@ -89,4 +90,89 @@ inline ThreadId getThreadId()
- return Thread::getId();
- }
-
-+
-+#ifndef USE_POSIX_THREADS
-+#define USE_FINI_SEM
-+#endif
-+
-+template <typename TA>
-+class ThreadFinishSync
-+{
-+public:
-+ typedef void ThreadRoutine(TA);
-+
-+ ThreadFinishSync(Firebird::MemoryPool& pool, ThreadRoutine* routine, int priority_arg)
-+ :
-+#ifdef USE_FINI_SEM
-+ fini(pool),
-+#else
-+ threadHandle(0),
-+#endif
-+ threadRoutine(routine),
-+ threadPriority(priority_arg)
-+ { }
-+
-+ void run(TA arg)
-+ {
-+ threadArg = arg;
-+
-+ Thread::start(internalRun, this, threadPriority
-+#ifndef USE_FINI_SEM
-+ , &threadHandle
-+#endif
-+ );
-+ }
-+
-+ void waitForCompletion()
-+ {
-+#ifdef USE_FINI_SEM
-+ fini.enter();
-+#else
-+ Thread::waitForCompletion(threadHandle);
-+ threadHandle = 0;
-+#endif
-+ }
-+
-+private:
-+#ifdef USE_FINI_SEM
-+ Firebird::Semaphore fini;
-+#else
-+ Thread::Handle threadHandle;
-+#endif
-+
-+ TA threadArg;
-+ ThreadRoutine* threadRoutine;
-+ int threadPriority;
-+ bool starting;
-+
-+ static THREAD_ENTRY_DECLARE internalRun(THREAD_ENTRY_PARAM arg)
-+ {
-+ ((ThreadFinishSync*)arg)->internalRun();
-+ return 0;
-+ }
-+
-+ void internalRun()
-+ {
-+ try
-+ {
-+ threadRoutine(threadArg);
-+ }
-+ catch (const Firebird::Exception& ex)
-+ {
-+ threadArg->exceptionHandler(ex, threadRoutine);
-+ }
-+
-+#ifdef USE_FINI_SEM
-+ try
-+ {
-+ fini.release();
-+ }
-+ catch (const Firebird::Exception& ex)
-+ {
-+ threadArg->exceptionHandler(ex, threadRoutine);
-+ }
-+#endif
-+ }
-+};
-+
- #endif // JRD_THREADSTART_H
-diff --git a/src/common/classes/Synchronize.h b/src/common/classes/Synchronize.h
-index 198de44..3788541 100644
---- a/src/common/classes/Synchronize.h
-+++ b/src/common/classes/Synchronize.h
-@@ -33,10 +33,7 @@
- #define CLASSES_SYNCHRONIZE_H
-
- #include "../common/classes/SyncObject.h"
--
--#ifndef WIN_NT
--#include "fb_pthread.h"
--#endif
-+#include "../common/ThreadStart.h"
-
-
- namespace Firebird {
-diff --git a/src/common/classes/misc/class_perf.cpp b/src/common/classes/misc/class_perf.cpp
-index 97b7bb3..142bfde 100644
---- a/src/common/classes/misc/class_perf.cpp
-+++ b/src/common/classes/misc/class_perf.cpp
-@@ -28,7 +28,6 @@
-
- #include "tree.h"
- #include "alloc.h"
--//#include "../memory/memory_pool.h"
- #include <stdio.h>
- #include <time.h>
- #include <set>
-diff --git a/src/common/xdr.cpp b/src/common/xdr.cpp
-index b9f9f4d..1dfff76 100644
---- a/src/common/xdr.cpp
-+++ b/src/common/xdr.cpp
-@@ -26,9 +26,7 @@
-
- #include "firebird.h"
- #include <string.h>
--//#include "../remote/remote.h"
- #include "../common/xdr.h"
--//#include "../remote/proto_proto.h"
- #include "../common/xdr_proto.h"
- #include "../yvalve/gds_proto.h"
- #include "../common/gdsassert.h"
-diff --git a/src/gpre/boot/gpre_meta_boot.cpp b/src/gpre/boot/gpre_meta_boot.cpp
-index 0fde018..1f302c6 100644
---- a/src/gpre/boot/gpre_meta_boot.cpp
-+++ b/src/gpre/boot/gpre_meta_boot.cpp
-@@ -32,7 +32,6 @@
- #include <string.h>
- #include "../jrd/ibase.h"
- #include "../gpre/gpre.h"
--//#include "../jrd/license.h"
- #include "../jrd/intl.h"
- #include "../gpre/gpre_proto.h"
- #include "../gpre/hsh_proto.h"
-diff --git a/src/gpre/std/gpre_meta.epp b/src/gpre/std/gpre_meta.epp
-index 34ff932..0780dd4 100644
---- a/src/gpre/std/gpre_meta.epp
-+++ b/src/gpre/std/gpre_meta.epp
-@@ -32,7 +32,6 @@
- #include <string.h>
- #include "../jrd/ibase.h"
- #include "../gpre/gpre.h"
--//#include "../jrd/license.h"
- #include "../jrd/intl.h"
- #include "../gpre/gpre_proto.h"
- #include "../gpre/hsh_proto.h"
-diff --git a/src/include/fb_exception.h b/src/include/fb_exception.h
-index 030cf94..c4c1df4 100644
---- a/src/include/fb_exception.h
-+++ b/src/include/fb_exception.h
-@@ -43,7 +43,6 @@
-
- #include "fb_types.h"
- #include "firebird/Interface.h"
--#include "../common/ThreadStart.h"
-
- namespace Firebird
- {
-diff --git a/src/include/firebird.h b/src/include/firebird.h
-index 3d74354..87f0a11 100644
---- a/src/include/firebird.h
-+++ b/src/include/firebird.h
-@@ -68,7 +68,6 @@
-
- #ifdef __cplusplus
- #include "../common/common.h"
--//#include "fb_exception.h"
- #endif
-
- #ifndef NULL
-diff --git a/src/isql/OptionsBase.cpp b/src/isql/OptionsBase.cpp
-index 5a78540..0974fa3 100644
---- a/src/isql/OptionsBase.cpp
-+++ b/src/isql/OptionsBase.cpp
-@@ -24,7 +24,6 @@
-
- #include "firebird.h"
- #include "OptionsBase.h"
--//#include "../common/utils_proto.h" // strnicmp
- #include "../common/gdsassert.h"
-
-
-diff --git a/src/isql/extract.epp b/src/isql/extract.epp
-index ec2ddb1..99e821c 100644
---- a/src/isql/extract.epp
-+++ b/src/isql/extract.epp
-@@ -59,7 +59,6 @@
- #include "../jrd/ods.h"
- #include "../common/utils_proto.h"
- #include "../jrd/constants.h"
--//#include "../common/classes/ImplementHelper.h"
-
- using MsgFormat::SafeArg;
-
-diff --git a/src/isql/isql.epp b/src/isql/isql.epp
-index ccadce2..98b37bb 100644
---- a/src/isql/isql.epp
-+++ b/src/isql/isql.epp
-@@ -46,7 +46,6 @@
- #include "firebird.h"
- #include <stdio.h>
- #include "../yvalve/keywords.h"
--//#include "../yvalve/gds_proto.h"
- #include "../jrd/intl.h"
- #include <stdlib.h>
- #include <stdarg.h>
-@@ -79,10 +78,6 @@
- #include <locale.h>
- #endif
-
--//#ifdef HAVE_IO_H
--//#include <io.h> // mktemp
--//#endif
--
- #ifdef HAVE_EDITLINE_H
- // This is a local file included in our distribution - but not always
- // compiled into the system
-diff --git a/src/jrd/Attachment.h b/src/jrd/Attachment.h
-index 2807db3..e71610e 100644
---- a/src/jrd/Attachment.h
-+++ b/src/jrd/Attachment.h
-@@ -39,6 +39,7 @@
- #include "../common/classes/array.h"
- #include "../common/classes/stack.h"
- #include "../common/classes/timestamp.h"
-+#include "../common/ThreadStart.h"
-
- #include "../jrd/EngineInterface.h"
-
-diff --git a/src/jrd/Database.h b/src/jrd/Database.h
-index 0eab40d..f0f44d3 100644
---- a/src/jrd/Database.h
-+++ b/src/jrd/Database.h
-@@ -440,7 +440,7 @@ public:
- GarbageCollector* dbb_garbage_collector; // GarbageCollector class
- Firebird::Semaphore dbb_gc_sem; // Event to wake up garbage collector
- Firebird::Semaphore dbb_gc_init; // Event for initialization garbage collector
-- Firebird::Semaphore dbb_gc_fini; // Event for finalization garbage collector
-+ ThreadFinishSync<Database*> dbb_gc_fini; // Sync for finalization garbage collector
-
- Firebird::MemoryStats dbb_memory_stats;
- RuntimeStatistics dbb_stats;
-@@ -511,6 +511,7 @@ private:
- dbb_owner(*p),
- dbb_pools(*p, 4),
- dbb_sort_buffers(*p),
-+ dbb_gc_fini(*p, garbage_collector, THREAD_medium),
- dbb_stats(*p),
- dbb_lock_owner_id(getLockOwnerId()),
- dbb_tip_cache(NULL),
-@@ -560,6 +561,9 @@ public:
- // reset sweep flags and release sweep lock
- void clearSweepFlags(thread_db* tdbb);
-
-+ static void garbage_collector(Database* dbb);
-+ void exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<Database*>::ThreadRoutine* routine);
-+
- private:
- //static int blockingAstSharedCounter(void*);
- static int blocking_ast_sweep(void* ast_object);
-diff --git a/src/jrd/Mapping.cpp b/src/jrd/Mapping.cpp
-index c1bcf0e..8df7e2f 100644
---- a/src/jrd/Mapping.cpp
-+++ b/src/jrd/Mapping.cpp
-@@ -581,7 +581,8 @@ class MappingIpc FB_FINAL : public Firebird::IpcObject
-
- public:
- explicit MappingIpc(MemoryPool&)
-- : processId(getpid())
-+ : processId(getpid()),
-+ cleanupSync(*getDefaultMemoryPool(), clearDelivery, THREAD_high)
- { }
-
- ~MappingIpc()
-@@ -602,7 +603,7 @@ public:
- sMem->process[process].flags &= ~MappingHeader::FLAG_ACTIVE;
- (void) // Ignore errors in cleanup
- sharedMemory->eventPost(&sMem->process[process].notifyEvent);
-- cleanupSemaphore.tryEnter(5);
-+ cleanupSync.waitForCompletion();
-
- // Ignore errors in cleanup
- sharedMemory->eventFini(&sMem->process[process].notifyEvent);
-@@ -755,7 +756,7 @@ public:
-
- try
- {
-- Thread::start(clearDelivery, this, THREAD_high);
-+ cleanupSync.run(this);
- }
- catch (const Exception&)
- {
-@@ -764,6 +765,12 @@ public:
- }
- }
-
-+ void exceptionHandler(const Exception& ex, ThreadFinishSync<MappingIpc*>::ThreadRoutine*)
-+ {
-+ iscLogException("Fatal error in clearDeliveryThread", ex);
-+ fb_utils::logAndDie("Fatal error in clearDeliveryThread");
-+ }
-+
- private:
- void clearDeliveryThread()
- {
-@@ -801,13 +808,10 @@ private:
- }
- if (startup)
- startupSemaphore.release();
--
-- cleanupSemaphore.release();
- }
- catch (const Exception& ex)
- {
-- iscLogException("Fatal error in clearDeliveryThread", ex);
-- fb_utils::logAndDie("Fatal error in clearDeliveryThread");
-+ exceptionHandler(ex, NULL);
- }
- }
-
-@@ -862,11 +866,9 @@ private:
- MappingIpc* const data;
- };
-
-- static THREAD_ENTRY_DECLARE clearDelivery(THREAD_ENTRY_PARAM par)
-+ static void clearDelivery(MappingIpc* mapping)
- {
-- MappingIpc* m = (MappingIpc*)par;
-- m->clearDeliveryThread();
-- return 0;
-+ mapping->clearDeliveryThread();
- }
-
- AutoPtr<SharedMemory<MappingHeader> > sharedMemory;
-@@ -874,7 +876,7 @@ private:
- const SLONG processId;
- unsigned process;
- Semaphore startupSemaphore;
-- Semaphore cleanupSemaphore;
-+ ThreadFinishSync<MappingIpc*> cleanupSync;
- };
-
- GlobalPtr<MappingIpc, InstanceControl::PRIORITY_DELETE_FIRST> mappingIpc;
-diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp
-index e1d403b..1bf714f 100644
---- a/src/jrd/cch.cpp
-+++ b/src/jrd/cch.cpp
-@@ -120,14 +120,11 @@ static BufferDesc* alloc_bdb(thread_db*, BufferControl*, UCHAR **);
- static Lock* alloc_page_lock(Jrd::thread_db*, BufferDesc*);
- static int blocking_ast_bdb(void*);
- #ifdef CACHE_READER
--static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM);
--
- static void prefetch_epilogue(Prefetch*, FbStatusVector *);
- static void prefetch_init(Prefetch*, thread_db*);
- static void prefetch_io(Prefetch*, FbStatusVector *);
- static void prefetch_prologue(Prefetch*, SLONG *);
- #endif
--static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM);
- static void check_precedence(thread_db*, WIN*, PageNumber);
- static void clear_precedence(thread_db*, BufferDesc*);
- static BufferDesc* dealloc_bdb(BufferDesc*);
-@@ -1438,7 +1435,7 @@ void CCH_init2(thread_db* tdbb)
-
- try
- {
-- Thread::start(cache_writer, dbb, THREAD_medium);
-+ bcb->bcb_writer_fini.run(bcb);
- }
- catch (const Exception&)
- {
-@@ -2017,7 +2014,7 @@ void CCH_shutdown(thread_db* tdbb)
- {
- bcb->bcb_flags &= ~BCB_cache_writer;
- bcb->bcb_writer_sem.release(); // Wake up running thread
-- bcb->bcb_writer_fini.enter();
-+ bcb->bcb_writer_fini.waitForCompletion();
- }
-
- SyncLockGuard bcbSync(&bcb->bcb_syncObject, SYNC_EXCLUSIVE, "CCH_shutdown");
-@@ -2692,7 +2689,7 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag)
-
-
- #ifdef CACHE_READER
--static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
-+void BufferControl::cache_reader(BufferControl* bcb)
- {
- /**************************************
- *
-@@ -2706,7 +2703,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
- * busy at a time.
- *
- **************************************/
-- Database* dbb = (Database*) arg;
-+ Database* dbb = bcb->bcb_database;
- Database::SyncGuard dsGuard(dbb);
-
- FbLocalStatus status_vector;
-@@ -2846,7 +2843,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
- #endif
-
-
--static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
-+void BufferControl::cache_writer(BufferControl* bcb)
- {
- /**************************************
- *
-@@ -2859,8 +2856,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
- *
- **************************************/
- FbLocalStatus status_vector;
-- Database* const dbb = (Database*) arg;
-- BufferControl* const bcb = dbb->dbb_bcb;
-+ Database* const dbb = bcb->bcb_database;
-
- try
- {
-@@ -2964,8 +2960,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
- } // try
- catch (const Firebird::Exception& ex)
- {
-- ex.stuffException(&status_vector);
-- iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector);
-+ bcb->exceptionHandler(ex, cache_writer);
- }
-
- bcb->bcb_flags &= ~BCB_cache_writer;
-@@ -2977,15 +2972,19 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
- bcb->bcb_flags &= ~BCB_writer_start;
- bcb->bcb_writer_init.release();
- }
-- bcb->bcb_writer_fini.release();
- }
- catch (const Firebird::Exception& ex)
- {
-- ex.stuffException(&status_vector);
-- iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector);
-+ bcb->exceptionHandler(ex, cache_writer);
- }
-+}
-
-- return 0;
-+
-+void BufferControl::exceptionHandler(const Firebird::Exception& ex, BcbSync::ThreadRoutine* /*routine*/)
-+{
-+ FbLocalStatus status_vector;
-+ ex.stuffException(&status_vector);
-+ iscDbLogStatus(bcb_database->dbb_filename.c_str(), &status_vector);
- }
-
-
-diff --git a/src/jrd/cch.h b/src/jrd/cch.h
-index b920566..b7f8486 100644
---- a/src/jrd/cch.h
-+++ b/src/jrd/cch.h
-@@ -29,6 +29,7 @@
- #include "../common/classes/RefCounted.h"
- #include "../common/classes/semaphore.h"
- #include "../common/classes/SyncObject.h"
-+#include "../common/ThreadStart.h"
- #ifdef SUPERSERVER_V2
- #include "../jrd/sbm.h"
- #include "../jrd/pag.h"
-@@ -85,7 +86,8 @@ class BufferControl : public pool_alloc<type_bcb>
- BufferControl(MemoryPool& p, Firebird::MemoryStats& parentStats)
- : bcb_bufferpool(&p),
- bcb_memory_stats(&parentStats),
-- bcb_memory(p)
-+ bcb_memory(p),
-+ bcb_writer_fini(p, cache_writer, THREAD_medium)
- {
- bcb_database = NULL;
- QUE_INIT(bcb_in_use);
-@@ -144,18 +146,24 @@ public:
- Firebird::SyncObject bcb_syncLRU;
- //Firebird::SyncObject bcb_syncPageWrite;
-
-+ typedef ThreadFinishSync<BufferControl*> BcbSync;
-+
-+ static void cache_writer(BufferControl* bcb);
- Firebird::Semaphore bcb_writer_sem; // Wake up cache writer
- Firebird::Semaphore bcb_writer_init; // Cache writer initialization
-- Firebird::Semaphore bcb_writer_fini; // Cache writer finalization
-+ BcbSync bcb_writer_fini; // Cache writer finalization
- #ifdef SUPERSERVER_V2
-+ static void cache_reader(BufferControl* bcb);
- // the code in cch.cpp is not tested for semaphore instead event !!!
- Firebird::Semaphore bcb_reader_sem; // Wake up cache reader
- Firebird::Semaphore bcb_reader_init; // Cache reader initialization
-- Firebird::Semaphore bcb_reader_fini; // Cache reader finalization
-+ BcbSync bcb_reader_fini; // Cache reader finalization
-
- PageBitmap* bcb_prefetch; // Bitmap of pages to prefetch
- #endif
-
-+ void exceptionHandler(const Firebird::Exception& ex, BcbSync::ThreadRoutine* routine);
-+
- bcb_repeat* bcb_rpt;
- };
-
-diff --git a/src/jrd/event.cpp b/src/jrd/event.cpp
-index 3a6bf28..cb6dc33 100644
---- a/src/jrd/event.cpp
-+++ b/src/jrd/event.cpp
-@@ -126,6 +126,7 @@ EventManager::EventManager(const Firebird::string& id, Firebird::RefPtr<Config>
- m_processOffset(0),
- m_dbId(getPool(), id),
- m_config(conf),
-+ m_cleanupSync(getPool(), watcher_thread, THREAD_medium),
- m_sharedFileCreated(false),
- m_exiting(false)
- {
-@@ -146,7 +147,7 @@ EventManager::~EventManager()
- // Terminate the event watcher thread
- m_startupSemaphore.tryEnter(5);
- (void) m_sharedMemory->eventPost(&m_process->prb_event);
-- m_cleanupSemaphore.tryEnter(5);
-+ m_cleanupSync.waitForCompletion();
-
- #ifdef HAVE_OBJECT_MAP
- m_sharedMemory->unmapObject(&localStatus, &m_process);
-@@ -697,7 +698,7 @@ void EventManager::create_process()
-
- release_shmem();
-
-- Thread::start(watcher_thread, this, THREAD_medium);
-+ m_cleanupSync.run(this);
- }
-
-
-@@ -1414,12 +1415,16 @@ void EventManager::watcher_thread()
- {
- m_startupSemaphore.release();
- }
-- m_cleanupSemaphore.release();
- }
- catch (const Firebird::Exception& ex)
- {
-- iscLogException("Error closing event watcher thread\n", ex);
-+ exceptionHandler(ex, NULL);
- }
- }
-
-+void EventManager::exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<EventManager*>::ThreadRoutine*)
-+{
-+ iscLogException("Error closing event watcher thread\n", ex);
-+}
-+
- } // namespace
-diff --git a/src/jrd/event_proto.h b/src/jrd/event_proto.h
-index 3301203..9bfd20e 100644
---- a/src/jrd/event_proto.h
-+++ b/src/jrd/event_proto.h
-@@ -63,6 +63,7 @@ public:
-
- bool initialize(Firebird::SharedMemoryBase*, bool);
- void mutexBug(int osErrorCode, const char* text);
-+ void exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<EventManager*>::ThreadRoutine* routine);
-
- private:
- void acquire_shmem();
-@@ -91,11 +92,9 @@ private:
- void detach_shared_file();
- void get_shared_file_name(Firebird::PathName&) const;
-
-- static THREAD_ENTRY_DECLARE watcher_thread(THREAD_ENTRY_PARAM arg)
-+ static void watcher_thread(EventManager* eventMgr)
- {
-- EventManager* const eventMgr = static_cast<EventManager*>(arg);
- eventMgr->watcher_thread();
-- return 0;
- }
-
- static void mutex_bugcheck(const TEXT*, int);
-@@ -109,7 +108,7 @@ private:
- Firebird::AutoPtr<Firebird::SharedMemory<evh> > m_sharedMemory;
-
- Firebird::Semaphore m_startupSemaphore;
-- Firebird::Semaphore m_cleanupSemaphore;
-+ ThreadFinishSync<EventManager*> m_cleanupSync;
-
- bool m_sharedFileCreated;
- bool m_exiting;
-diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp
-index 6666c5f..b0e662b 100644
---- a/src/jrd/intl.cpp
-+++ b/src/jrd/intl.cpp
-@@ -104,7 +104,6 @@
- #include "../intl/charsets.h"
- #include "../intl/country_codes.h"
- #include "../common/gdsassert.h"
--//#include "../jrd/license.h"
- #ifdef INTL_BUILTIN
- #include "../intl/ld_proto.h"
- #endif
-diff --git a/src/jrd/trace/TraceConfigStorage.h b/src/jrd/trace/TraceConfigStorage.h
-index ca973c0..3d08143 100644
---- a/src/jrd/trace/TraceConfigStorage.h
-+++ b/src/jrd/trace/TraceConfigStorage.h
-@@ -32,6 +32,7 @@
- #include "../../common/classes/fb_string.h"
- #include "../../common/classes/init.h"
- #include "../../common/isc_s_proto.h"
-+#include "../../common/ThreadStart.h"
- #include "../../jrd/trace/TraceSession.h"
- #include "../../common/classes/RefCounted.h"
-
-diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp
-index 02c5809..8ca9f66 100644
---- a/src/jrd/vio.cpp
-+++ b/src/jrd/vio.cpp
-@@ -107,7 +107,6 @@ static bool dfw_should_know(record_param* org_rpb, record_param* new_rpb,
- USHORT irrelevant_field, bool void_update_is_relevant = false);
- static void garbage_collect(thread_db*, record_param*, ULONG, RecordStack&);
- static void garbage_collect_idx(thread_db*, record_param*, Record*, Record*);
--static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM);
-
-
- #ifdef VIO_DEBUG
-@@ -1958,7 +1957,7 @@ void VIO_fini(thread_db* tdbb)
- {
- dbb->dbb_flags &= ~DBB_garbage_collector;
- dbb->dbb_gc_sem.release(); // Wake up running thread
-- dbb->dbb_gc_fini.enter();
-+ dbb->dbb_gc_fini.waitForCompletion();
- }
- }
-
-@@ -2420,7 +2419,7 @@ void VIO_init(thread_db* tdbb)
- {
- try
- {
-- Thread::start(garbage_collector, dbb, THREAD_medium);
-+ dbb->dbb_gc_fini.run(dbb);
- }
- catch (const Exception&)
- {
-@@ -4741,7 +4740,7 @@ static void garbage_collect_idx(thread_db* tdbb,
- }
-
-
--static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
-+void Database::garbage_collector(Database* dbb)
- {
- /**************************************
- *
-@@ -4758,7 +4757,6 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
- *
- **************************************/
- FbLocalStatus status_vector;
-- Database* const dbb = (Database*) arg;
-
- try
- {
-@@ -4989,8 +4987,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
- } // try
- catch (const Firebird::Exception& ex)
- {
-- ex.stuffException(&status_vector);
-- iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector);
-+ dbb->exceptionHandler(ex, NULL);
- }
-
- dbb->dbb_flags &= ~(DBB_garbage_collector | DBB_gc_active | DBB_gc_pending);
-@@ -5003,15 +5000,19 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
- dbb->dbb_flags &= ~DBB_gc_starting;
- dbb->dbb_gc_init.release();
- }
-- dbb->dbb_gc_fini.release();
- }
- catch (const Firebird::Exception& ex)
- {
-- ex.stuffException(&status_vector);
-- iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector);
-+ dbb->exceptionHandler(ex, NULL);
- }
-+}
-+
-
-- return 0;
-+void Database::exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<Database*>::ThreadRoutine* /*routine*/)
-+{
-+ FbLocalStatus status_vector;
-+ ex.stuffException(&status_vector);
-+ iscDbLogStatus(dbb_filename.c_str(), &status_vector);
- }
-
-
-diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp
-index 89eb4c5..2ab3358 100644
---- a/src/lock/lock.cpp
-+++ b/src/lock/lock.cpp
-@@ -214,6 +214,7 @@ LockManager::LockManager(const Firebird::string& id, RefPtr<Config> conf)
- m_sharedFileCreated(false),
- m_process(NULL),
- m_processOffset(0),
-+ m_cleanupSync(getPool(), blocking_action_thread, THREAD_high),
- m_sharedMemory(NULL),
- m_blockage(false),
- m_dbId(getPool(), id),
-@@ -259,7 +260,7 @@ LockManager::~LockManager()
- m_sharedMemory->eventPost(&m_process->prc_blocking);
-
- // Wait for the AST thread to finish cleanup or for 5 seconds
-- m_cleanupSemaphore.tryEnter(5);
-+ m_cleanupSync.waitForCompletion();
- }
-
- #ifdef HAVE_OBJECT_MAP
-@@ -1548,16 +1549,22 @@ void LockManager::blocking_action_thread()
- {
- iscLogException("Error in blocking action thread\n", x);
- }
-+}
-
-- try
-- {
-- // Wakeup the main thread waiting for our exit
-- m_cleanupSemaphore.release();
-- }
-- catch (const Firebird::Exception& x)
-- {
-- iscLogException("Error closing blocking action thread\n", x);
-- }
-+
-+void LockManager::exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<LockManager*>::ThreadRoutine* /*routine*/)
-+{
-+/**************************************
-+ *
-+ * e x c e p t i o n H a n d l e r
-+ *
-+ **************************************
-+ *
-+ * Functional description
-+ * Handler for blocking thread close bugs.
-+ *
-+ **************************************/
-+ iscLogException("Error closing blocking action thread\n", ex);
- }
-
-
-@@ -1815,7 +1822,7 @@ bool LockManager::create_process(CheckStatusWrapper* statusVector)
- {
- try
- {
-- Thread::start(blocking_action_thread, this, THREAD_high);
-+ m_cleanupSync.run(this);
- }
- catch (const Exception& ex)
- {
-diff --git a/src/lock/lock_proto.h b/src/lock/lock_proto.h
-index d991c1e..2faec49 100644
---- a/src/lock/lock_proto.h
-+++ b/src/lock/lock_proto.h
-@@ -418,6 +418,8 @@ public:
- SINT64 readData2(USHORT, const UCHAR*, USHORT, SRQ_PTR);
- SINT64 writeData(SRQ_PTR, SINT64);
-
-+ void exceptionHandler(const Firebird::Exception& ex, ThreadFinishSync<LockManager*>::ThreadRoutine* routine);
-+
- private:
- explicit LockManager(const Firebird::string&, Firebird::RefPtr<Config>);
- ~LockManager();
-@@ -471,11 +473,9 @@ private:
- void detach_shared_file(Firebird::CheckStatusWrapper*);
- void get_shared_file_name(Firebird::PathName&, ULONG extend = 0) const;
-
-- static THREAD_ENTRY_DECLARE blocking_action_thread(THREAD_ENTRY_PARAM arg)
-+ static void blocking_action_thread(LockManager* lockMgr)
- {
-- LockManager* const lockMgr = static_cast<LockManager*>(arg);
- lockMgr->blocking_action_thread();
-- return 0;
- }
-
- bool initialize(Firebird::SharedMemoryBase* sm, bool init);
-@@ -490,7 +490,7 @@ private:
- Firebird::RWLock m_remapSync;
- Firebird::AtomicCounter m_waitingOwners;
-
-- Firebird::Semaphore m_cleanupSemaphore;
-+ ThreadFinishSync<LockManager*> m_cleanupSync;
- Firebird::Semaphore m_startupSemaphore;
-
- public:
-diff --git a/src/qli/command.cpp b/src/qli/command.cpp
-index 5f949f3..fbbf4fb 100644
---- a/src/qli/command.cpp
-+++ b/src/qli/command.cpp
-@@ -30,7 +30,6 @@
- #include "../qli/parse.h"
- #include "../qli/compile.h"
- #include "../qli/exe.h"
--//#include "../jrd/license.h"
- #include "../qli/all_proto.h"
- #include "../qli/err_proto.h"
- #include "../qli/exe_proto.h"
-diff --git a/src/qli/dtr.h b/src/qli/dtr.h
-index ba5cd64..e246ef4 100644
---- a/src/qli/dtr.h
-+++ b/src/qli/dtr.h
-@@ -480,7 +480,6 @@ struct qli_fun
- };
-
- // Program wide globals
--//#include <setjmp.h>
-
- #ifdef QLI_MAIN
- #define EXTERN
-diff --git a/src/qli/lex.cpp b/src/qli/lex.cpp
-index c20d1f9..9e26046 100644
---- a/src/qli/lex.cpp
-+++ b/src/qli/lex.cpp
-@@ -50,10 +50,6 @@ using MsgFormat::SafeArg;
- #include <unistd.h>
- #endif
-
--//#ifdef HAVE_CTYPES_H
--//#include <ctypes.h>
--//#endif
--
- #ifdef HAVE_IO_H
- #include <io.h> // isatty
- #endif
-diff --git a/src/qli/meta.epp b/src/qli/meta.epp
-index a7f222c..2d55716 100644
---- a/src/qli/meta.epp
-+++ b/src/qli/meta.epp
-@@ -28,7 +28,6 @@
- #include "../qli/dtr.h"
- #include "../qli/compile.h"
- #include "../qli/exe.h"
--//#include "../jrd/license.h"
- #include "../jrd/flags.h"
- #include "../jrd/ibase.h"
- #include "../qli/reqs.h"
-diff --git a/src/utilities/gsec/gsecswi.h b/src/utilities/gsec/gsecswi.h
-index b8519f5..9b560e3 100644
---- a/src/utilities/gsec/gsecswi.h
-+++ b/src/utilities/gsec/gsecswi.h
-@@ -24,7 +24,6 @@
- #ifndef GSEC_GSECSWI_H
- #define GSEC_GSECSWI_H
-
--//#include "../common/common.h"
- #include "../jrd/constants.h"
-
- /* Switch handling constants. Note that the first IN_SW_DATA_ITEMS
-diff --git a/src/utilities/gstat/dba.epp b/src/utilities/gstat/dba.epp
-index 379b418..19b99d1 100644
---- a/src/utilities/gstat/dba.epp
-+++ b/src/utilities/gstat/dba.epp
-@@ -56,6 +56,7 @@
- #include "../common/classes/UserBlob.h"
- #include "../common/os/os_utils.h"
- #include "../common/StatusHolder.h"
-+#include "../common/ThreadStart.h"
-
- using MsgFormat::SafeArg;
-
-diff --git a/src/utilities/nbackup/nbkswi.h b/src/utilities/nbackup/nbkswi.h
-index 4326c3d..b8d43da 100644
---- a/src/utilities/nbackup/nbkswi.h
-+++ b/src/utilities/nbackup/nbkswi.h
-@@ -27,7 +27,6 @@
- #ifndef NBACKUP_NBKSWI_H
- #define NBACKUP_NBKSWI_H
-
--//#include "../common/common.h"
- #include "../jrd/constants.h"
-
- // Switch handling constants
-diff --git a/src/utilities/ntrace/os/win32/FileObject.cpp b/src/utilities/ntrace/os/win32/FileObject.cpp
-index 73ed38f..53fbfc0 100644
---- a/src/utilities/ntrace/os/win32/FileObject.cpp
-+++ b/src/utilities/ntrace/os/win32/FileObject.cpp
-@@ -27,7 +27,6 @@
-
- #include "firebird.h"
- #include "../FileObject.h"
--//#include "../common/classes/locks.h"
-
- using namespace Firebird;
- Firebird::Mutex open_mutex;
-diff --git a/src/yvalve/gds.cpp b/src/yvalve/gds.cpp
-index c851f7c..998bbde 100644
---- a/src/yvalve/gds.cpp
-+++ b/src/yvalve/gds.cpp
-@@ -57,6 +57,7 @@
- #include "../common/classes/init.h"
- #include "../common/classes/TempFile.h"
- #include "../common/utils_proto.h"
-+#include "../common/ThreadStart.h"
-
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
-diff --git a/src/yvalve/preparse.cpp b/src/yvalve/preparse.cpp
-index b2335a5..e742784 100644
---- a/src/yvalve/preparse.cpp
-+++ b/src/yvalve/preparse.cpp
-@@ -25,7 +25,6 @@
- #include "firebird.h"
- #include <stdlib.h>
- #include <string.h>
--//#include "../dsql/chars.h"
- #include "../yvalve/prepa_proto.h"
- #include "../yvalve/gds_proto.h"
- #include "../yvalve/YObjects.h"
---- a/src/common/isc_sync.cpp
-+++ b/src/common/isc_sync.cpp
-@@ -67,6 +67,7 @@
- #include "../common/classes/RefMutex.h"
- #include "../common/classes/array.h"
- #include "../common/StatusHolder.h"
-+#include "../common/ThreadStart.h"
-
- static int process_id;
-
---
-2.9.3
-
diff --git a/external/firebird/ExternalPackage_firebird.mk b/external/firebird/ExternalPackage_firebird.mk
index 87df3567e932..2416c13d61e6 100644
--- a/external/firebird/ExternalPackage_firebird.mk
+++ b/external/firebird/ExternalPackage_firebird.mk
@@ -15,10 +15,10 @@ ifeq ($(OS),WNT)
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/ifbclient.dll,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/bin/ifbclient.dll))
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/Engine12.dll,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/plugins/Engine12.dll))
else ifeq ($(OS),MACOSX)
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.dylib.3.0.0,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/lib/libfbclient.dylib.3.0.0))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.dylib.3.0.7,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/lib/libfbclient.dylib.3.0.7))
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libEngine12.dylib,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/plugins/libEngine12.dylib))
else ifeq ($(DISABLE_DYNLOADING),)
-$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.so.2,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/lib/libfbclient.so.3.0.0))
+$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libfbclient.so.2,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/lib/libfbclient.so.3.0.7))
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/libEngine12.so,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/plugins/libEngine12.so))
endif
diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk
index 8f8a8230227f..95663a508928 100644
--- a/external/firebird/ExternalProject_firebird.mk
+++ b/external/firebird/ExternalProject_firebird.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_ExternalProject_register_targets,firebird,\
))
firebird_BUILDDIR = $(EXTERNAL_WORKDIR)/gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird
-firebird_VERSION := 3.0.0
+firebird_VERSION := 3.0.7
$(call gb_ExternalProject_get_state_target,firebird,build):
$(call gb_Trace_StartRange,firebird,EXTERNAL)
@@ -85,10 +85,12 @@ $(call gb_ExternalProject_get_state_target,firebird,build):
LIBO_TUNNEL_LIBRARY_PATH='$(subst ','\'',$(subst $$,$$$$,$(call gb_Helper_extend_ld_path,$(call gb_UnpackedTarball_get_dir,icu)/source/lib)))' \
$(if $(filter MACOSX,$(OS)), \
&& install_name_tool -id @__________________________________________________OOO/libfbclient.dylib.$(firebird_VERSION) \
+ -delete_rpath @loader_path/.. \
$(firebird_BUILDDIR)/lib/libfbclient.dylib.$(firebird_VERSION) \
&& install_name_tool -id @__________________________________________________OOO/libEngine12.dylib \
+ -delete_rpath @loader_path/.. \
$(firebird_BUILDDIR)/plugins/libEngine12.dylib \
- && install_name_tool -change $(firebird_BUILDDIR)/lib/libfbclient.dylib.$(firebird_VERSION) \
+ && install_name_tool -change @rpath/lib/libfbclient.dylib \
@loader_path/libfbclient.dylib.$(firebird_VERSION) $(firebird_BUILDDIR)/plugins/libEngine12.dylib \
&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
$(firebird_BUILDDIR)/lib/libfbclient.dylib.$(firebird_VERSION) \
diff --git a/external/firebird/UnpackedTarball_firebird.mk b/external/firebird/UnpackedTarball_firebird.mk
index 25b1640755a1..27f4bfad36a5 100644
--- a/external/firebird/UnpackedTarball_firebird.mk
+++ b/external/firebird/UnpackedTarball_firebird.mk
@@ -25,12 +25,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
external/firebird/firebird.disable-ib-util-not-found.patch.1 \
external/firebird/firebird-Engine12.patch \
external/firebird/firebird-rpath.patch.0 \
- external/firebird/firebird-cloop-compiler.patch.1 \
- external/firebird/firebird-gcc6.patch.1 \
external/firebird/wnt-dbgutil.patch \
- external/firebird/libc++.patch \
- external/firebird/0001-Avoid-hangup-in-SS-when-error-happens-at-system-atta.patch.1 \
- external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.1 \
external/firebird/c++17.patch \
external/firebird/ubsan.patch \
external/firebird/asan.patch \
@@ -39,18 +34,19 @@ $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
external/firebird/0001-Fix-warning-on-Win64-build-231.patch.1 \
external/firebird/macos-arm64.patch.0 \
external/firebird/firebird-btyacc-add-explicit-rule.patch \
+ external/firebird/firebird-307.patch.1 \
))
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
external/firebird/firebird-cygwin-msvc.patch \
+ external/firebird/firebird-cygwin-msvc-warnings.patch \
external/firebird/firebird-vs2017.patch.1 \
))
endif
ifeq ($(OS),MACOSX)
$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
- external/firebird/firebird-configure-x86-64-macosx.patch.1 \
external/firebird/firebird-macosx.patch.1 \
external/firebird/macosx-elcapitan-dyld.patch \
))
diff --git a/external/firebird/asan.patch b/external/firebird/asan.patch
index 5ee7744e1038..2564c54d46ea 100644
--- a/external/firebird/asan.patch
+++ b/external/firebird/asan.patch
@@ -230,7 +230,7 @@
static const unsigned INCREASE_FACTOR = 50;
unsigned size;
- AutoPtr<UCHAR> data;
-+ AutoPtr<UCHAR, ArrayDelete<UCHAR>> data;
++ AutoPtr<UCHAR, ArrayDelete> data;
T* end;
};
#endif // RECURSIVE_SIMILAR
diff --git a/external/firebird/c++17.patch b/external/firebird/c++17.patch
index f5ac666bad16..4863b89bd8fd 100644
--- a/external/firebird/c++17.patch
+++ b/external/firebird/c++17.patch
@@ -67,7 +67,7 @@
}
--- src/common/StatusArg.h
+++ src/common/StatusArg.h
-@@ -86,7 +86,7 @@
+@@ -87,7 +87,7 @@
virtual ~ImplBase() { }
};
@@ -76,7 +76,7 @@
explicit Base(ImplBase* i) throw() : implementation(i) { }
~Base() throw() { delete implementation; }
-@@ -142,13 +142,13 @@
+@@ -144,13 +144,13 @@
explicit ImplStatusVector(const Exception& ex) throw();
};
@@ -97,7 +97,7 @@
const ISC_STATUS* value() const throw() { return implementation->value(); }
--- src/common/classes/alloc.cpp
+++ src/common/classes/alloc.cpp
-@@ -1431,7 +1431,7 @@
+@@ -1635,7 +1635,7 @@
~FreeObjects();
@@ -106,7 +106,7 @@
{
size_t full_size = size + (from ? 0 : ListBuilder::MEM_OVERHEAD);
if (full_size > Limits::TOP_LIMIT)
-@@ -1498,7 +1498,7 @@
+@@ -1705,7 +1705,7 @@
ListBuilder listBuilder;
Extent* currentExtent;
@@ -115,13 +115,13 @@
};
-@@ -1538,26 +1538,26 @@
- AtomicCounter used_memory, mapped_memory;
+@@ -1787,26 +1787,26 @@
+ };
+ #endif // VALIDATE_POOL
- private:
- MemBlock* alloc(size_t from, size_t& length, bool flagRedirect) throw (OOM_EXCEPTION);
+ MemBlock* alloc(size_t from, size_t& length, bool flagRedirect);
- void releaseBlock(MemBlock *block) throw ();
+ void releaseBlock(MemBlock *block, bool flagDecr) throw ();
public:
- void* allocate(size_t size ALLOC_PARAMS) throw (OOM_EXCEPTION);
@@ -134,8 +134,8 @@
- void* allocRaw(size_t length) throw (OOM_EXCEPTION);
+ virtual void memoryIsExhausted(void);
+ void* allocRaw(size_t length);
- static void release(void* block, bool flagDecr) throw ();
- static void releaseRaw(bool destroying, void *block, size_t size, bool use_cache = true) throw ();
+ static void releaseMemory(void* block, bool flagExtent) throw ();
+ static void releaseRaw(bool destroying, void *block, size_t size, bool use_cache = true) throw ();
- void* getExtent(size_t from, size_t& to) throw (OOM_EXCEPTION);
+ void* getExtent(size_t from, size_t& to);
@@ -149,7 +149,7 @@
private:
#ifdef USE_VALGRIND
-@@ -1667,7 +1667,7 @@
+@@ -1942,7 +1942,7 @@
template <class ListBuilder, class Limits>
@@ -158,7 +158,7 @@
{
size_t size = Limits::getSize(slot);
-@@ -1902,7 +1902,7 @@
+@@ -2151,7 +2151,7 @@
}
template <class Extent>
@@ -167,16 +167,16 @@
{
// No large enough block found. We need to extend the pool
void* memory = NULL;
-@@ -1967,7 +1967,7 @@
+@@ -2216,7 +2216,7 @@
pool->setStatsGroup(newStats);
}
-MemBlock* MemPool::alloc(size_t from, size_t& length, bool flagRedirect) throw (OOM_EXCEPTION)
+MemBlock* MemPool::alloc(size_t from, size_t& length, bool flagRedirect)
{
- MutexEnsureUnlock guard(mutex, "MemPool::alloc");
+ MutexEnsureUnlock guard(mutex, "MemPool::alloc");
guard.enter();
-@@ -2026,7 +2026,7 @@
+@@ -2275,7 +2275,7 @@
#ifdef DEBUG_GDS_ALLOC
, const char* fileName, int line
#endif
@@ -185,16 +185,16 @@
{
size_t length = from ? size : ROUNDUP(size + VALGRIND_REDZONE, roundingSize) + GUARD_BYTES;
MemBlock* memory = alloc(from, length, true);
-@@ -2055,7 +2055,7 @@
+@@ -2305,7 +2305,7 @@
}
-void* MemPool::allocate(size_t size ALLOC_PARAMS) throw (OOM_EXCEPTION)
+void* MemPool::allocate(size_t size ALLOC_PARAMS)
{
- MemBlock* memory = allocate2(0, size ALLOC_PASS_ARGS);
-
-@@ -2180,12 +2180,12 @@
+ #ifdef VALIDATE_POOL
+ MutexLockGuard guard(mutex, "MemPool::allocate");
+@@ -2445,12 +2445,12 @@
releaseRaw(pool_destroying, hunk, hunk->length, false);
}
@@ -209,16 +209,16 @@
{
#ifndef USE_VALGRIND
if (size == DEFAULT_ALLOCATION)
-@@ -2245,7 +2245,7 @@
+@@ -2530,7 +2530,7 @@
}
-void* MemPool::getExtent(size_t from, size_t& to) throw(OOM_EXCEPTION) // pass desired minimum size, return actual extent size
-+void* MemPool::getExtent(size_t from, size_t& to) // pass desired minimum size, return actual extent size
++void* MemPool::getExtent(size_t from, size_t& to) // pass desired minimum size, return actual extent size
{
- MemBlock* extent = allocate2(from, to ALLOC_ARGS);
- return &extent->body;
-@@ -2348,7 +2348,7 @@
+ #ifdef VALIDATE_POOL
+ MutexLockGuard guard(mutex, "MemPool::getExtent");
+@@ -2653,7 +2653,7 @@
deallocate(block);
}
@@ -227,7 +227,16 @@
{
void* block = allocate(size ALLOC_PASS_ARGS);
memset(block, 0, size);
-@@ -2489,7 +2489,7 @@
+@@ -2800,7 +2800,7 @@
+ }
+
+ #ifdef LIBC_CALLS_NEW
+-void* MemoryPool::globalAlloc(size_t s ALLOC_PARAMS) throw (OOM_EXCEPTION)
++void* MemoryPool::globalAlloc(size_t s ALLOC_PARAMS)
+ {
+ if (!defaultMemoryManager)
+ {
+@@ -2818,7 +2818,7 @@
MemPool::globalFree(block);
}
@@ -236,7 +245,7 @@
{
return pool->allocate(size ALLOC_PASS_ARGS);
}
-@@ -2547,11 +2547,11 @@
+@@ -2876,11 +2876,11 @@
// in a case when we actually need "new" only with file/line information
// this version should be also present as a pair for "delete".
#ifdef DEBUG_GDS_ALLOC
@@ -260,7 +269,8 @@
+ void* calloc(size_t size ALLOC_PARAMS);
#ifdef LIBC_CALLS_NEW
- static void* globalAlloc(size_t s ALLOC_PARAMS) throw (OOM_EXCEPTION);
+- static void* globalAlloc(size_t s ALLOC_PARAMS) throw (OOM_EXCEPTION);
++ static void* globalAlloc(size_t s ALLOC_PARAMS);
#else
- static void* globalAlloc(size_t s ALLOC_PARAMS) throw (OOM_EXCEPTION)
+ static void* globalAlloc(size_t s ALLOC_PARAMS)
@@ -274,7 +284,7 @@
static void globalFree(void* mem) throw ();
void deallocate(void* mem) throw ();
-@@ -295,20 +295,20 @@
+@@ -289,20 +289,20 @@
// operators new and delete
diff --git a/external/firebird/firebird-307.patch.1 b/external/firebird/firebird-307.patch.1
new file mode 100644
index 000000000000..6af47983877a
--- /dev/null
+++ b/external/firebird/firebird-307.patch.1
@@ -0,0 +1,12 @@
+diff -ur firebird.org/builds/posix/Makefile.in firebird/builds/posix/Makefile.in
+--- firebird.org/builds/posix/Makefile.in 2020-11-08 15:11:29.262993342 +0100
++++ firebird/builds/posix/Makefile.in 2020-11-08 15:16:53.628545143 +0100
+@@ -264,7 +264,7 @@
+ ODS_TEST:=$(GEN_ROOT)/odstest$(EXEC_EXT)
+
+ preliminaryCheck: $(STD_SIZES) $(RUN_SIZES)
+- diff -u $^
++ diff -u --strip-trailing-cr $^
+
+ $(RUN_SIZES): $(ODS_H) $(ODS_AWK)
+ awk -f $(ODS_AWK) <$(ODS_H) >$(ODS_TEST_CPP)
diff --git a/external/firebird/firebird-cloop-compiler.patch.1 b/external/firebird/firebird-cloop-compiler.patch.1
deleted file mode 100644
index ac82bb0caa46..000000000000
--- a/external/firebird/firebird-cloop-compiler.patch.1
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ur firebird.org/extern/cloop/Makefile firebird/extern/cloop/Makefile
---- firebird.org/extern/cloop/Makefile 2016-08-17 18:32:59.078044357 +0200
-+++ firebird/extern/cloop/Makefile 2016-08-17 18:33:14.430518561 +0200
-@@ -4,8 +4,6 @@
-
- TARGET := release
-
--CC := gcc
--CXX := g++
- LD := $(CXX)
-
- SRC_DIR := src
diff --git a/external/firebird/firebird-configure-x86-64-macosx.patch.1 b/external/firebird/firebird-configure-x86-64-macosx.patch.1
deleted file mode 100644
index 99a7d2db89f1..000000000000
--- a/external/firebird/firebird-configure-x86-64-macosx.patch.1
+++ /dev/null
@@ -1,20 +0,0 @@
---- firebird.org/configure 2015-03-27 16:00:42.000000000 +0200
-+++ firebird/configure 2015-06-09 15:33:26.000000000 +0300
-@@ -2903,7 +2903,7 @@
- ;;
-
- i*86-*-darwin*)
-- MAKEFILE_PREFIX=darwin_i386
-+ MAKEFILE_PREFIX=darwin_x86_64
- MAKEFILE_POSTFIX=darwin
- PLATFORM=DARWIN
- INSTALL_PREFIX=darwin
-@@ -2913,7 +2913,7 @@
- LIBS="$LIBS -framework CoreFoundation"
- EDITLINE_FLG=Y
- SHRLIB_EXT=dylib
-- CPU_TYPE=i386
-+ CPU_TYPE=x86_64
- EXPORT_SYMBOLS_STYLE=darwin
- ;;
-
diff --git a/external/firebird/firebird-cygwin-msvc-warnings.patch b/external/firebird/firebird-cygwin-msvc-warnings.patch
new file mode 100644
index 000000000000..bd175b573f53
--- /dev/null
+++ b/external/firebird/firebird-cygwin-msvc-warnings.patch
@@ -0,0 +1,300 @@
+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
+@@ -102,7 +102,7 @@
+ #____________________________________________________________________________
+
+ # Firebird needs no RTTI
+-RTTI_FLAG:= -fno-rtti
++RTTI_FLAG:=
+
+ # If this is defined then we use special rules useful for developers only
+ IsDeveloper = @DEVEL_FLG@
+@@ -175,6 +175,7 @@
+ # Default extensions
+
+ ARCH_EXT= .lib
++OBJ_EXT= obj
+ EXEC_EXT= @EXEEXT@
+ SHRLIB_EXT=@SHRLIB_EXT@
+ LIB_PREFIX=
+--- builds/posix/Makefile.in 2016-07-07 15:56:06.459221300 +0200
++++ builds/posix/Makefile.in 2016-07-13 12:44:57.134217200 +0200
+@@ -665,7 +666,7 @@
+
+ include $(ROOT)/gen/make.shared.targets
+
+-Dependencies = $(AllObjects:.o=.d)
++Dependencies = $(AllObjects:.$(OBJ_EXT)=.d)
+ -include $(Dependencies)
+
+
+@@ -729,14 +730,14 @@
+ -$(MAKE) -C $(ROOT)/extern/libtommath clean
+
+ clean_objects:
+- $(RM) `find $(TMP_ROOT)/ -type f -name '*.o' -print`
++ $(RM) `find $(TMP_ROOT)/ -type f -name '*.$(OBJ_EXT)' -print`
+ $(RM) `find $(TMP_ROOT)/ -type f -name '*.a' -print`
+ $(RM) `find $(TMP_ROOT)/ -type f -name '*.cpp' -print`
+ $(RM) `find $(TMP_ROOT)/ -type f -name '*.pas' -print`
+
+ clean_extern_objects:
+ $(RM) `find $(ROOT)/extern/ -type f -name '*.lo' -print`
+- $(RM) `find $(ROOT)/extern/ -type f -name '*.o' -print`
++ $(RM) `find $(ROOT)/extern/ -type f -name '*.$(OBJ_EXT)' -print`
+
+ # Clear out dependancies files created by the gcc compiler
+ # since when .o and other files are deleted the dependant
+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
+@@ -92,21 +92,21 @@
+ $(LIBO_TUNNEL_LIBRARY_PATH) $(GPRE_CURRENT) $(GPRE_FLAGS) $(firstword $<) $@
+
+
+-.SUFFIXES: .lo .o .cpp .c
++.SUFFIXES: .lo .$(OBJ_EXT) .cpp .c
+
+-%.o: %.c
++%.$(OBJ_EXT): %.c
+ $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+
+-$(OBJ)/%.o: $(SRC_ROOT)/%.c
++$(OBJ)/%.$(OBJ_EXT): $(SRC_ROOT)/%.c
+ $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+
+-$(OBJ)/%.o: $(OBJ)/%.cpp
++$(OBJ)/%.$(OBJ_EXT): $(OBJ)/%.cpp
+ $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+
+-$(OBJ)/%.o: $(SRC_ROOT)/%.cpp
++$(OBJ)/%.$(OBJ_EXT): $(SRC_ROOT)/%.cpp
+ $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+
+-$(OBJ)/%.o: $(ROOT)/%.cpp
++$(OBJ)/%.$(OBJ_EXT): $(ROOT)/%.cpp
+ $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+
+ .SUFFIXES: .epp .e
+--- builds/posix/make.shared.variables.orig 2020-11-12 19:36:29.773409900 +0100
++++ builds/posix/make.shared.variables 2020-11-12 19:37:14.976503300 +0100
+@@ -1,5 +1,5 @@
+ # Helper functions
+-doObjects= $(patsubst %.y,%.o,$(patsubst %.epp,%.o,$(patsubst %.c,%.o,$(1:.cpp=.o))))
++doObjects= $(patsubst %.y,%.$(OBJ_EXT),$(patsubst %.epp,%.$(OBJ_EXT),$(patsubst %.c,%.$(OBJ_EXT),$(1:.cpp=.$(OBJ_EXT)))))
+ makeObjects= $(addprefix $(OBJ)/$(patsubst ../%,%,$(1))/,$(call doObjects,$2))
+ dirFiles= $(notdir $(wildcard ../src/$(1)/*.cpp)) $(notdir $(wildcard ../src/$(1)/*.c)) \
+ $(notdir $(wildcard ../src/$(1)/*.epp)) $(notdir $(wildcard ../src/$(1)/*.y))
+--- src/include/gen/autoconfig.h.in.orig 2020-11-12 20:52:49.835722200 +0100
++++ src/include/gen/autoconfig.h.in 2020-11-12 20:53:18.148311100 +0100
+@@ -773,7 +773,9 @@
+ #pragma warning(disable:4996) // 'identificator' was declared deprecated
+ #endif
+
++#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
++#endif
+
+ //#ifdef _MSC_VER // don't know if this is useful for MinGW
+ #define NOATOM
+--- builds/posix/prefix.mingw.orig 2020-11-12 21:37:39.574461300 +0100
++++ builds/posix/prefix.mingw 2020-11-12 21:37:55.448422500 +0100
+@@ -20,8 +20,8 @@
+ #
+
+ # -Wno-unused-variable is used due to unused gpre generated variables
+-PROD_FLAGS=-O2 -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN
+-DEV_FLAGS=-ggdb -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN
++PROD_FLAGS=-O2 -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN -wd4291 -wd4477
++DEV_FLAGS=-ggdb -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN -wd4291 -wd4477
+
+ PLATFORM_PATH=os/win32
+
+--- extern/btyacc/Makefile.orig 2020-11-12 21:39:13.833012400 +0100
++++ extern/btyacc/Makefile 2020-11-12 21:39:54.861473300 +0100
+@@ -25,8 +25,8 @@
+
+ MAKEFILE = Makefile
+
+-OBJS = closure.o error.o lalr.o lr0.o main.o mkpar.o output.o \
+- mstring.o reader.o readskel.o skeleton.o symtab.o verbose.o warshall.o
++OBJS = closure.obj error.obj lalr.obj lr0.obj main.obj mkpar.obj output.obj \
++ mstring.obj reader.obj readskel.obj skeleton.obj symtab.obj verbose.obj warshall.obj
+
+ PRINT = pr -f -l88
+
+@@ -44,7 +44,7 @@
+ $(PROGRAM): $(OBJS) $(LIBS)
+ $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
+
+-%.o: %.c
++%.obj: %.c
+ $(CC) $(CCFLAGS) -c $< -o $@
+
+ clean:; rm -f $(OBJS)
+@@ -93,16 +93,16 @@
+ etags *.c *.h
+
+ ###
+-closure.o: defs.h
+-error.o: defs.h
+-lalr.o: defs.h
+-lr0.o: defs.h
+-main.o: defs.h
+-mkpar.o: defs.h
+-mstring.o: mstring.h
+-output.o: defs.h
+-reader.o: defs.h mstring.h
+-skeleton.o: defs.h
+-symtab.o: defs.h
+-verbose.o: defs.h
+-warshall.o: defs.h
++closure.obj: defs.h
++error.obj: defs.h
++lalr.obj: defs.h
++lr0.obj: defs.h
++main.obj: defs.h
++mkpar.obj: defs.h
++mstring.obj: mstring.h
++output.obj: defs.h
++reader.obj: defs.h mstring.h
++skeleton.obj: defs.h
++symtab.obj: defs.h
++verbose.obj: defs.h
++warshall.obj: defs.h
+--- extern/cloop/Makefile.orig 2020-11-13 10:59:53.282923700 +0100
++++ extern/cloop/Makefile 2020-11-13 11:00:24.267079900 +0100
+@@ -24,8 +24,8 @@
+ SRCS_C := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.c))
+ SRCS_CPP := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.cpp))
+
+-OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
+-OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
++OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.obj,$(SRCS_C))
++OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.obj,$(SRCS_CPP))
+
+ C_FLAGS := -fPIC
+ CXX_FLAGS := $(C_FLAGS)
+@@ -43,10 +43,10 @@
+ vpath %.cpp $(SRC_DIRS)
+
+ define compile
+-$1/%.o: %.c
++$1/%.obj: %.c
+ $(CC) -c $$(C_FLAGS) $$< -o $$@
+
+-$1/%.o: %.cpp
++$1/%.obj: %.cpp
+ $(CXX) -c $$(CXX_FLAGS) $$< -o $$@
+ endef
+
+@@ -75,11 +75,11 @@
+ -include $(addsuffix .d,$(basename $(OBJS_CPP)))
+
+ $(BIN_DIR)/cloop$(EXE_EXT): \
+- $(OBJ_DIR)/cloop/Expr.o \
+- $(OBJ_DIR)/cloop/Generator.o \
+- $(OBJ_DIR)/cloop/Lexer.o \
+- $(OBJ_DIR)/cloop/Parser.o \
+- $(OBJ_DIR)/cloop/Main.o \
++ $(OBJ_DIR)/cloop/Expr.obj \
++ $(OBJ_DIR)/cloop/Generator.obj \
++ $(OBJ_DIR)/cloop/Lexer.obj \
++ $(OBJ_DIR)/cloop/Parser.obj \
++ $(OBJ_DIR)/cloop/Main.obj \
+
+ $(LD) $^ -o $@
+
+@@ -105,24 +105,24 @@
+ $(SRC_DIR)/tests/test1/CppTest.cpp: $(SRC_DIR)/tests/test1/CalcCppApi.h
+
+ $(BIN_DIR)/test1-c$(SHRLIB_EXT): \
+- $(OBJ_DIR)/tests/test1/CalcCApi.o \
+- $(OBJ_DIR)/tests/test1/CTest.o \
++ $(OBJ_DIR)/tests/test1/CalcCApi.obj \
++ $(OBJ_DIR)/tests/test1/CTest.obj \
+
+ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-c$(EXE_EXT): \
+- $(OBJ_DIR)/tests/test1/CalcCApi.o \
+- $(OBJ_DIR)/tests/test1/CTest.o \
++ $(OBJ_DIR)/tests/test1/CalcCApi.obj \
++ $(OBJ_DIR)/tests/test1/CTest.obj \
+
+ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \
+- $(OBJ_DIR)/tests/test1/CppTest.o \
++ $(OBJ_DIR)/tests/test1/CppTest.obj \
+
+ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-cpp$(EXE_EXT): \
+- $(OBJ_DIR)/tests/test1/CppTest.o \
++ $(OBJ_DIR)/tests/test1/CppTest.obj \
+
+ $(LD) $^ -o $@
+
+--- src/include/gen/autoconfig_msvc.h.orig 2020-11-13 12:42:36.231813100 +0100
++++ src/include/gen/autoconfig_msvc.h 2020-11-13 12:43:12.669012900 +0100
+@@ -68,7 +68,9 @@
+ #pragma warning(disable:4996) // 'identificator' was declared deprecated
+
+
++#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
++#endif
+
+ #ifdef _MSC_VER // don't know if this is useful for MinGW
+ #define NOATOM
+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,9 +65,9 @@
+ EXAMPLES_SRC= $(ROOT)/examples
+
+
+-EMPBLD_Objects= $(EXAMPLES_DEST)/empbuild.o
++EMPBLD_Objects= $(EXAMPLES_DEST)/empbuild.$(OBJ_EXT)
+
+-INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.o
++INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.$(OBJ_EXT)
+
+ INPUT_Files = empddl.sql empdml.sql indexoff.sql indexon.sql \
+ job.inp lang.inp proj.inp qtr.inp
+@@ -172,3 +175,6 @@
+
+ $(EXAMPLES_DEST)/%.h: $(EXAMPLES_SRC)/common/%.h
+ $(CP) $^ $@
++
++$(EXAMPLES_DEST)/%.$(OBJ_EXT): $(EXAMPLES_DEST)/%.c
++ $(CC) -c $(firstword $<) -Fo$@ $(WCFLAGS)
+--- src/lock/lock.cpp.orig 2020-11-13 17:57:23.485241200 +0100
++++ src/lock/lock.cpp 2020-11-13 17:57:51.001010600 +0100
+@@ -463,6 +463,7 @@
+
+ LockTableGuard guard(This, FB_FUNCTION, owner_offset);
+
++#undef SRQ_BASE
+ #define SRQ_BASE ((UCHAR*) This->m_sharedMemory->getHeader())
+ own* owner = (own*) SRQ_ABS_PTR(owner_offset);
+ if (!owner->own_count)
+@@ -486,6 +487,7 @@
+ // released before destroying the lock owner. This is not strictly required,
+ // but it enforces the proper object lifetime discipline through the codebase.
+ fb_assert(SRQ_EMPTY(owner->own_requests));
++#undef SRQ_BASE
+ #define SRQ_BASE ((UCHAR*) m_sharedMemory->getHeader())
+
+ This->purge_owner(owner_offset, owner);
+--- builds/posix/Makefile.in.plugins_examples.orig 2020-11-13 20:25:55.865485400 +0100
++++ builds/posix/Makefile.in.plugins_examples 2020-11-13 20:26:13.084191800 +0100
+@@ -104,5 +104,5 @@
+
+ include $(ROOT)/gen/make.shared.targets
+
+-Dependencies = $(AllObjects:.o=.d)
++Dependencies = $(AllObjects:.$(OBJ_EXT)=.d)
+ -include $(Dependencies)
diff --git a/external/firebird/firebird-cygwin-msvc.patch b/external/firebird/firebird-cygwin-msvc.patch
index 47fd322e514e..9536403886c6 100644
--- a/external/firebird/firebird-cygwin-msvc.patch
+++ b/external/firebird/firebird-cygwin-msvc.patch
@@ -56,13 +56,15 @@
/* 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,34 @@
+@@ -703,3 +703,36 @@
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
+
+/* taken from src/include/gen/autoconfig_msvc.h */
++#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
++#endif
+/* target architecture */
+#if defined(_M_IX86)
+/* sizeof(void *) */
@@ -84,7 +86,7 @@
+#endif
+
+#define HAVE_IO_H
-+
++#define HAVE_CTIME_S
+#define HAVE_GETPAGESIZE
+
+#if defined _MSC_VER
@@ -112,33 +114,25 @@
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 @@
+@@ -56,7 +56,7 @@
else
FIREBIRD=$(FB_BUILD)
endif
-FIREBIRD_LOCK=$(FIREBIRD)
-+ifeq (@PLATFORM@,win32)
-+ FIREBIRD_LOCK=$(shell cygpath -w $(FIREBIRD) )
-+else
-+ FIREBIRD_LOCK=$(FIREBIRD)
-+endif
++FIREBIRD_LOCK=$(shell cygpath -w $(FIREBIRD))
export FIREBIRD
export FIREBIRD_LOCK
-@@ -152,7 +156,11 @@
+@@ -153,7 +153,7 @@
CD= cd
CAT= cat
AR= ar @AR_OPTIONS@
-LN= @LN_S@
-+ifeq (@PLATFORM@,win32)
-+ LN= cp
-+else
-+ LN= @LN_S@
-+endif
++LN= cp
RANLIB= @RANLIB@
BTYACC=$(ROOT)/extern/btyacc/btyacc
CLOOP=$(GEN_ROOT)/$(TARGET)/cloop/release/bin/cloop
-@@ -174,10 +182,10 @@
+@@ -175,10 +175,10 @@
# Default extensions
@@ -151,15 +145,18 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
SHRLIB_FOREIGN_EXT= $(SHRLIB_EXT)
#_____________________________________________________________________________
-@@ -203,6 +211,7 @@
- vpath %.so $(LIB)
- vpath %.a $(LIB)
+@@ -201,9 +202,8 @@
+
+ # Search path for libraries
+
+-vpath %.so $(LIB)
+-vpath %.a $(LIB)
vpath %.dll $(LIB)
+vpath %.lib $(LIB)
#_____________________________________________________________________________
-@@ -216,9 +225,9 @@
+@@ -217,9 +217,9 @@
#
#LibraryFileName=libfbclient
@@ -172,7 +169,7 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
LibraryBaseName=$(LibraryFileName).${SHRLIB_EXT}
LIBFIREBIRD_FULLNAME = $(LIB)/$(LibraryFullName)
-@@ -227,7 +236,7 @@
+@@ -228,7 +228,7 @@
# The firebird engine library name
@@ -181,17 +178,17 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
EngineSoName=$(EngineFileName).${SHRLIB_EXT}
ENGINE_SONAME = $(PLUGINS)/$(EngineSoName)
-@@ -241,7 +250,7 @@
+@@ -242,7 +242,7 @@
ifeq ($(STD_EDITLINE), true)
LIBEDITLINE := -l$(READLINE)
else
- LIBEDITLINE := $(LIB)/libedit.a
-+ LIBEDITLINE := $(LIB)/edit.lib
++ LIBEDITLINE := $(LIB)/$(LIB_PREFIX)edit$(ARCH_EXT)
endif
endif
-@@ -289,7 +298,7 @@
- LIB_PATH_OPTS = $(call LIB_LINK_RPATH,lib) $(call LIB_LINK_RPATH,intl)
+@@ -313,7 +313,7 @@
+
LIB_LINK_SONAME= -Wl,-soname,$(1)
LIB_LINK_MAPFILE= -Wl,--version-script,$(1)
-FIREBIRD_LIBRARY_LINK= -L$(LIB) -lfbclient $(MATHLIB)
@@ -199,30 +196,28 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
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 @@
+@@ -355,7 +355,7 @@
# 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
++COMMON_LIB = $(OBJ)/$(LIB_PREFIX)common$(ARCH_EXT)
# 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 @@
+@@ -33,7 +33,7 @@
# 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
+@@ -178,7 +178,7 @@
+ .PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest preliminaryCheck
master_process:
- ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
@@ -230,30 +225,16 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
$(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 @@
+@@ -214,7 +215,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 @@
+@@ -239,7 +240,7 @@
$(MAKE) -f Makefile.examples -C $(GEN_ROOT)/examples/
cross2:
@@ -262,91 +243,67 @@ diff -ur builds/posix/make.defaults builds/posix/make.defaults
$(MAKE) prerequisites
$(MAKE) tommath
$(MAKE) yvalve
-@@ -275,7 +275,8 @@
+@@ -310,7 +311,7 @@
# 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)
+- $(LINK_FIREBIRD) -o $@ $^ $(LINK_FIREBIRD_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,lib/libfbclient.$(SHRLIB_EXT))
++ $(LINK_FIREBIRD) $(CPPFLAGS) -o $@ $^ $(LINK_FIREBIRD_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,lib/libfbclient.$(SHRLIB_EXT))
#___________________________________________________________________________
-@@ -284,7 +286,8 @@
+@@ -320,8 +321,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)
+-$(ENGINE_SONAME): $(Engine_Objects) $(SVC_Objects) $(COMMON_LIB)
+- $(LINK_ENGINE) -o $@ $^ $(LINK_ENGINE_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,plugins/$(EngineSoName))
++$(ENGINE_SONAME): $(Engine_Objects) $(SVC_Objects) $(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(LINK_ENGINE) $(CPPFLAGS) -o $@ $^ $(LINK_ENGINE_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,plugins/$(EngineSoName))
#___________________________________________________________________________
-@@ -294,7 +297,7 @@
+@@ -330,8 +331,8 @@
+
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)
+-$(LIBFBINTL_SO): $(INTL_Objects) $(COMMON_LIB)
+- $(LINK_INTL) -o $@ $^ $(LINK_INTL_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,intl/libfbintl.$(SHRLIB_EXT))
++$(LIBFBINTL_SO): $(INTL_Objects) $(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(LINK_INTL) $(CPPFLAGS) -o $@ $^ $(LINK_INTL_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,intl/libfbintl.$(SHRLIB_EXT))
#___________________________________________________________________________
-@@ -393,7 +396,7 @@
+@@ -427,12 +429,13 @@
.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
++# fbguard currently fails to link, with missing fork etc, in util.cpp
++utilities: firebird_server fb_lock_print fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup udfsupport
firebird_server: $(FB_DAEMON)
-@@ -540,7 +543,7 @@
- GBAK_FILES := $(FDB_FILES:.fdb=.gbak) $(FIREBIRD)/msg.gbak
- GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES))
+-$(FB_DAEMON): $(Remote_Server_Objects) $(COMMON_LIB)
+- $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,..)
++$(FB_DAEMON): $(Remote_Server_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(LIB_GUI) $(call LINK_DARWIN_RPATH,..)
--rest: qli message_file
-+rest: message_file
+ fb_lock_print: $(LOCKPRINT)
- cross_rest: qli gbak_files
- $(MAKE) $(BUILD_FILE)
-@@ -593,7 +595,7 @@
+@@ -633,7 +635,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
++MAKE_HEADER_Bin = ./makeHeader$(EXEC_EXT)
$(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 @@
+@@ -92,26 +92,23 @@
$(OBJ)/%.o: $(SRC_ROOT)/%.c
$(CC) $(WCFLAGS) -c $(firstword $<) -o $@
@@ -360,6 +317,10 @@ diff -ur builds/posix/make.rules builds/posix/make.rules
$(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
- @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+ $(OBJ)/%.o: $(ROOT)/%.cpp
+ $(CC) $(WCFLAGS) -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
@@ -429,20 +390,21 @@ diff -ur builds/posix/prefix.mingw builds/posix/prefix.mingw
# 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 @@
+@@ -55,7 +59,9 @@
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
++LINK_IBUTIL_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/ib_util.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)
+@@ -62,6 +62,7 @@
+ $(SecDbCache)
Remote_Client:= $(call dirObjects,remote/client) $(call dirObjects,auth/SecureRemotePassword/client) \
$(call makeObjects,auth/SecurityDatabase,LegacyClient.cpp) \
+ $(call dirObjects,auth/trusted) \
@@ -492,15 +454,24 @@ diff -ur extern/btyacc/main.c extern/btyacc/main.c
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,7 @@
- all: $(PROGRAM)
+@@ -30,7 +30,7 @@
+
+ PRINT = pr -f -l88
- $(PROGRAM): $(OBJS) $(LIBS)
-- $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
-+ $(CC) $(LDFLAGS) -o $(PROGRAM).exe $(OBJS) $(LIBS)
+-PROGRAM = btyacc
++PROGRAM = btyacc.exe
- %.o: %.c
- $(CC) $(CCFLAGS) -c $< -o $@
+ SRCS = closure.c error.c lalr.c lr0.c main.c mkpar.c output.c \
+ mstring.c reader.c readskel.c skeleton.c symtab.c verbose.c warshall.c
+@@ -58,7 +58,7 @@
+ index:; ctags -wx $(HDRS) $(SRCS)
+
+ install: $(PROGRAM)
+- cp $(PROGRAM).exe /bin
++ cp $(PROGRAM) /bin
+
+ oldinstall: $(PROGRAM)
+ @echo Installing $(PROGRAM) in $(DEST)
--- 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 @@
@@ -514,7 +485,7 @@ diff -ur extern/btyacc/Makefile extern/btyacc/Makefile
--- 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 <stdlib.h>
#include <stdio.h>
+#define WIN32
@@ -660,3 +631,46 @@ diff -ur src/misc/makeHeader.cpp src/misc/makeHeader.cpp
+--- builds/posix/Makefile.in.plugins_examples.orig 2020-11-13 18:07:52.515550600 +0100
++++ builds/posix/Makefile.in.plugins_examples 2020-11-13 18:08:33.218626500 +0100
+@@ -28,7 +28,7 @@
+ # Adriano dos Santos Fernandes
+ #
+
+-ROOT=$(shell cd ..; pwd)
++ROOT=$(shell cygpath -m '$(shell cd ..; pwd)')
+
+ ifeq ($(IsDeveloper), Y)
+ DefaultTarget := Debug
+--- examples/dbcrypt/CryptApplication.cpp.orig 2020-11-13 20:57:11.222938900 +0100
++++ examples/dbcrypt/CryptApplication.cpp 2020-11-13 21:01:19.332316100 +0100
+@@ -27,6 +27,13 @@
+ #include "../interfaces/ifaceExamples.h"
+ #include <firebird/Message.h>
+
++#include "gen/autoconfig.h"
++
++#ifdef WIN_NT
++#include <windows.h>
++#include <winbase.h>
++#endif
++
+ using namespace Firebird;
+
+ class CryptKey : public ICryptKeyCallbackImpl<CryptKey, CheckStatusWrapper>
+@@ -238,8 +238,15 @@
+ av++;
+ }
+
++#ifdef WIN_NT
++ if (!getenv("ISC_USER"))
++ SetEnvironmentVariable("ISC_USER", "sysdba");
++ if (!getenv("ISC_PASSWORD"))
++ SetEnvironmentVariable("ISC_PASSWORD", "masterkey");
++#else
+ setenv("ISC_USER", "sysdba", 0);
+ setenv("ISC_PASSWORD", "masterkey", 0);
++#endif
+
+ App app;
+ try
diff --git a/external/firebird/firebird-gcc6.patch.1 b/external/firebird/firebird-gcc6.patch.1
deleted file mode 100644
index e1361415c03b..000000000000
--- a/external/firebird/firebird-gcc6.patch.1
+++ /dev/null
@@ -1,19 +0,0 @@
-commit 3618aa2171674babf79ef935aa049c40a3db1321
-Author: asfernandes <asfernandes@users.sourceforge.net>
-Date: Sat Mar 5 03:39:36 2016 +0000
-
- Make the generated code compatible with gcc 6 in C++-14 mode.
-
-diff --git a/src/gpre/c_cxx.cpp b/src/gpre/c_cxx.cpp
-index 2af96c6..2dcffd6 100644
---- a/src/gpre/c_cxx.cpp
-+++ b/src/gpre/c_cxx.cpp
-@@ -2820,7 +2820,7 @@ static void gen_request(const gpre_req* request)
- printa(0, "static %sshort\n isc_%dl = %d;",
- (request->req_flags & REQ_extend_dpb) ? "" : CONST_STR,
- request->req_ident, request->req_length);
-- printa(0, "static %schar\n isc_%d [] = {", CONST_STR, request->req_ident);
-+ printa(0, "static %sunsigned char\n isc_%d [] = {", CONST_STR, request->req_ident);
-
- const TEXT* string_type = "blr";
- if (gpreGlob.sw_raw)
diff --git a/external/firebird/firebird-macosx.patch.1 b/external/firebird/firebird-macosx.patch.1
index fdd544873be7..676f2195ad55 100644
--- a/external/firebird/firebird-macosx.patch.1
+++ b/external/firebird/firebird-macosx.patch.1
@@ -1,66 +1,67 @@
---- 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 @@
- */
+--- firebird.org/builds/posix/Makefile.in.examples
++++ firebird/builds/posix/Makefile.in.examples
+@@ -134,7 +134,7 @@
+ $(LN) $(ISQL) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
- #include "CalcCApi.h"
--#include <malloc.h>
-+#include <stdlib.h>
- #include <stdio.h>
+ $(EXAMPLES_DEST)/empbuild$(EXEC_EXT): $(EMPBLD_Objects) $(COMMON_LIB)
+- $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
++ $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,../$(if $(ENABLE_DEBUG),Debug,Release)/firebird)
+
+ $(EXAMPLES_DEST)/empbuild.c: $(EXAMPLES_DEST)/empbuild.fdb $(EXAMPLES_DEST)/empbuild.e
- #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,8 +19,6 @@
- #
- # Default build from 10.7 using Clang
+@@ -27,9 +27,6 @@
+ # configure using --with-builtin-tommath
+ # or add the relevant -I, -L for an installed version of libtommath
-DYLD_LIBRARY_PATH=$(HOME)/icu54/icu/source/lib
-export DYLD_LIBRARY_PATH
-
+-
#DYLD_PRINT_ENV=1
#export DYLD_PRINT_ENV
+
@@ -31,8 +31,8 @@
- MACOSX_DEPLOYMENT_TARGET=10.7
+ MACOSX_DEPLOYMENT_TARGET=10.9
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
+-PROD_FLAGS=-DDARWIN -pipe -O2 -MMD -fPIC -fno-common -mmacosx-version-min=10.9
+-DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-omit-frame-pointer -fno-common -Wall -fno-optimize-sibling-calls -mmacosx-version-min=10.9 -Wno-non-virtual-dtor
++PROD_FLAGS=-DDARWIN -pipe -O2 -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
+ CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -stdlib=libc++ -msse4
- EXE_LINK_OPTIONS:=
+ EXE_LINK_OPTIONS:=
--- 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 @@
+ const char* const ucTemplate = "icuuc%s.dll";
+ #endif
#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 = "lib/libicui18n.%s.dylib";
+-const char* const ucTemplate = "lib/libicuuc.%s.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,16 @@
- s.printf("%d%d", majorVersion, minorVersion);
-
- filename.printf(templateName, s.c_str());
-+ const char * envpath = getenv("LIBREOFFICE_FIREBIRD_LIB");
-+ if(envpath == nullptr)
-+ {
-+ envpath = getenv("LIBREOFFICE_ICU_LIB");
-+ }
-+ if(envpath != nullptr)
-+ {
-+ s = filename.c_str();
-+ PathUtils::concatPath(filename, envpath, s.c_str());
-+ }
- }
-
+@@ -354,6 +354,16 @@
+ {
+ s.printf(*p, majorVersion, minorVersion);
+ filename.printf(templateName, s.c_str());
++ const char * envpath = getenv("LIBREOFFICE_FIREBIRD_LIB");
++ if(envpath == nullptr)
++ {
++ envpath = getenv("LIBREOFFICE_ICU_LIB");
++ }
++ if(envpath != nullptr)
++ {
++ s = filename.c_str();
++ PathUtils::concatPath(filename, envpath, s.c_str());
++ }
+ ModuleLoader::Module* module = ModuleLoader::fixAndLoadModule(NULL, filename);
+ if (module)
--- 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 @@
diff --git a/external/firebird/firebird-rpath.patch.0 b/external/firebird/firebird-rpath.patch.0
index a730e72a84b1..bc9fd3a3f9ed 100644
--- a/external/firebird/firebird-rpath.patch.0
+++ b/external/firebird/firebird-rpath.patch.0
@@ -1,7 +1,7 @@
--- builds/posix/make.defaults
+++ builds/posix/make.defaults
-@@ -279,7 +279,7 @@
-
+@@ -292,7 +292,7 @@
+ LIB_PLATFORM_RPATH = -Wl,-rpath,$(1)
ifeq (@USE_RPATH@,1)
ifeq ($(strip @BINRELOC_CFLAGS@),)
- LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,$(if $(subst intl,,$(1)),@FB_LIBDIR@,@FB_INTLDIR@))
diff --git a/external/firebird/firebird-vs2017.patch.1 b/external/firebird/firebird-vs2017.patch.1
index 609f380a3e46..3c7db187485c 100644
--- a/external/firebird/firebird-vs2017.patch.1
+++ b/external/firebird/firebird-vs2017.patch.1
@@ -1,11 +1,12 @@
diff -ru firebird.orig/src/common/os/win32/mod_loader.cpp firebird/src/common/os/win32/mod_loader.cpp
--- firebird.orig/src/common/os/win32/mod_loader.cpp 2017-02-15 22:11:48.939042400 +0100
+++ firebird/src/common/os/win32/mod_loader.cpp 2017-02-15 22:12:30.062262700 +0100
-@@ -103,6 +103,6 @@
- "msvcr120.dll",
--#elif _MSC_VER == 1900
+@@ -101,7 +101,7 @@
+ "msvcr110.dll",
+ #elif _MSC_VER == 1800
+ "msvcr120.dll",
+-#elif _MSC_VER >= 1900 && _MSC_VER < 1920
+#elif _MSC_VER >= 1900 && _MSC_VER < 2000
"vcruntime140.dll",
#else
#error Specify CRT DLL name here !
- #endif
diff --git a/external/firebird/libc++.patch b/external/firebird/libc++.patch
deleted file mode 100644
index 270c0772a312..000000000000
--- a/external/firebird/libc++.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/common/classes/FpeControl.h
-+++ src/common/classes/FpeControl.h
-@@ -222,7 +222,7 @@
- {
- return (!_finite (x) && !isnan(x));
- }
--#else
-+#elif !defined _LIBCPP_VERSION || _LIBCPP_VERSION < 3900
- #ifndef isinf
- template <typename F>
- inline bool isinf(F x)
diff --git a/external/firebird/macos-arm64.patch.0 b/external/firebird/macos-arm64.patch.0
index ac9363784d4b..e11065a2e3bd 100644
--- a/external/firebird/macos-arm64.patch.0
+++ b/external/firebird/macos-arm64.patch.0
@@ -2,7 +2,7 @@
--- configure
+++ configure
@@ -2901,6 +2901,21 @@
- EXPORT_SYMBOLS_STYLE=darwin
+ RAW_DEVICES_FLG=N
;;
+ aarch64-*-darwin*)
@@ -31,14 +31,6 @@
main () {
struct s {
char a;
-@@ -21379,6 +21379,7 @@
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
-+#include <stdlib.h>
- main () {
- struct s {
- char a;
--- src/common/common.h
+++ src/common/common.h
@@ -234,6 +234,10 @@
diff --git a/external/firebird/sanitizer.patch b/external/firebird/sanitizer.patch
index e727d581e626..3707b5bf54af 100644
--- a/external/firebird/sanitizer.patch
+++ b/external/firebird/sanitizer.patch
@@ -52,29 +52,12 @@
--- src/common/os/posix/mod_loader.cpp
+++ src/common/os/posix/mod_loader.cpp
-@@ -88,7 +88,7 @@
+@@ -92,7 +92,7 @@
- ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath)
+ ModuleLoader::Module* ModuleLoader::loadModule(ISC_STATUS* status, const Firebird::PathName& modPath)
{
- void* module = dlopen(modPath.nullStr(), FB_RTLD_MODE);
+ void* module = dlopen(modPath.nullStr(), FB_RTLD_MODE | RTLD_GLOBAL);
if (module == NULL)
{
- #ifdef DEV_BUILD
---- src/jrd/met.epp
-+++ src/jrd/met.epp
-@@ -1486,10 +1486,11 @@
- USHORT offset = p[0] | (p[1] << 8);
- p += 2;
-
-- const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p;
-- p = (UCHAR*) (odsDflDesc + 1);
-+ Ods::Descriptor odsDflDesc;
-+ memcpy(&odsDflDesc, p, sizeof (Ods::Descriptor));
-+ p = (UCHAR*) (((Ods::Descriptor*) p) + 1);
-
-- dsc desc = *odsDflDesc;
-+ dsc desc = odsDflDesc;
- desc.dsc_address = const_cast<UCHAR*>(p);
- EVL_make_value(tdbb, &desc, &format->fmt_defaults[offset], relation->rel_pool);
-
+ if (status)
diff --git a/external/firebird/ubsan.patch b/external/firebird/ubsan.patch
index 5fe298539ec3..cd71997f0ba6 100644
--- a/external/firebird/ubsan.patch
+++ b/external/firebird/ubsan.patch
@@ -1,15 +1,15 @@
--- configure
+++ configure
-@@ -21349,7 +21349,7 @@
+@@ -21506,7 +21468,7 @@
char a;
- long long b;
+ union { long long x; sem_t y; } b;
};
- exit((int)&((struct s*)0)->b);
+ exit((int)&((struct s*)1024)->b - 1024);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
-@@ -21384,7 +21384,7 @@
+@@ -21541,7 +21503,7 @@
char a;
double b;
};
@@ -125,8 +125,8 @@
cachedLock = FB_NEW_RPT(getPool(), lockLen)
Lock(tdbb, lockLen, lckType, this, lockCaching ? blocking_ast_cached_lock : NULL);
-- memcpy(&cachedLock->lck_key, lockStr, lockLen);
-+ if (lockLen != 0) memcpy(&cachedLock->lck_key, lockStr, lockLen);
+- memcpy(cachedLock->getKeyString(), lockStr, lockLen);
++ if (lockLen != 0) memcpy(cachedLock->getKeyString(), lockStr, lockLen);
}
GlobalRWLock::~GlobalRWLock()
diff --git a/external/firebird/wnt-dbgutil.patch b/external/firebird/wnt-dbgutil.patch
index db859b64fbc7..94fbd1dff960 100644
--- a/external/firebird/wnt-dbgutil.patch
+++ b/external/firebird/wnt-dbgutil.patch
@@ -1,9 +1,10 @@
--- configure
+++ configure
-@@ -18402,44 +18402,6 @@
+@@ -18430,44 +18430,6 @@
+ as_fn_error $? "ICU support not found - please install development ICU package" "$LINENO" 5
fi
-
+-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -licuuc" >&5
-$as_echo_n "checking for main in -licuuc... " >&6; }
-if ${ac_cv_lib_icuuc_main+:} false; then :
@@ -41,13 +42,12 @@
-fi
-
-
--
- pre_save_restore_cflags=$CFLAGS
- pre_save_restore_cxxflags=$CXXFLAGS
- pre_save_restore_libs=$LIBS
+ if test "$TOMBUILD" = "Y"; then
+ MATHLIB=-ltommath
+ else
--- src/common/unicode_util.cpp
+++ src/common/unicode_util.cpp
-@@ -58,8 +58,13 @@
+@@ -55,8 +55,13 @@
namespace {
#if defined(WIN_NT)
@@ -59,5 +59,5 @@
const char* const ucTemplate = "icuuc%s.dll";
+#endif
#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 = "lib/libicui18n.%s.dylib";
+ const char* const ucTemplate = "lib/libicuuc.%s.dylib";