summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeve Jelbert2022-01-09 10:11:58 +0100
committerTreeve Jelbert2022-01-09 10:11:58 +0100
commit97a74640a13f5b8dabab68b8155595a28a2c3933 (patch)
tree8c83240c1ab79b6cd0faa5ebfd3c16da23c16c98
parent07808f914e904adca6ed567bc8fe0dff7270c360 (diff)
firebird4-4.0.1.2692-0
-rw-r--r--ChangeLog3
-rwxr-xr-xdatabase/firebird4/BUILD16
-rwxr-xr-xdatabase/firebird4/CONFIGURE6
-rwxr-xr-xdatabase/firebird4/CONFLICTS2
-rwxr-xr-xdatabase/firebird4/DEPENDS8
-rwxr-xr-xdatabase/firebird4/DETAILS22
-rwxr-xr-xdatabase/firebird4/FINAL26
-rw-r--r--database/firebird4/HISTORY8
-rwxr-xr-xdatabase/firebird4/INSTALL35
-rwxr-xr-xdatabase/firebird4/PREPARE17
-rwxr-xr-xdatabase/firebird4/PRE_BUILD8
-rwxr-xr-xdatabase/firebird4/PROVIDES2
-rw-r--r--database/firebird4/excluded1
-rwxr-xr-xdatabase/firebird4/init.d/firebird444
-rw-r--r--database/firebird4/patches/0001-cmake-fix-copy-files-cmake-delete-obsolete-code.patch63
-rw-r--r--database/firebird4/patches/0002-btyacc-fix-mktemp-usage.patch35
-rw-r--r--database/firebird4/patches/0003-fix-detection-fo-gettimeofday-and-pthread-for-glibc-.patch49
-rw-r--r--database/firebird4/patches/0004-find-and-use-system-libraries-libtommath-libtomcrypt.patch178
-rw-r--r--database/firebird4/patches/0005-fix-FB_TZDATADIR-usage.patch27
-rw-r--r--database/firebird4/patches/0006-cmake-fix-for-SecDbCache.patch37
-rw-r--r--database/firebird4/patches/0007-re2-now-default-to-utf8.patch32
-rw-r--r--database/firebird4/patches/0008-cmake-tweaks.patch62
-rw-r--r--database/firebird4/patches/0009-cmake-3.16-fix.patch34
23 files changed, 715 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e1f718eb94..5cae5e7aea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2022-01-09 Treeve Jelbert <treeve@sourcemage.org>
+ * database/firebird4: added
+
2022-01-05 Treeve Jelbert <treeve@sourcemage.org>
* gnu.gpg: add Bruno Haible
* kf5-only/*: move multiple deprecated spells here
diff --git a/database/firebird4/BUILD b/database/firebird4/BUILD
new file mode 100755
index 0000000000..1b6abace60
--- /dev/null
+++ b/database/firebird4/BUILD
@@ -0,0 +1,16 @@
+CXXFLAGS+=" -Wno-narrowing -Wno-deprecated-declarations -Wno-invalid-offsetof" &&
+#CXXFLAGS+=" -fno-sized-deallocation -fno-delete-null-pointer-checks -flifetime-dse=1 -fcheck-new" &&
+CXXFLAGS+=" -Wno-deprecated" &&
+CXXFLAGS+=" -Wno-stringop-overflow" &&
+CXXFLAGS+=" -fPIC" &&
+persistent_add FB_PREFIX &&
+export FB_PREFIX=${INSTALL_ROOT}/opt/firebird4 &&
+cmake_build $FB_PREFIX &&
+
+cd $SOURCE_DIRECTORY/build &&
+if is_depends_enabled $SPELL ninja-build-system; then
+#if [[ $CMAKE_GEN == Ninja ]];then
+ ninja copy_files
+else
+ make copy_files
+fi
diff --git a/database/firebird4/CONFIGURE b/database/firebird4/CONFIGURE
new file mode 100755
index 0000000000..0f3056544e
--- /dev/null
+++ b/database/firebird4/CONFIGURE
@@ -0,0 +1,6 @@
+source $GRIMOIRE/CMAKE_CONFIGURE
+#source $GRIMOIRE/FUNCTIONS &&
+# config_query_multi FB_GPRE "which additional GPRE languages to support?" \
+# none ada cobol pascal fortran &&
+# config_query_option FB_STAT "build static libraries?" n "--enable-static" "--disable-static"
+
diff --git a/database/firebird4/CONFLICTS b/database/firebird4/CONFLICTS
new file mode 100755
index 0000000000..5e015fddb7
--- /dev/null
+++ b/database/firebird4/CONFLICTS
@@ -0,0 +1,2 @@
+conflicts firebird3 &&
+conflicts firebird25
diff --git a/database/firebird4/DEPENDS b/database/firebird4/DEPENDS
new file mode 100755
index 0000000000..447f44a7b4
--- /dev/null
+++ b/database/firebird4/DEPENDS
@@ -0,0 +1,8 @@
+source $GRIMOIRE/CMAKE_DEPENDS &&
+depends -sub CXX gcc &&
+depends icu &&
+depends libedit &&
+depends libtomcrypt &&
+depends libtommath &&
+depends re2 &&
+depends zlib
diff --git a/database/firebird4/DETAILS b/database/firebird4/DETAILS
new file mode 100755
index 0000000000..4e2fcfb07a
--- /dev/null
+++ b/database/firebird4/DETAILS
@@ -0,0 +1,22 @@
+ SPELL=firebird4
+ SPELLX=Firebird
+ VERSION=4.0.1.2692-0
+ SOURCE_HASH=sha512:e5bda60a20bc978be365c147ade0f309a65e52e755bfc734c00d1254f5b13238dccaedc49a2e6fb04bdcc0fa4c7ac4e78729e61debd6bd98618de253991b9fe7
+ PATCHLEVEL=1
+# SECURTIY_PATCH=1
+ VX=v${VERSION%.*}
+SOURCE_DIRECTORY=$BUILD_DIRECTORY/${SPELLX}-${VERSION}
+ SOURCE=${SPELLX}-$VERSION.tar.xz
+ SOURCE_URL[0]=https://github.com/FirebirdSQL/firebird/releases/download/$VX/$SOURCE
+ WEB_SITE=https://www.firebirdsql.org
+ LICENSE=IDPL
+ ENTERED=20210109
+ GATHER_DOCS=off
+ KEYWORDS="database engine"
+ SHORT="a very powerful relational dbms"
+cat << EOF
+Firebird is a relational database offering many ANSI SQL-92 features
+that runs on Linux, Windows, and a variety of Unix platforms.
+Firebird offers excellent concurrency, high performance, and powerful
+language support for stored procedures and triggers.
+EOF
diff --git a/database/firebird4/FINAL b/database/firebird4/FINAL
new file mode 100755
index 0000000000..d75313fb9b
--- /dev/null
+++ b/database/firebird4/FINAL
@@ -0,0 +1,26 @@
+# we do this here, so that things are not tracked, as these files are
+# constantly modified in normal use
+local LOG &&
+
+cd $FB_PREFIX &&
+# log file
+ mkdir -p $INSTALL_ROOT/var/log/ &&
+ LOG=$INSTALL_ROOT/var/log/firebird.log &&
+ touch $LOG &&
+ chown firebird:firebird $LOG &&
+ chmod o=,ug=rw $LOG &&
+mkdir -p $INSTALL_ROOT/var/run/firebird4
+message "\n${PROBLEM_COLOR}Creating a SYSDBA user:" \
+ "$MESSAGE_COLOR" \
+ "\nThe Firebird4 install process does not create a SYSDBA user." \
+ "\n" \
+ "\nThis must be done before starting the firebird server:" \
+ "\nSee the section 'Initializing the Security Database (Chapter 12)' in " \
+ "Firebird-4.*-ReleaseNotes.pdf" \
+ "\n" \
+ "\nThe default security database is /etc/firebird4/security4.fdb" \
+ "\n" \
+ "If you have any existing Firebird databases, please read\n" \
+ "/opt/firebird4/doc/README.incompatibilities.3to4.txt\n" \
+ "$DEFAULT_COLOR"
+
diff --git a/database/firebird4/HISTORY b/database/firebird4/HISTORY
new file mode 100644
index 0000000000..f68bd02e02
--- /dev/null
+++ b/database/firebird4/HISTORY
@@ -0,0 +1,8 @@
+2022-01-09 Treeve Jelbert <treeve@sourcemage.org>
+ * DETAILS: version 4.0.1.2692-0
+ * patches/*: fix cmake build
+
+2017-04-02 Treeve Jelbert <treeve@sourcemage.org>
+ * DETAILS: version git
+ new spell - test future version 4.0 of Firebird
+
diff --git a/database/firebird4/INSTALL b/database/firebird4/INSTALL
new file mode 100755
index 0000000000..1479489776
--- /dev/null
+++ b/database/firebird4/INSTALL
@@ -0,0 +1,35 @@
+BLD=$SOURCE_DIRECTORY/build &&
+SRC=$SOURCE_DIRECTORY &&
+cd $BLD/firebird &&
+local DEST &&
+# config files
+DEST=$INSTALL_ROOT/etc/firebird4 &&
+
+mkdir -p $DEST &&
+# treate the security db as a config file
+install_config_file security4.fdb $DEST/security4.fdb &&
+# link to config files
+FROM=$FB_PREFIX &&
+mkdir -p $FROM &&
+TGT=$TRACK_ROOT/etc/firebird4 &&
+ln -vsf $TGT/security4.fdb $FROM &&
+cd $SRC/builds/install/misc &&
+for FF in firebird databases plugins replication; do
+ install_config_file $FF.conf $DEST/$FF.conf &&
+ ln -vsf $TGT/$FF.conf $FROM
+done &&
+chown -Rv firebird:firebird $DEST &&
+
+cd $BLD/firebird &&
+# remove spurious log files
+rm -f lib/*log bin/*log &&
+DEST=$FB_PREFIX &&
+# install the built tree
+cp -a * $DEST &&
+
+cd $BLD/src &&
+cp msg.fdb help.fdb $DEST &&
+
+# need a symlink for firebird.log
+TGT=$TRACK_ROOT/var/log/firebird.log &&
+ln -vsf $TGT $DEST
diff --git a/database/firebird4/PREPARE b/database/firebird4/PREPARE
new file mode 100755
index 0000000000..ce1e81df7a
--- /dev/null
+++ b/database/firebird4/PREPARE
@@ -0,0 +1,17 @@
+# warn about need for backup/restore of existing databases
+if ( spell_ok firebird3 ) || ( spell_ok firebird25 ) || (spell_ok firebird );then
+ message "${PROBLEM_COLOR}Firebird4 cannot read old databases!" \
+ "$MESSAGE_COLOR" \
+ "\nbefore installing this program, use gbak from your existing firebird installation " \
+ "to make backup copies of your existing databases." \
+ "\nAfter installing Firebird4, use the new gbak to restore the databases" \
+ " in the new format." \
+ ${DEFAULT_COLOR}
+fi
+
+# check for running server
+ (ps -u firebird ) &&
+ message ${PROBLEM_COLOR}please stop the firebird server and try again\
+ ${DEFAULT_COLOR} &&
+ return 1
+return 0
diff --git a/database/firebird4/PRE_BUILD b/database/firebird4/PRE_BUILD
new file mode 100755
index 0000000000..f90a6bceee
--- /dev/null
+++ b/database/firebird4/PRE_BUILD
@@ -0,0 +1,8 @@
+create_account firebird &&
+default_pre_build &&
+cd $SOURCE_DIRECTORY &&
+mkdir build &&
+BLD=$SOURCE_DIRECTORY/build &&
+cd $SOURCE_DIRECTORY &&
+apply_patch_dir patches
+
diff --git a/database/firebird4/PROVIDES b/database/firebird4/PROVIDES
new file mode 100755
index 0000000000..64d87278dd
--- /dev/null
+++ b/database/firebird4/PROVIDES
@@ -0,0 +1,2 @@
+SQL
+FIREBIRD
diff --git a/database/firebird4/excluded b/database/firebird4/excluded
new file mode 100644
index 0000000000..20fdb918f8
--- /dev/null
+++ b/database/firebird4/excluded
@@ -0,0 +1 @@
+^/opt/firebird4/firebird.log
diff --git a/database/firebird4/init.d/firebird4 b/database/firebird4/init.d/firebird4
new file mode 100755
index 0000000000..b3896935fd
--- /dev/null
+++ b/database/firebird4/init.d/firebird4
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# description: Start/Stop firebird4 database server
+#
+# This file belongs in /etc/init.d where it will be run
+# on system startup and shutdown to start the background
+# Firebird4 database Super server daemon
+
+FB_DIR=/opt/firebird4/bin
+FB=firebird
+# preferred method of stopping is to kill the process
+
+source /etc/init.d/smgl_functions
+
+PROGRAM=/bin/false
+RUNLEVEL=3
+NEEDS="+network +remote_fs"
+
+case $1 in
+ start)
+ mkdir -p /var/run/firebird # may be a tmpfs, so create it
+ chown firebird:firebird /var/run/firebird
+ chmod o=,ug=rwx /var/run/firebird
+ echo "Starting Firebird4 Server"
+ su -s "/bin/sh" -c "$FB_DIR/$FB" -l "firebird" &
+ evaluate_retval
+ ;;
+ stop)
+ echo "Stopping Firebird4 server"
+ pkill -9 $FB
+ evaluate_retval
+ ;;
+
+ restart)
+ echo "Restarting Firebird4 server"
+ $0 stop
+ $0 start
+ evaluate_retval
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
diff --git a/database/firebird4/patches/0001-cmake-fix-copy-files-cmake-delete-obsolete-code.patch b/database/firebird4/patches/0001-cmake-fix-copy-files-cmake-delete-obsolete-code.patch
new file mode 100644
index 0000000000..0b72add9d3
--- /dev/null
+++ b/database/firebird4/patches/0001-cmake-fix-copy-files-cmake-delete-obsolete-code.patch
@@ -0,0 +1,63 @@
+From 3fbbe5e2bb862c844608769b3671185afbf055a2 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 1 Jan 2021 11:55:05 +0100
+Subject: [PATCH 1/9] cmake - fix copy files cmake - delete obsolete code
+
+---
+ src/CMakeLists.txt | 25 +++++++++++--------------
+ 1 file changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index b890c4ea8b..fa7d018d98 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -939,7 +939,6 @@ add_custom_target(copy_files
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/yvalve/perf.h ${output_dir}/include/perf.h
+ )
+ add_dependencies_cc (copy_files databases)
+-add_dependencies_unix_cc(copy_files makeHeader)
+ project_group(copy_files "Custom build steps")
+
+ # headers
+@@ -1026,27 +1025,25 @@ if (UNIX)
+
+ if (NOT CMAKE_CROSSCOMPILING)
+
+- add_executable (makeHeader misc/makeHeader.cpp)
+- set_output_directory (makeHeader . CURRENT_DIR)
+ set(files
+- ${CMAKE_SOURCE_DIR}/src/include/types_pub.h
+- ${CMAKE_SOURCE_DIR}/src/include/consts_pub.h
+- ${CMAKE_SOURCE_DIR}/src/dsql/sqlda_pub.h
+- ${CMAKE_SOURCE_DIR}/src/common/dsc_pub.h
+- ${CMAKE_SOURCE_DIR}/src/jrd/ibase.h
+- ${CMAKE_SOURCE_DIR}/src/jrd/inf_pub.h
+- ${CMAKE_SOURCE_DIR}/src/jrd/blr.h
++ ${CMAKE_SOURCE_DIR}/src/include/ibase.h
+ ${CMAKE_SOURCE_DIR}/src/include/gen/iberror.h
+ )
+ foreach(F ${files})
+ get_filename_component(name ${F} NAME)
+ add_custom_command(TARGET copy_files POST_BUILD
+- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${name})
++ COMMAND ${CMAKE_COMMAND} -E copy ${F} ${output_dir}/include/${name})
+ endforeach()
+- add_custom_command(TARGET copy_files POST_BUILD
+- # include
+- COMMAND makeHeader < ibase.h > ${output_dir}/include/ibase.h
++
++
++ set(imp_files
++ blr.h consts_pub.h dsc_pub.h inf_pub.h sqlda_pub.h types_pub.h
+ )
++ foreach(F ${imp_files})
++ add_custom_command(TARGET copy_files POST_BUILD
++ COMMAND ${CMAKE_COMMAND} -E copy
++ ${CMAKE_SOURCE_DIR}/src/include/firebird/impl/${F} ${output_dir}/include/firebird/impl/${F})
++ endforeach()
+
+ endif() # if (NOT CMAKE_CROSSCOMPILING)
+ endif()
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0002-btyacc-fix-mktemp-usage.patch b/database/firebird4/patches/0002-btyacc-fix-mktemp-usage.patch
new file mode 100644
index 0000000000..466c2b1a0c
--- /dev/null
+++ b/database/firebird4/patches/0002-btyacc-fix-mktemp-usage.patch
@@ -0,0 +1,35 @@
+From d5a5b3ca3a4c8de61f7f7c50a9f21123f22e5dd5 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 7 Aug 2020 12:25:06 +0200
+Subject: [PATCH 2/9] btyacc - fix mktemp usage
+
+---
+ extern/btyacc/main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/extern/btyacc/main.c b/extern/btyacc/main.c
+index 6ac4cbd850..240520cdfd 100644
+--- a/extern/btyacc/main.c
++++ b/extern/btyacc/main.c
+@@ -341,15 +341,15 @@ void create_file_names()
+ text_file_name[len + 5] = 't';
+ union_file_name[len + 5] = 'u';
+
+- if(mktemp(action_file_name) == NULL) {
++ if(mkstemp(action_file_name) == -1) {
+ fprintf(stderr, "btyacc: Cannot create temporary file\n");
+ exit(1);
+ }
+- if(mktemp(text_file_name) == NULL) {
++ if(mkstemp(text_file_name) == -1) {
+ fprintf(stderr, "btyacc: Cannot create temporary file\n");
+ exit(1);
+ }
+- if(mktemp(union_file_name) == NULL) {
++ if(mkstemp(union_file_name) == -1) {
+ fprintf(stderr, "btyacc: Cannot create temporary file\n");
+ exit(1);
+ }
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0003-fix-detection-fo-gettimeofday-and-pthread-for-glibc-.patch b/database/firebird4/patches/0003-fix-detection-fo-gettimeofday-and-pthread-for-glibc-.patch
new file mode 100644
index 0000000000..f6e7ed4846
--- /dev/null
+++ b/database/firebird4/patches/0003-fix-detection-fo-gettimeofday-and-pthread-for-glibc-.patch
@@ -0,0 +1,49 @@
+From 4e158b3959de188bef6335d736e4ca31f322e4c3 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Sun, 15 Nov 2020 20:42:53 +0100
+Subject: [PATCH 3/9] fix detection fo gettimeofday and pthread* for glibc-2,32
+
+---
+ builds/cmake/Configure.cmake | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/builds/cmake/Configure.cmake b/builds/cmake/Configure.cmake
+index 9faa0e50eb..b9ebd4d390 100644
+--- a/builds/cmake/Configure.cmake
++++ b/builds/cmake/Configure.cmake
+@@ -244,6 +244,7 @@ set(functions_list
+ time times
+ vfork
+ )
++set(CMAKE_REQUIRED_LIBRARIES pthread)
+ check_functions(functions_list)
+
+ if (APPLE)
+@@ -287,13 +288,11 @@ set(CMAKE_EXTRA_INCLUDE_FILES Windows.h)
+ check_type_size("char[MAX_PATH]" MAXPATHLEN)
+ set(CMAKE_EXTRA_INCLUDE_FILES)
+
+-set(TIMEZONE_TYPE "struct timezone")
+-if (APPLE OR MINGW)
+- set(TIMEZONE_TYPE "void")
+-endif()
++# SINCE GLIBC-2.31
++#set(TIMEZONE_TYPE "void")
+ check_prototype_definition(
+ gettimeofday
+- "int gettimeofday(struct timeval *tv, ${TIMEZONE_TYPE} *tz)"
++ "int gettimeofday(struct timeval *tv, void *tz)"
+ 0
+ "sys/time.h"
+ GETTIMEOFDAY_RETURNS_TIMEZONE
+@@ -315,7 +314,6 @@ check_c_source_compiles("#include <unistd.h>\nmain(){setpgrp();}" SETPGRP_VOID)
+ check_c_source_compiles("__thread int a = 42;main(){a = a + 1;}" HAVE___THREAD)
+ check_c_source_compiles("#include <sys/time.h>\n#include <time.h>\nmain(){}" TIME_WITH_SYS_TIME)
+
+-set(CMAKE_REQUIRED_LIBRARIES pthread)
+ check_c_source_compiles("#include <semaphore.h>\nmain(){sem_t s;sem_init(&s,0,0);}" WORKING_SEM_INIT)
+ set(CMAKE_REQUIRED_LIBRARIES)
+
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0004-find-and-use-system-libraries-libtommath-libtomcrypt.patch b/database/firebird4/patches/0004-find-and-use-system-libraries-libtommath-libtomcrypt.patch
new file mode 100644
index 0000000000..86bf79a575
--- /dev/null
+++ b/database/firebird4/patches/0004-find-and-use-system-libraries-libtommath-libtomcrypt.patch
@@ -0,0 +1,178 @@
+From 31a29b4ecaadf5445d916ea0930ebb8079d1c85b Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 1 Jan 2021 12:36:46 +0100
+Subject: [PATCH 4/9] find and use system libraries libtommath, libtomcrypt,
+ re2, libedit
+
+---
+ CMakeLists.txt | 31 +++++++++++--------------------
+ builds/cmake/Configure.cmake | 1 -
+ src/CMakeLists.txt | 6 +++---
+ src/common/SimilarToRegex.h | 2 +-
+ src/include/gen/autoconfig.h.in | 4 ++--
+ src/isql/isql.epp | 6 +-----
+ 6 files changed, 18 insertions(+), 32 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 620fd032af..74f895436c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,7 +17,7 @@
+ #
+ ################################################################################
+
+-cmake_minimum_required(VERSION 2.8.12)
++cmake_minimum_required(VERSION 3.19)
+
+ # In-source builds are not possible and so disabled.
+ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+@@ -216,7 +216,7 @@ if (UNIX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -msse4 -std=c++11")
+
+ if (NOT CMAKE_CROSSCOMPILING)
+- set(LIB_readline readline)
++ set(LIB_readline edit)
+ endif()
+ if (NOT FREEBSD)
+ set(LIB_dl dl)
+@@ -329,40 +329,31 @@ endif() # if (NOT CMAKE_CROSSCOMPILING)
+
+ crosscompile_prebuild_steps()
+
+-include_directories("extern/libtommath")
+-include_directories("extern/libtomcrypt/src/headers")
+ include_directories("extern/decNumber")
+-include_directories("extern/icu/include")
+-include_directories("extern/zlib")
+
+ include_directories("src/include")
+ include_directories("src/include/gen")
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include")
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include/gen")
+
++# some more system libraries
++#
++find_package (PkgConfig REQUIRED)
++pkg_check_modules(REQUIRED IMPORTED_TARGET libedit libtommath libtomcrypt)
++
++find_package (re2 REQUIRED)
++find_package (ZLIB REQUIRED)
++
++
+ ########################################
+ # LIBRARY libtommath
+ ########################################
+
+-file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h")
+-
+-add_library (libtommath ${libtommath_src})
+-project_group (libtommath Extern)
+-
+
+ ########################################
+ # LIBRARY libtomcrypt
+ ########################################
+
+-file(GLOB_RECURSE libtomcrypt_src "extern/libtomcrypt/src/*")
+-list(FILTER libtomcrypt_src EXCLUDE REGEX ".*aes_tab.c")
+-list(FILTER libtomcrypt_src EXCLUDE REGEX ".*whirltab.c")
+-list(FILTER libtomcrypt_src EXCLUDE REGEX ".*sober128tab.c")
+-
+-add_library (libtomcrypt ${libtomcrypt_src})
+-target_compile_definitions (libtomcrypt PRIVATE LTC_NO_ROLC LTC_SOURCE)
+-project_group (libtomcrypt Extern)
+-
+
+ ########################################
+ # LIBRARY decNumber
+diff --git a/builds/cmake/Configure.cmake b/builds/cmake/Configure.cmake
+index b9ebd4d390..6be5fe9b71 100644
+--- a/builds/cmake/Configure.cmake
++++ b/builds/cmake/Configure.cmake
+@@ -124,7 +124,6 @@ set(include_files_list
+ ctype.h
+ dirent.h
+ dlfcn.h
+- editline.h
+ errno.h
+ fcntl.h
+ float.h
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index fa7d018d98..ae9d6dc811 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -373,7 +373,7 @@ if (APPLE)
+ endif()
+
+ add_library (common ${common_src} ${common_os_src} ${common_include})
+-target_link_libraries (common ${LIB_mpr} libtommath libtomcrypt decNumber)
++target_link_libraries (common ${LIB_mpr} tommath tomcrypt decNumber)
+ add_dependencies_cc (common UpdateCloopInterfaces)
+ if (UNIX)
+ target_link_libraries (common dl)
+@@ -420,7 +420,7 @@ target_link_libraries (boot_yvalve
+ PRIVATE remote
+ PRIVATE common
+ PUBLIC ${LIB_Ws2_32}
+- PUBLIC ${LIB_readline}
++ PUBLIC edit
+ PUBLIC ${LIB_dl}
+ PUBLIC ${LIB_iconv}
+ PUBLIC ${LIB_CoreFoundation}
+@@ -442,7 +442,7 @@ target_link_libraries (yvalve
+ PRIVATE remote
+ PRIVATE common
+ PUBLIC ${LIB_Ws2_32}
+- PUBLIC ${LIB_readline}
++ PUBLIC edit
+ PUBLIC ${LIB_dl}
+ PUBLIC ${LIB_iconv}
+ PUBLIC ${LIB_CoreFoundation}
+diff --git a/src/common/SimilarToRegex.h b/src/common/SimilarToRegex.h
+index 89b8121a1a..f8d059f7d4 100644
+--- a/src/common/SimilarToRegex.h
++++ b/src/common/SimilarToRegex.h
+@@ -22,7 +22,7 @@
+ #define FB_COMMON_SIMILAR_TO_REGEX_H
+
+ #include "firebird.h"
+-#include "re2/re2.h"
++#include <re2/re2.h>
+ #include "../common/classes/auto.h"
+ #include "../common/classes/array.h"
+ #include "../common/classes/fb_string.h"
+diff --git a/src/include/gen/autoconfig.h.in b/src/include/gen/autoconfig.h.in
+index f0e06cbd54..e0df757602 100644
+--- a/src/include/gen/autoconfig.h.in
++++ b/src/include/gen/autoconfig.h.in
+@@ -192,8 +192,8 @@
+ /* Define to 1 if you have the <dlfcn.h> header file. */
+ #cmakedefine HAVE_DLFCN_H 1
+
+-/* Define to 1 if you have the <editline.h> header file. */
+-#cmakedefine HAVE_EDITLINE_H 1
++/* Define to 1 if you have the <editlib/readline.h> header file. */
++#define HAVE_EDITLINE_H 1
+
+ /* Define to 1 if you have the <errno.h> header file. */
+ #cmakedefine HAVE_ERRNO_H 1
+diff --git a/src/isql/isql.epp b/src/isql/isql.epp
+index 79da1f753a..f700de09c7 100644
+--- a/src/isql/isql.epp
++++ b/src/isql/isql.epp
+@@ -80,11 +80,7 @@
+ #include <locale.h>
+ #endif
+
+-#ifdef HAVE_EDITLINE_H
+-// This is a local file included in our distribution - but not always
+-// compiled into the system
+-#include "editline.h"
+-#endif
++#include <editline/readline.h>
+
+ enum literal_string_type
+ {
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0005-fix-FB_TZDATADIR-usage.patch b/database/firebird4/patches/0005-fix-FB_TZDATADIR-usage.patch
new file mode 100644
index 0000000000..242d54228c
--- /dev/null
+++ b/database/firebird4/patches/0005-fix-FB_TZDATADIR-usage.patch
@@ -0,0 +1,27 @@
+From c9181049bd0d6a3a9246efc5cb9d44f513ba502c Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Sat, 2 Jan 2021 12:33:02 +0100
+Subject: [PATCH 5/9] fix FB_TZDATADIR usage
+
+---
+ src/include/gen/autoconfig.h.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/include/gen/autoconfig.h.in b/src/include/gen/autoconfig.h.in
+index e0df757602..d5c49781e4 100644
+--- a/src/include/gen/autoconfig.h.in
++++ b/src/include/gen/autoconfig.h.in
+@@ -162,6 +162,10 @@
+ #define FB_SECDBDIR "@FB_SECDBDIR@"
+
+
++/* Time Zone data */
++//#define FB_TZDATADIR "@FB_TZDATADIR@"
++#define FB_TZDATADIR "@tzdata@"
++
+ /******************************************************************************
+ *
+ * Headers
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0006-cmake-fix-for-SecDbCache.patch b/database/firebird4/patches/0006-cmake-fix-for-SecDbCache.patch
new file mode 100644
index 0000000000..ee897b40c5
--- /dev/null
+++ b/database/firebird4/patches/0006-cmake-fix-for-SecDbCache.patch
@@ -0,0 +1,37 @@
+From 5b71ae808495b13dae81b32c39030bcf73374ac4 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Tue, 11 Feb 2020 16:06:07 +0100
+Subject: [PATCH 6/9] cmake fix for SecDbCache
+
+---
+ src/CMakeLists.txt | 1 +
+ src/remote/CMakeLists.txt | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index ae9d6dc811..0d0c1d1e3c 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -396,6 +396,7 @@ file(GLOB_RECURSE yvalve_include "yvalve/*.h")
+ set(yvalve_src ${yvalve_src}
+ auth/SecureRemotePassword/client/SrpClient.cpp
+ auth/SecurityDatabase/LegacyClient.cpp
++ auth/SecDbCache.cpp
+ plugins/crypt/arc4/Arc4.cpp
+ remote/client/BlrFromMessage.cpp
+ remote/client/interface.cpp
+diff --git a/src/remote/CMakeLists.txt b/src/remote/CMakeLists.txt
+index 49d6dac09b..52e19c2649 100644
+--- a/src/remote/CMakeLists.txt
++++ b/src/remote/CMakeLists.txt
+@@ -15,6 +15,7 @@ set(remote_src
+ ../auth/SecureRemotePassword/srp.h
+ ../auth/SecureRemotePassword/Message.h
+ ../auth/trusted/AuthSspi.cpp
++ ../auth/SecDbCache.cpp
+ )
+ add_src_win32(remote_src
+ os/win32/wnet.cpp
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0007-re2-now-default-to-utf8.patch b/database/firebird4/patches/0007-re2-now-default-to-utf8.patch
new file mode 100644
index 0000000000..7f66de9549
--- /dev/null
+++ b/database/firebird4/patches/0007-re2-now-default-to-utf8.patch
@@ -0,0 +1,32 @@
+From e7bed8383e6ada4ed939279f811cec7233166424 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 9 Jul 2021 20:39:43 +0200
+Subject: [PATCH 7/9] re2 now default to utf8
+
+---
+ src/common/SimilarToRegex.cpp | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/common/SimilarToRegex.cpp b/src/common/SimilarToRegex.cpp
+index b54fce5cd2..723cad6e5a 100644
+--- a/src/common/SimilarToRegex.cpp
++++ b/src/common/SimilarToRegex.cpp
+@@ -110,7 +110,6 @@ namespace
+ options.set_log_errors(false);
+ options.set_dot_nl(true);
+ options.set_case_sensitive(!(flags & COMP_FLAG_CASE_INSENSITIVE));
+- options.set_utf8(!(flags & COMP_FLAG_LATIN));
+
+ re2::StringPiece sp((const char*) re2PatternStr.c_str(), re2PatternStr.length());
+ regexp = FB_NEW_POOL(pool) RE2(sp, options);
+@@ -761,7 +760,6 @@ namespace
+ options.set_log_errors(false);
+ options.set_dot_nl(true);
+ options.set_case_sensitive(!(flags & COMP_FLAG_CASE_INSENSITIVE));
+- options.set_utf8(!(flags & COMP_FLAG_LATIN));
+
+ re2::StringPiece sp((const char*) finalRe2Pattern.c_str(), finalRe2Pattern.length());
+ regexp = FB_NEW_POOL(pool) RE2(sp, options);
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0008-cmake-tweaks.patch b/database/firebird4/patches/0008-cmake-tweaks.patch
new file mode 100644
index 0000000000..7faf113e4d
--- /dev/null
+++ b/database/firebird4/patches/0008-cmake-tweaks.patch
@@ -0,0 +1,62 @@
+From e77f2e44fb50cd4e59e76dca16f8e263028813d9 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 9 Jul 2021 20:40:47 +0200
+Subject: [PATCH 8/9] cmake - tweaks
+
+---
+ src/CMakeLists.txt | 4 ++--
+ src/remote/CMakeLists.txt | 5 ++---
+ 2 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 0d0c1d1e3c..7cce834a0b 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -373,7 +373,7 @@ if (APPLE)
+ endif()
+
+ add_library (common ${common_src} ${common_os_src} ${common_include})
+-target_link_libraries (common ${LIB_mpr} tommath tomcrypt decNumber)
++target_link_libraries (common ${LIB_mpr} tommath tomcrypt decNumber re2)
+ add_dependencies_cc (common UpdateCloopInterfaces)
+ if (UNIX)
+ target_link_libraries (common dl)
+@@ -504,7 +504,7 @@ add_dependencies_cc (engine_common parse UpdateCloopInterfaces)
+ if (NOT CMAKE_CROSSCOMPILING)
+
+ add_library (boot_engine SHARED ${engine_generated_src_boot} ${VERSION_RC})
+-target_link_libraries (boot_engine engine_common boot_alice boot_burp common boot_yvalve)
++target_link_libraries (boot_engine engine_common boot_alice boot_burp common boot_yvalve remote)
+ set_output_directory (boot_engine plugins CURRENT_DIR)
+ set_exported_symbols (boot_engine fbplugin)
+ copy_and_rename_lib (boot_engine Engine13)
+diff --git a/src/remote/CMakeLists.txt b/src/remote/CMakeLists.txt
+index 52e19c2649..7e24f0b769 100644
+--- a/src/remote/CMakeLists.txt
++++ b/src/remote/CMakeLists.txt
+@@ -37,6 +37,8 @@ add_dependencies_cc (remote UpdateCloopInterfaces)
+ set(fbserver_src
+ ../auth/SecureRemotePassword/server/SrpServer.cpp
+ ../auth/SecureRemotePassword/server/SrpServer.h
++ server/ReplServer.cpp
++ server/server.cpp
+ )
+ add_src_win32(fbserver_src
+ server/os/win32/chop.cpp
+@@ -47,13 +49,10 @@ add_src_win32(fbserver_src
+ server/os/win32/server.ico
+ server/os/win32/caution.ico
+ server/os/win32/window.rc
+- server/ReplServer.cpp
+- server/server.cpp
+ )
+ add_src_unix(fbserver_src
+ ../auth/SecureRemotePassword/srp.cpp
+ server/os/posix/inet_server.cpp
+- server/server.cpp
+
+ inet.cpp
+ merge.cpp
+--
+2.32.0
+
diff --git a/database/firebird4/patches/0009-cmake-3.16-fix.patch b/database/firebird4/patches/0009-cmake-3.16-fix.patch
new file mode 100644
index 0000000000..a89ab620ba
--- /dev/null
+++ b/database/firebird4/patches/0009-cmake-3.16-fix.patch
@@ -0,0 +1,34 @@
+From 6305d7234624616371ba84251e96cc98810fe6c3 Mon Sep 17 00:00:00 2001
+From: Treeve Jelbert <treeve@sourcemage.org>
+Date: Fri, 9 Jul 2021 21:50:31 +0200
+Subject: [PATCH 9/9] cmake-3.16 fix
+
+---
+ src/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 7cce834a0b..1e3199d6d6 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -270,7 +270,7 @@ add_custom_target(parse
+ SOURCES ${parse_src} y_tab.h y_tab.c
+ )
+ project_group(parse "Boot/Custom build steps")
+-set_source_files_properties(dsql/parse.cpp include/gen/parse.h PROPERTIES GENERATED TRUE)
++set_source_files_properties(dsql/parse.cpp ${CMAKE_CURRENT_BINARY_DIR}/include/gen/parse.h PROPERTIES GENERATED TRUE)
+
+
+ ########################################
+@@ -374,7 +374,7 @@ endif()
+
+ add_library (common ${common_src} ${common_os_src} ${common_include})
+ target_link_libraries (common ${LIB_mpr} tommath tomcrypt decNumber re2)
+-add_dependencies_cc (common UpdateCloopInterfaces)
++add_dependencies_cc (common UpdateCloopInterfaces parse)
+ if (UNIX)
+ target_link_libraries (common dl)
+ endif()
+--
+2.32.0
+