aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--databases/Makefile2
-rw-r--r--databases/firebird40-client/Makefile12
-rw-r--r--databases/firebird40-server/Makefile204
-rw-r--r--databases/firebird40-server/distinfo3
-rw-r--r--databases/firebird40-server/files/firebird.in61
-rw-r--r--databases/firebird40-server/files/patch-builds-posix-prefix.freebsd19
-rw-r--r--databases/firebird40-server/files/patch-builds-posix-prefix.freebsd_amd6419
-rw-r--r--databases/firebird40-server/files/patch-builds-posix_Makefile.in28
-rw-r--r--databases/firebird40-server/files/patch-builds-posix_Makefile.in.plugins_examples11
-rw-r--r--databases/firebird40-server/files/patch-builds_posix_empty.vers9
-rw-r--r--databases/firebird40-server/files/patch-builds_posix_make.defaults64
-rw-r--r--databases/firebird40-server/files/patch-examples-exauth_Makefile13
-rw-r--r--databases/firebird40-server/files/patch-extern_btyacc_Makefile12
-rw-r--r--databases/firebird40-server/files/patch-extern_cloop_Makefile24
-rw-r--r--databases/firebird40-server/files/patch-src-jrd-os-posix_unix.cpp25
-rw-r--r--databases/firebird40-server/files/patch-src_remote_SockAddr.h25
-rw-r--r--databases/firebird40-server/files/patch-src_remote_inet.cpp25
-rw-r--r--databases/firebird40-server/files/pkg-message.in43
-rw-r--r--databases/firebird40-server/pkg-descr12
-rw-r--r--databases/firebird40-server/pkg-install-server41
-rw-r--r--databases/firebird40-server/pkg-plist48
-rw-r--r--databases/firebird40-server/pkg-plist.client49
22 files changed, 749 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile
index 6ade477ee5a1..3ebbe65b894e 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -74,8 +74,10 @@
SUBDIR += fastdb
SUBDIR += firebird25-client
SUBDIR += firebird30-client
+ SUBDIR += firebird40-client
SUBDIR += firebird25-server
SUBDIR += firebird30-server
+ SUBDIR += firebird40-server
SUBDIR += fortytwo-bdb
SUBDIR += foundationdb
SUBDIR += foundationdb-devel
diff --git a/databases/firebird40-client/Makefile b/databases/firebird40-client/Makefile
new file mode 100644
index 000000000000..143e3fe4949f
--- /dev/null
+++ b/databases/firebird40-client/Makefile
@@ -0,0 +1,12 @@
+PORTNAME= firebird
+PKGNAMESUFFIX= ${PORTVERSION:R:S/.//}-client
+
+COMMENT= Firebird-3 database client
+
+MASTERDIR= ${.CURDIR}/../firebird40-server
+
+PLIST= ${PKGDIR}/pkg-plist.client
+
+CLIENT_ONLY= yes
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/firebird40-server/Makefile b/databases/firebird40-server/Makefile
new file mode 100644
index 000000000000..7a2b35a41f38
--- /dev/null
+++ b/databases/firebird40-server/Makefile
@@ -0,0 +1,204 @@
+PORTNAME= firebird
+PORTVERSION= 4.0.0
+CATEGORIES?= databases
+MASTER_SITES= https://github.com/FirebirdSQL/${PORTNAME}/releases/download/v${PORTVERSION}/
+PKGNAMESUFFIX?= ${PORTVERSION:R:S/.//}-server
+DISTNAME= ${PORTNAME:S/f/F/}-${PORTVERSION}.2496-0
+DIST_SUBDIR= ${PORTNAME}
+
+MAINTAINER= acm@FreeBSD.org
+COMMENT?= Firebird-4 relational database (server)
+
+LICENSE= IDPL IPL
+LICENSE_COMB= multi
+LICENSE_NAME_IDPL= Initial Developer's Public License
+LICENSE_NAME_IPL= InterBase Public License
+LICENSE_FILE_IDPL= ${WRKSRC}/builds/install/misc/IDPLicense.txt
+LICENSE_FILE_IPL= ${WRKSRC}/builds/install/misc/IPLicense.txt
+LICENSE_PERMS_IDPL= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+LICENSE_PERMS_IPL= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+
+LIB_DEPENDS= libicuuc.so:devel/icu \
+ libtommath.so:math/libtommath \
+ libtomcrypt.so:security/libtomcrypt
+
+CONFLICTS_INSTALL= firebird25-* firebird30-*
+
+USES= cpe gmake pkgconfig localbase:ldflags libedit tar:xz
+USE_CXXSTD= c++11
+GNU_CONFIGURE= yes
+MAKE_JOBS_UNSAFE= yes
+
+CONFIGURE_ARGS= --prefix=${LOCALSTATEDIR} \
+ --exec-prefix=${PREFIX} \
+ --with-fbbin=${PREFIX}/bin \
+ --with-fblib=${PREFIX}/lib \
+ --with-fbconf=${PREFIX}/${CONFDIR} \
+ --with-fbglock=${LOCALSTATEDIR} \
+ --with-fbhelp=${LOCALSTATEDIR}/help \
+ --with-fbintl=${LIBEXECDIR}/intl \
+ --with-fblog=${LOCALSTATEDIR} \
+ --with-fbmsg=${DATADIR} \
+ --with-fbplugins=${LIBEXECDIR}/plugins \
+ --with-fbtzdata=${LIBEXECDIR}/tzdata \
+ --with-fbsbin=${PREFIX}/sbin \
+ --with-fbsecure-db=${LOCALSTATEDIR} \
+ --with-fbsample-db=${EXAMPLESDIR} \
+ --with-fbudf=${LIBEXECDIR}/UDF
+CONFIGURE_ENV+= PTHREAD_LIBS="-lpthread" \
+ ac_cv_header_atomic_ops_h="no" \
+ ac_cv_lib_atomic_ops_main="no"
+
+LOCALSTATEDIR= /var/db/firebird
+CONFDIR= etc/firebird
+LIBEXECDIR= ${PREFIX}/libexec/firebird
+PLIST_SUB= FIREBIRD_VERSION=${PORTVERSION} \
+ LOCALSTATEDIR="var/db/firebird" CONFDIR="${CONFDIR}"
+
+# Don't use ld for linking, use gcc
+LD= ${CC}
+
+# Don't strip binary files
+STRIP=
+
+ONLY_FOR_ARCHS= i386 amd64
+# sparc64 fails due to lack of valid AtomicCounter implementation in
+# src/common/classes/fb_atomic.h; presumably other tier-2s would as well
+
+INSTALL_FB= ${INSTALL} ${COPY}
+
+.if !defined(CLIENT_ONLY)
+# Server part stuff
+USES+= firebird:4.0
+
+CONFIGURE_ARGS+=--without-editline
+
+USE_RC_SUBR= firebird
+SUB_FILES= pkg-message
+
+UTIL_SBIN= fbguard firebird
+UTIL_BIN= fb_lock_print fbsplit fbstat fbsvcmgr fbtracemgr gbak gfix gsec \
+ nbackup
+UDR_SO= libudf_compat.so
+UDR_SQL= udf_compat.sql
+PLUGIN_SO= libChaCha.so libEngine13.so libfbtrace.so libLegacy_Auth.so \
+ libLegacy_UserManager.so libSrp.so libudr_engine.so
+TZDATA_FILES= ids.dat timezoneTypes.res windowsZones.res zoneinfo64.res \
+ metaZones.res
+
+PKGINSTALL?= ${PKGDIR}/pkg-install-server
+.else
+# Client part stuff
+USES+= libedit
+
+CONFIGURE_ARGS+= --with-system-editline
+CONFIGURE_ENV+= ac_cv_lib_edit_readline="yes"
+
+USE_LDCONFIG= yes
+CLIENT_BIN= gpre isql-fb qli
+CLIENT_HEADER= extlib/ib_util.h include/ibase.h include/iberror.h yvalve/perf.h
+
+OPTIONS_DEFINE= DOCS
+
+DOCS_PORTDOCS= *
+
+FB_DOCS_FILES= WhatsNew README.* Firebird* ambiguity.txt \
+ ods11-index-structure.html
+FB_DOCS_DIRS= sql.extensions license upgrade
+.endif
+
+MAKE_ENV+= FIREBIRD_TMP="${WRKDIR}" FIREBIRD_LOCK="${WRKDIR}"
+MAKE_ARGS+= PREFIX="${STAGEDIR}${PREFIX}"
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "amd64"
+CFLAGS+= -DAMD64
+.endif
+
+.if !defined(CLIENT_ONLY)
+USERS= ${PORTNAME}
+GROUPS= ${USERS}
+
+MAKE_ENV+= IsServer=Y
+.endif
+
+post-patch:
+ ${FIND} ${WRKSRC} -name "*.sh" -exec ${CHMOD} +x {} \+
+ ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
+ ${WRKSRC}/builds/install/misc/firebird.conf
+
+pre-build:
+.if !defined(CLIENT_ONLY)
+ @${SETENV} PKG_PREFIX="${STAGEDIR}${PREFIX}" ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+.endif
+ ${MAKE} -C ${WRKSRC}/extern/btyacc
+
+do-install:
+.if !defined(CLIENT_ONLY)
+ ${INSTALL_PROGRAM} ${UTIL_BIN:S!^!${WRKSRC}/gen/Release/firebird/bin/!} ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${UTIL_SBIN:S!^!${WRKSRC}/gen/Release/firebird/bin/!} ${STAGEDIR}${PREFIX}/sbin
+
+ @${MKDIR} ${STAGEDIR}${PREFIX}/${CONFDIR}
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/databases.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/databases.conf.sample
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/fbtrace.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/fbtrace.conf
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/replication.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/replication.conf
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/plugins.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/plugins.conf.sample
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/plugins/udr_engine.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/udr_engine.conf.sample
+
+ ${MKDIR} ${STAGEDIR}${LIBEXECDIR}/plugins/udr ${STAGEDIR}${LOCALSTATEDIR}/help ${STAGEDIR}${LIBEXECDIR}/intl \
+ ${STAGEDIR}${LIBEXECDIR}/tzdata ${STAGEDIR}${EXAMPLESDIR}
+
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/lib/libib_util.so ${STAGEDIR}${PREFIX}/lib
+
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/intl/fbintl.conf ${STAGEDIR}${LIBEXECDIR}/intl/fbintl.conf
+ ${INSTALL_FB} -m 0555 ${UDR_SO:S!^!${WRKSRC}/gen/Release/firebird/plugins/udr/!} ${STAGEDIR}${LIBEXECDIR}/plugins/udr
+ ${INSTALL_FB} -m 0444 ${UDR_SQL:S!^!${WRKSRC}/gen/Release/firebird/plugins/udr/!} ${STAGEDIR}${LIBEXECDIR}/plugins/udr
+ ${INSTALL_FB} -m 0555 ${PLUGIN_SO:S!^!${WRKSRC}/gen/Release/firebird/plugins/!} ${STAGEDIR}${LIBEXECDIR}/plugins
+ ${INSTALL_FB} -m 0444 ${TZDATA_FILES:S!^!${WRKSRC}/gen/Release/firebird/tzdata/!} ${STAGEDIR}${LIBEXECDIR}/tzdata
+
+ ${INSTALL_FB} -m 0660 ${WRKSRC}/gen/Release/firebird/security4.fdb ${STAGEDIR}${LOCALSTATEDIR}/security4.fdb.sample
+ ${INSTALL_FB} -m 0660 ${WRKSRC}/gen/Release/firebird/examples/empbuild/employee.fdb ${STAGEDIR}${EXAMPLESDIR}/employee.fdb
+ ${INSTALL_FB} -m 0660 ${WRKSRC}/gen/Release/firebird/examples/empbuild/employe2.sql ${STAGEDIR}${EXAMPLESDIR}/employe2.sql
+
+ ${INSTALL_FB} -m 0440 ${WRKSRC}/gen/Release/firebird/help/help.fdb ${STAGEDIR}${LOCALSTATEDIR}/help
+
+ ${INSTALL_FB} -m 0555 ${WRKSRC}/gen/Release/firebird/intl/libfbintl.so ${STAGEDIR}${LIBEXECDIR}/intl/libfbintl.so
+.else
+# defined CLIENT_ONLY
+ ${INSTALL_PROGRAM} ${CLIENT_BIN:S!^!${WRKSRC}/gen/Release/firebird/bin/!} ${STAGEDIR}${PREFIX}/bin
+
+ ${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${WRKSRC}/gen/Release/firebird/firebird.conf > ${WRKDIR}/firebird.conf
+
+ @${MKDIR} ${STAGEDIR}${PREFIX}/${CONFDIR}
+ ${INSTALL_DATA} ${WRKDIR}/firebird.conf ${STAGEDIR}${PREFIX}/${CONFDIR}/firebird.conf.sample
+
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/lib/libfbclient.so.${PORTVERSION} \
+ ${STAGEDIR}${PREFIX}/lib
+
+ ${LN} -fs libfbclient.so.${PORTVERSION} ${STAGEDIR}${PREFIX}/lib/libfbclient.so.3
+ ${LN} -fs libfbclient.so.${PORTVERSION} ${STAGEDIR}${PREFIX}/lib/libfbclient.so
+
+ @${MKDIR} ${STAGEDIR}${PREFIX}/include/firebird
+ ${INSTALL_DATA} ${CLIENT_HEADER:S!^!${WRKSRC}/src/!} ${STAGEDIR}${PREFIX}/include
+
+ @cd ${WRKSRC}/src/include/firebird && \
+ ${FIND} * -type d -exec ${MKDIR} "${STAGEDIR}${PREFIX}/include/firebird/{}" \;
+
+ @cd ${WRKSRC}/src/include/firebird && \
+ ${FIND} * -type f -exec ${INSTALL_DATA} "{}" "${STAGEDIR}${PREFIX}/include/firebird/{}" \;
+
+ @${MKDIR} ${STAGEDIR}${DATADIR}
+ ${INSTALL_DATA} ${WRKSRC}/gen/Release/firebird/*.msg ${STAGEDIR}${DATADIR}
+
+post-install-DOCS-on:
+ @${ECHO_MSG} "===> Installing documentation for ${PKGNAME}"
+ @${MKDIR} ${FB_DOCS_DIRS:S!^!${STAGEDIR}${DOCSDIR}/!}
+ ${INSTALL_DATA} ${FB_DOCS_FILES:S!^!${WRKSRC}/doc/!} ${STAGEDIR}${DOCSDIR}
+ ${LN} -sf README.user ${STAGEDIR}${DOCSDIR}/README
+ ${INSTALL_DATA} ${WRKSRC}/doc/sql.extensions/* ${STAGEDIR}${DOCSDIR}/sql.extensions
+ ${INSTALL_DATA} ${WRKSRC}/doc/license/* ${STAGEDIR}${DOCSDIR}/license
+ ${INSTALL_DATA} ${WRKSRC}/src/misc/upgrade/v3.0/* ${STAGEDIR}${DOCSDIR}/upgrade
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/databases/firebird40-server/distinfo b/databases/firebird40-server/distinfo
new file mode 100644
index 000000000000..f106b999cca5
--- /dev/null
+++ b/databases/firebird40-server/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1624676837
+SHA256 (firebird/Firebird-4.0.0.2496-0.tar.xz) = c155b8893e39d27c90f164d4865a7940749f47e971c7da6cf4828c980c708a57
+SIZE (firebird/Firebird-4.0.0.2496-0.tar.xz) = 30522192
diff --git a/databases/firebird40-server/files/firebird.in b/databases/firebird40-server/files/firebird.in
new file mode 100644
index 000000000000..f054b2659400
--- /dev/null
+++ b/databases/firebird40-server/files/firebird.in
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# PROVIDE: firebird
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable Firebird Database:
+#
+#
+# firebird_enable: Set it to "YES" to enable firebird.
+# Default is "NO".
+# firebird_flags: Set options to run firebird.
+# Default is "-el /var/db/firebird".
+# firebird_pidfile: Set full path to pid file.
+# Default is "/var/run/firebird.pid".
+#
+
+. /etc/rc.subr
+
+name=firebird
+rcvar=firebird_enable
+
+load_rc_config $name
+
+firebird_enable=${firebird_enable:-"NO"}
+firebird_flags=${firebird_flags:-"-el /var/db/firebird"}
+firebird_pidfile=${firebird_pidfile:-"/var/run/${name}.pid"}
+firebird_user=firebird
+
+command=%%PREFIX%%/sbin/firebird
+command_args="${firebird_flags} &"
+pidfile=${firebird_pidfile}
+start_precmd="start_precmd"
+start_postcmd="start_postcmd"
+stop_postcmd="stop_postcmd"
+reload_postcmd="reload_postcmd"
+
+start_precmd()
+{
+ touch ${firebird_pidfile}
+ chown "${firebird_user}:wheel" ${firebird_pidfile} ||
+ err 1 "Cannot chown ${firebird_pidfile}"
+}
+
+start_postcmd()
+{
+ pgrep -u ${firebird_user} ${name} > ${firebird_pidfile}
+}
+
+stop_postcmd()
+{
+ rm -f ${pidfile}
+}
+
+reload_postcmd()
+{
+ rm -f ${pidfile}
+ run_rc_command start
+}
+
+run_rc_command "$1"
diff --git a/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd b/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd
new file mode 100644
index 000000000000..2cebaf3f9377
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd
@@ -0,0 +1,19 @@
+--- builds/posix/prefix.freebsd 2021-05-29 10:05:05.000000000 -0500
++++ builds/posix/prefix.freebsd 2021-06-25 23:06:32.268522000 -0500
+@@ -20,5 +20,14 @@
+
+ EXE_LINK_OPTIONS+=-Wl,-rpath,../gen/firebird/lib
+
+-PROD_FLAGS=-O -fno-builtin -DFREEBSD -pipe -MMD -fPIC
+-DEV_FLAGS=-ggdb -DFREEBSD -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor
++COMMON_FLAGS=-DFREEBSD -pipe -MMD -fPIC
++PROD_FLAGS=$(COMMON_FLAGS) -O0 -g -fno-builtin -Wno-deprecated
++DEV_FLAGS=$(COMMON_FLAGS) -ggdb -p -Wall -Wno-non-virtual-dtor
++
++# This file must be compiled with SSE4.2 support
++%/CRC32C.o: COMMON_FLAGS += -msse4
++
++# These files are generated incorrectly (e.g. array.epp => array.cpp)
++%/array.o %/blob.o %/alice_meta.o %/restore.o %/backup.o: COMMON_FLAGS += -Wno-narrowing
++%/OdsDetection.o %/dba.o: COMMON_FLAGS += -Wno-narrowing
++
diff --git a/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd_amd64 b/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd_amd64
new file mode 100644
index 000000000000..dd0f1ae39223
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds-posix-prefix.freebsd_amd64
@@ -0,0 +1,19 @@
+--- builds/posix/prefix.freebsd_amd64.orig 2020-10-20 08:40:05 UTC
++++ builds/posix/prefix.freebsd_amd64
+@@ -20,5 +20,13 @@
+
+ EXE_LINK_OPTIONS+=-Wl,-rpath,../gen/firebird/lib
+
+-PROD_FLAGS=-O -fno-builtin -DFREEBSD -DAMD64 -pipe -MMD -fPIC
+-DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor
++COMMON_FLAGS=-DFREEBSD -DAMD64 -pipe -MMD -fPIC
++PROD_FLAGS=$(COMMON_FLAGS) -O0 -g -fno-builtin -Wno-deprecated
++DEV_FLAGS=$(COMMON_FLAGS) -ggdb -p -Wall -Wno-non-virtual-dtor
++
++# This file must be compiled with SSE4.2 support
++%/CRC32C.o: COMMON_FLAGS += -msse4
++
++# These files are generated incorrectly (e.g. array.epp => array.cpp)
++%/array.o %/blob.o %/alice_meta.o %/restore.o %/backup.o: COMMON_FLAGS += -Wno-narrowing
++%/OdsDetection.o %/dba.o: COMMON_FLAGS += -Wno-narrowing
+
diff --git a/databases/firebird40-server/files/patch-builds-posix_Makefile.in b/databases/firebird40-server/files/patch-builds-posix_Makefile.in
new file mode 100644
index 000000000000..db17745394e2
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds-posix_Makefile.in
@@ -0,0 +1,28 @@
+--- builds/posix/Makefile.in 2021-05-29 10:05:05.000000000 -0500
++++ builds/posix/Makefile.in 2021-06-25 22:10:51.733207000 -0500
+@@ -277,11 +277,13 @@
+ $(MAKE) boot
+ $(MAKE) yvalve
+ $(MAKE) engine
++ifeq ($(IsServer), Y)
+ $(MAKE) fbintl
+ $(MAKE) utilities
++endif
+ # Now having ready such useful tools as gbak and isql, we may restore / create
+ # required databases and switch to full-featured gpre
+- $(MAKE) gpre
++ $(MAKE) gbak gfix gpre
+ # Pay attention - after build force gpre_current to point to gpre
+ # even if gpre itself was not rebuilt
+ -$(RM) $(GPRE_CURRENT)
+@@ -290,8 +292,10 @@
+ # In developer mode we must regenerate various files in include/gen
+ $(MAKE) codes
+ endif
++ifeq ($(IsServer), Y)
+ $(MAKE) plugins
+ $(MAKE) examples
++endif
+ $(MAKE) rest
+
+
diff --git a/databases/firebird40-server/files/patch-builds-posix_Makefile.in.plugins_examples b/databases/firebird40-server/files/patch-builds-posix_Makefile.in.plugins_examples
new file mode 100644
index 000000000000..f822d3e5132d
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds-posix_Makefile.in.plugins_examples
@@ -0,0 +1,11 @@
+--- builds/posix/Makefile.in.plugins_examples 2021-05-29 10:05:05.000000000 -0500
++++ builds/posix/Makefile.in.plugins_examples 2021-06-25 22:13:32.653450000 -0500
+@@ -101,7 +101,7 @@
+ crypt_app: $(CRYPT_APP)
+
+ $(CRYPT_APP): $(CA_Objects)
+- $(EXE_LINK) $(LSB_UNDEF) $^ -o $@ $(FIREBIRD_LIBRARY_LINK)
++ $(EXE_LINK) $(LSB_UNDEF) $^ -o $@ $(LDFLAGS) $(FIREBIRD_LIBRARY_LINK)
+
+
+ include $(ROOT)/gen/make.shared.targets
diff --git a/databases/firebird40-server/files/patch-builds_posix_empty.vers b/databases/firebird40-server/files/patch-builds_posix_empty.vers
new file mode 100644
index 000000000000..598107119be9
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds_posix_empty.vers
@@ -0,0 +1,9 @@
+--- builds/posix/empty.vers.orig 2020-10-12 00:02:22 UTC
++++ builds/posix/empty.vers
+@@ -21,3 +21,5 @@
+ # Contributor(s): ______________________________________.
+
+ main
++__progname
++environ
+
diff --git a/databases/firebird40-server/files/patch-builds_posix_make.defaults b/databases/firebird40-server/files/patch-builds_posix_make.defaults
new file mode 100644
index 000000000000..b30b259a6848
--- /dev/null
+++ b/databases/firebird40-server/files/patch-builds_posix_make.defaults
@@ -0,0 +1,64 @@
+--- builds/posix/make.defaults 2020-10-20 03:40:05.000000000 -0500
++++ builds/posix/make.defaults 2021-06-25 00:23:49.718147000 -0500
+@@ -134,7 +134,7 @@
+ MATHLIB=@MATHLIB@
+
+ # switch to make sed edit files inplace
+-INLINE_EDIT_SED:= -i
++INLINE_EDIT_SED:= -i ""
+
+ # Default programs and tools to be used in the build process
+
+@@ -144,7 +144,7 @@
+ CHMOD= chmod
+ CHMOD_6= chmod 666
+ CHMOD_7= chmod 777
+-CHMOD_S7= chmod 06777
++CHMOD_S7= chmod 04555
+ MV= mv -f
+ TOUCH= touch
+ CP= cp
+@@ -219,7 +219,7 @@
+ #LibraryFileName=libfbclient
+ LibraryFileName=libfbclient
+ LibraryFullName=$(LibraryFileName).${SHRLIB_EXT}.${FirebirdVersion}
+-LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}.2
++LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}.3
+ LibraryBaseName=$(LibraryFileName).${SHRLIB_EXT}
+
+ LIBFIREBIRD_FULLNAME = $(LIB)/$(LibraryFullName)
+@@ -240,7 +240,7 @@
+
+ ifeq ($(EDITLINE_FLG),Y)
+ ifeq ($(STD_EDITLINE), true)
+- LIBEDITLINE := -l$(READLINE)
++ LIBEDITLINE := $(shell pkgconf libedit --libs)
+ else
+ LIBEDITLINE := $(LIB)/libedit.a
+ endif
+@@ -362,7 +362,7 @@
+ GDS_DROP = $(BIN)/gds_drop$(EXEC_EXT)
+ FBSVCMGR = $(BIN)/fbsvcmgr$(EXEC_EXT)
+ FBTRACEMGR = $(BIN)/fbtracemgr$(EXEC_EXT)
+-GSTAT = $(BIN)/gstat$(EXEC_EXT)
++GSTAT = $(BIN)/fbstat$(EXEC_EXT)
+ NBACKUP = $(BIN)/nbackup$(EXEC_EXT)
+ LOCKPRINT = $(BIN)/fb_lock_print$(EXEC_EXT)
+ GSEC = $(BIN)/gsec$(EXEC_EXT)
+@@ -383,13 +383,13 @@
+ QLI = $(BIN)/qli$(EXEC_EXT)
+
+ # From isql
+-ISQL = $(BIN)/isql$(EXEC_EXT)
+-RUN_ISQL = $(RBIN)/isql$(EXEC_EXT)
++ISQL = $(BIN)/isql-fb$(EXEC_EXT)
++RUN_ISQL = $(RBIN)/isql-fb$(EXEC_EXT)
+
+ # From burp
+ GBAK = $(BIN)/gbak$(EXEC_EXT)
+ RUN_GBAK = $(RBIN)/gbak$(EXEC_EXT)
+-GSPLIT = $(BIN)/gsplit$(EXEC_EXT)
++GSPLIT = $(BIN)/fbsplit$(EXEC_EXT)
+
+ # From gpre
+ # (gpre current is a link to one of the others)
diff --git a/databases/firebird40-server/files/patch-examples-exauth_Makefile b/databases/firebird40-server/files/patch-examples-exauth_Makefile
new file mode 100644
index 000000000000..f3dbff0604ec
--- /dev/null
+++ b/databases/firebird40-server/files/patch-examples-exauth_Makefile
@@ -0,0 +1,13 @@
+--- examples/extauth/Makefile 2021-05-29 10:05:05.000000000 -0500
++++ examples/extauth/Makefile 2021-06-27 18:10:21.360951000 -0500
+@@ -61,8 +61,8 @@
+ TCWRAP_objects=$(INTERMED)/TcWrapper.o
+ KEY_AUTH_objects=$(INTERMED)/ExtAuth.o
+
+-CXXFLAGS=-std=c++11 -pthread -I$(ROOT)/include -fPIC $(TOMCRYPT_COMPILE)
+-LDFLAGS=-pthread -L$(LIB) -Wl,-rpath,'$$ORIGIN/../lib' $(TOMCRYPT_LINK)
++CXXFLAGS=-std=c++11 -pthread -I$(ROOT)/include -fPIC $(TOMCRYPT_COMPILE) ${CFLAGS}
++LDFLAGS+=-pthread -L$(LIB) -Wl,-rpath,'$$ORIGIN/../lib' $(TOMCRYPT_LINK)
+
+ LINK_LIBS=-lfbclient -ltomcrypt -ltommath
+
diff --git a/databases/firebird40-server/files/patch-extern_btyacc_Makefile b/databases/firebird40-server/files/patch-extern_btyacc_Makefile
new file mode 100644
index 000000000000..defaa3243e5b
--- /dev/null
+++ b/databases/firebird40-server/files/patch-extern_btyacc_Makefile
@@ -0,0 +1,12 @@
+--- extern/btyacc/Makefile.orig 2020-10-12 00:02:22 UTC
++++ extern/btyacc/Makefile
+@@ -42,7 +42,7 @@ OTHERS = README README.BYACC \
+ all: $(PROGRAM)
+
+ $(PROGRAM): $(OBJS) $(LIBS)
+- $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
+
+ clean:; rm -f $(OBJS)
+
+
diff --git a/databases/firebird40-server/files/patch-extern_cloop_Makefile b/databases/firebird40-server/files/patch-extern_cloop_Makefile
new file mode 100644
index 000000000000..ccc6f08bcc04
--- /dev/null
+++ b/databases/firebird40-server/files/patch-extern_cloop_Makefile
@@ -0,0 +1,24 @@
+--- extern/cloop/Makefile.orig 2020-10-12 00:02:22 UTC
++++ extern/cloop/Makefile
+@@ -6,7 +6,7 @@ TARGET := release
+
+ CC := $(CC)
+ CXX := $(CXX)
+-LD := $(CXX)
++LD := $(CXX) $(LDFLAGS)
+
+ SRC_DIR := src
+ BUILD_DIR := build
+@@ -27,8 +27,9 @@ SRCS_CPP := $(foreach sdir,$(SRC_DIRS),$
+ OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
+ OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
+
+-C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
+-CXX_FLAGS := $(C_FLAGS)
++COMMON_C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
++C_FLAGS := $(COMMON_C_FLAGS) $(CFLAGS) $(CPPFLAGS)
++CXX_FLAGS := $(COMMON_C_FLAGS) $(CXXFLAGS) $(CPPFLAGS)
+ FPC_FLAGS := -Mdelphi
+
+ ifeq ($(TARGET),release)
+
diff --git a/databases/firebird40-server/files/patch-src-jrd-os-posix_unix.cpp b/databases/firebird40-server/files/patch-src-jrd-os-posix_unix.cpp
new file mode 100644
index 000000000000..6c9dc50ba31d
--- /dev/null
+++ b/databases/firebird40-server/files/patch-src-jrd-os-posix_unix.cpp
@@ -0,0 +1,25 @@
+--- src/jrd/os/posix/unix.cpp 2021-06-22 00:38:07.434896000 -0500
++++ src/jrd/os/posix/unix.cpp 2021-06-22 00:43:54.988645000 -0500
+@@ -56,6 +56,13 @@
+ #include <linux/fs.h>
+ #endif
+
++#ifdef FREEBSD
++#include <sys/disk.h>
++#define BLKGETSIZE64 DIOCGMEDIASIZE
++#define BLKGETSIZE DIOCGMEDIASIZE
++#define BLKSSZGET DIOCGSECTORSIZE
++#endif
++
+ #endif //SUPPORT_RAW_DEVICES
+
+ #include "../jrd/jrd.h"
+@@ -495,7 +502,7 @@
+ // Looks like any OS needs own ioctl() to determine raw device size
+ #undef HAS_RAW_SIZE
+
+-#ifdef LINUX
++#if defined(LINUX) || defined(FREEBSD)
+ #ifdef BLKGETSIZE64
+ if (ioctl(file->fil_desc, BLKGETSIZE64, &length) != 0)
+ #endif /*BLKGETSIZE64*/
diff --git a/databases/firebird40-server/files/patch-src_remote_SockAddr.h b/databases/firebird40-server/files/patch-src_remote_SockAddr.h
new file mode 100644
index 000000000000..30297137c2c5
--- /dev/null
+++ b/databases/firebird40-server/files/patch-src_remote_SockAddr.h
@@ -0,0 +1,25 @@
+--- src/remote/SockAddr.h.orig 2020-10-12 00:02:22 UTC
++++ src/remote/SockAddr.h
+@@ -112,11 +112,13 @@ public:
+
+ #define AF_INET6_POSIX 10
+ #define AF_INET6_WINDOWS 23
++#define AF_INET6_BSD 28
+ #define AF_INET6_DARWIN 30
+
+ #if AF_INET6 == AF_INET6_POSIX
+ #elif AF_INET6 == AF_INET6_WINDOWS
+ #elif AF_INET6 == AF_INET6_DARWIN
++#elif AF_INET6 == AF_INET6_BSD
+ #else
+ #error Unknown value of AF_INET6 !
+ #endif
+@@ -132,6 +134,7 @@ inline void SockAddr::checkAndFixFamily(
+ case AF_INET6_POSIX:
+ case AF_INET6_WINDOWS:
+ case AF_INET6_DARWIN:
++ case AF_INET6_BSD:
+ data.sock.sa_family = AF_INET6;
+ fb_assert(len == sizeof(sockaddr_in6));
+ break;
+
diff --git a/databases/firebird40-server/files/patch-src_remote_inet.cpp b/databases/firebird40-server/files/patch-src_remote_inet.cpp
new file mode 100644
index 000000000000..6b45a4f61e75
--- /dev/null
+++ b/databases/firebird40-server/files/patch-src_remote_inet.cpp
@@ -0,0 +1,25 @@
+--- src/remote/inet.cpp.orig 2020-10-20 08:40:05 UTC
++++ src/remote/inet.cpp
+@@ -962,7 +962,7 @@ rem_port* INET_connect(const TEXT* name,
+ gai_hints.ai_family = ((host.hasData() || !ipv6) ? AF_UNSPEC : AF_INET6);
+ gai_hints.ai_socktype = SOCK_STREAM;
+
+-#if !defined(WIN_NT) && !defined(__clang__)
++#if !defined(WIN_NT) && !defined(__FreeBSD__) && !defined(__DragonFly__)
+ gai_hints.ai_protocol = SOL_TCP;
+ #else
+ gai_hints.ai_protocol = IPPROTO_TCP;
+@@ -1176,6 +1176,12 @@ static rem_port* listener_socket(rem_port* port, USHOR
+ setFastLoopbackOption(port);
+
+ inet_ports->registerPort(port);
++
++ char *parent_pid;
++ if (parent_pid = getenv("FB_SIGNAL_PROCESS"))
++ {
++ kill(atoi(parent_pid), SIGUSR1);
++ }
+
+ if (flag & SRVR_multi_client)
+ {
+
diff --git a/databases/firebird40-server/files/pkg-message.in b/databases/firebird40-server/files/pkg-message.in
new file mode 100644
index 000000000000..912b494e7c01
--- /dev/null
+++ b/databases/firebird40-server/files/pkg-message.in
@@ -0,0 +1,43 @@
+[
+{ type: install
+ message: <<EOM
+Firebird 4 was installed.
+
+1) Before start the server ensure that the following line exists in /etc/services:
+
+gds_db 3050/tcp #InterBase Database Remote Protocol
+
+2) If you use inetd (Classic Server) then add the following line to /etc/inetd.conf
+
+gds_db stream tcp nowait firebird %%PREFIX%%/sbin/firebird firebird
+
+And finally restart inetd.
+
+3) If you want to use change firebird modes then you must modify the ServerMode
+ variable into %%ETCDIR%%/firebird.conf file.
+
+ ServerMode="Super"
+ # ServerMode="SuperClassic"
+ # ServerMode="Classic"
+
+4) It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+ # gsec -user SYSDBA -pass masterkey
+ GSEC> modify SYSDBA -pw newpassword
+ GSEC> quit
+
+before doing anything serious with Firebird.
+
+5) See documentation in %%DOCSDIR%%/ for more information.
+
+6) Some firebird tools were renamed for avoid conflicts with some other ports
+
+ %%PREFIX%%/bin/isql -> %%PREFIX%%/bin/isql-fb
+ %%PREFIX%%/bin/gstat -> %%PREFIX%%/bin/fbstat
+ %%PREFIX%%/bin/gsplit -> %%PREFIX%%/bin/fbsplit
+
+7) Enjoy it ;)
+EOM
+}
+]
diff --git a/databases/firebird40-server/pkg-descr b/databases/firebird40-server/pkg-descr
new file mode 100644
index 000000000000..f57481ef1afe
--- /dev/null
+++ b/databases/firebird40-server/pkg-descr
@@ -0,0 +1,12 @@
+Firebird is a relational database offering many ANSI SQL-99 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. It has been used in
+production systems, under a variety of names since 1981.
+
+Firebird is completely free of any registration, licensing or deployment
+fees. It may be deployed freely for use with any third-party software,
+whether commercial or not.
+
+WWW: https://sourceforge.net/projects/firebird/
+WWW: http://www.firebirdsql.org/
diff --git a/databases/firebird40-server/pkg-install-server b/databases/firebird40-server/pkg-install-server
new file mode 100644
index 000000000000..b4d11c67b574
--- /dev/null
+++ b/databases/firebird40-server/pkg-install-server
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+buildwarning() {
+cat <<EOF
+###############################################################################
+
+ ** IMPORTANT **
+
+If you want to cancel it, press ctrl-C now if you need check some things
+before of build it.
+
+###############################################################################
+EOF
+ sleep 5
+}
+
+case $2 in
+PRE-INSTALL)
+ buildwarning
+;;
+POST-INSTALL)
+cd /var/db/firebird
+
+# Lock files
+
+for i in isc_init1 isc_lock1 isc_event1
+do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+done
+
+touch firebird.log
+chown firebird:firebird firebird.log security4.fdb
+
+;;
+
+esac
diff --git a/databases/firebird40-server/pkg-plist b/databases/firebird40-server/pkg-plist
new file mode 100644
index 000000000000..f6276db7948c
--- /dev/null
+++ b/databases/firebird40-server/pkg-plist
@@ -0,0 +1,48 @@
+bin/fb_lock_print
+bin/fbsplit
+bin/fbstat
+bin/fbsvcmgr
+bin/fbtracemgr
+bin/gbak
+bin/gfix
+bin/gsec
+bin/nbackup
+sbin/fbguard
+sbin/firebird
+@group firebird
+@sample %%ETCDIR%%/databases.conf.sample
+%%ETCDIR%%/fbtrace.conf
+@sample %%ETCDIR%%/plugins.conf.sample
+@sample %%ETCDIR%%/replication.conf.sample
+@sample %%ETCDIR%%/udr_engine.conf.sample
+lib/libib_util.so
+libexec/firebird/intl/fbintl.conf
+libexec/firebird/intl/libfbintl.so
+libexec/firebird/plugins/libChaCha.so
+libexec/firebird/plugins/libEngine13.so
+libexec/firebird/plugins/libLegacy_Auth.so
+libexec/firebird/plugins/libLegacy_UserManager.so
+libexec/firebird/plugins/libSrp.so
+libexec/firebird/plugins/libfbtrace.so
+libexec/firebird/plugins/libudr_engine.so
+libexec/firebird/plugins/udr/udf_compat.sql
+libexec/firebird/plugins/udr/libudf_compat.so
+libexec/firebird/tzdata/ids.dat
+libexec/firebird/tzdata/metaZones.res
+libexec/firebird/tzdata/timezoneTypes.res
+libexec/firebird/tzdata/windowsZones.res
+libexec/firebird/tzdata/zoneinfo64.res
+@group
+@owner firebird
+@group firebird
+/%%LOCALSTATEDIR%%/help/help.fdb
+%%EXAMPLESDIR%%/employee.fdb
+%%EXAMPLESDIR%%/employe2.sql
+@sample /%%LOCALSTATEDIR%%/security4.fdb.sample
+@preunexec [ -s /%%LOCALSTATEDIR%%/firebird.log ] || rm -f /%%LOCALSTATEDIR%%/firebird.log
+@rmtry /%%LOCALSTATEDIR%%/isc_event1.`hostname`
+@rmtry /%%LOCALSTATEDIR%%/isc_init1.`hostname`
+@rmtry /%%LOCALSTATEDIR%%/isc_lock1.`hostname`
+@dir /%%LOCALSTATEDIR%%/help
+@dir /%%LOCALSTATEDIR%%
+@group
diff --git a/databases/firebird40-server/pkg-plist.client b/databases/firebird40-server/pkg-plist.client
new file mode 100644
index 000000000000..543e6b40637a
--- /dev/null
+++ b/databases/firebird40-server/pkg-plist.client
@@ -0,0 +1,49 @@
+bin/gpre
+bin/isql-fb
+bin/qli
+%%ETCDIR%%/firebird.conf.sample
+include/firebird/FirebirdInterface.idl
+include/firebird/IdlFbInterfaces.h
+include/firebird/Interface.h
+include/firebird/Message.h
+include/firebird/TimeZones.h
+include/firebird/UdrCppEngine.h
+include/firebird/impl/blr.h
+include/firebird/impl/boost/preprocessor/arithmetic/dec.hpp
+include/firebird/impl/boost/preprocessor/arithmetic/inc.hpp
+include/firebird/impl/boost/preprocessor/cat.hpp
+include/firebird/impl/boost/preprocessor/config/config.hpp
+include/firebird/impl/boost/preprocessor/control/expr_if.hpp
+include/firebird/impl/boost/preprocessor/control/expr_iif.hpp
+include/firebird/impl/boost/preprocessor/control/if.hpp
+include/firebird/impl/boost/preprocessor/control/iif.hpp
+include/firebird/impl/boost/preprocessor/debug/error.hpp
+include/firebird/impl/boost/preprocessor/detail/auto_rec.hpp
+include/firebird/impl/boost/preprocessor/detail/dmc/auto_rec.hpp
+include/firebird/impl/boost/preprocessor/facilities/empty.hpp
+include/firebird/impl/boost/preprocessor/logical/bool.hpp
+include/firebird/impl/boost/preprocessor/repetition/detail/dmc/for.hpp
+include/firebird/impl/boost/preprocessor/repetition/detail/edg/for.hpp
+include/firebird/impl/boost/preprocessor/repetition/detail/for.hpp
+include/firebird/impl/boost/preprocessor/repetition/detail/msvc/for.hpp
+include/firebird/impl/boost/preprocessor/repetition/for.hpp
+include/firebird/impl/boost/preprocessor/seq/elem.hpp
+include/firebird/impl/boost/preprocessor/seq/for_each_i.hpp
+include/firebird/impl/boost/preprocessor/seq/seq.hpp
+include/firebird/impl/boost/preprocessor/seq/size.hpp
+include/firebird/impl/boost/preprocessor/tuple/eat.hpp
+include/firebird/impl/boost/preprocessor/tuple/elem.hpp
+include/firebird/impl/boost/preprocessor/tuple/rem.hpp
+include/firebird/impl/consts_pub.h
+include/firebird/impl/dsc_pub.h
+include/firebird/impl/inf_pub.h
+include/firebird/impl/sqlda_pub.h
+include/firebird/impl/types_pub.h
+include/ib_util.h
+include/ibase.h
+include/iberror.h
+include/perf.h
+lib/libfbclient.so
+lib/libfbclient.so.3
+lib/libfbclient.so.%%FIREBIRD_VERSION%%
+%%DATADIR%%/firebird.msg