Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FirebirdSQL server #5837

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions cross/firebird/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,30 @@ INSTALL_TARGET = firebird_install
# We must forward-declare the PKGVAR here as we must compile its value to the
# binaries. We only support DSM7 so we do not worry about DSM6 compatibility
SYNOPKG_PKGVAR = /var/packages/$(PKG_NAME)/var
SYNOPKG_PKGDEST = /var/packages/$(PKG_NAME)/target

ADDITIONAL_CFLAGS = '-DFB_PREFIX="\"$(SYNOPKG_PKGDEST)\""' \
'-DFB_SECDBDIR="\"$(SYNOPKG_PKGVAR)\""' \
'-DFB_GUARDDIR="\"$(SYNOPKG_PKGVAR)\""' \
'-DFB_CONFDIR="\"$(SYNOPKG_PKGVAR)\""' \
'-DFB_SBINDIR="\"$(SYNOPKG_PKGDEST)/bin\""' \
'-DFB_BINDIR="\"$(SYNOPKG_PKGDEST)/bin\""' \
'-DFB_DOCDIR="\"$(SYNOPKG_PKGDEST)/doc\""' \
'-DFB_HELPDIR="\"$(SYNOPKG_PKGDEST)/help\""' \
'-DFB_SAMPLEDIR="\"$(SYNOPKG_PKGDEST)/examples\""' \
'-DFB_PLUGDIR="\"$(SYNOPKG_PKGDEST)/plugins\""' \
'-DFB_SAMPLEDBDIR="\"$(SYNOPKG_PKGDEST)/examples/empbuild\""' \
'-DFB_TZDATADIR="\"$(SYNOPKG_PKGDEST)\""' \
'-DFB_MISCDIR="\"$(SYNOPKG_PKGDEST)/misc\""' \
'-DFB_MSGDIR="\"$(SYNOPKG_PKGDEST)\""' \
'-DFB_INCDIR="\"$(SYNOPKG_PKGDEST)/include\""' \
'-DFB_INTLDIR="\"$(SYNOPKG_PKGDEST)/intl\""' \
'-DFB_LIBDIR="\"$(SYNOPKG_PKGDEST)/lib\""' \
'-DFB_LOGDIR="\"$(SYNOPKG_PKGVAR)\""'
Comment on lines +46 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a missunderstanding
SYNOPKG_* variables are for installer only (i.e. service-setup.sh), not for building packages

for Makefiles you have to use the Makefile Variables as documented in the wiki
like STAGING_INSTALL_PREFIX

Copy link
Contributor

@hgy59 hgy59 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If FirebirdSQL follows the known rules, you only have to define FB_PREFIX and other subfolders are defaulted to ${FB_PREFIX}/bin, ${FB_PREFIX}/lib, ...}

you should only require the variables

  • INSTALL_PREFIX
  • INSTALL_PREFIX_VAR

normally you do not define such FB_* variables as compiler flags but as configure options.

the configure arg --prefix=$(INSTALL_PREFIX) should make the definition of ADDITIONAL_CFLAGS += FB_PREFIX=$(INSTALL_PREFIX) obsolete.

NB:
the spksrc framework is designed to use /usr(local/{packagename} as prefix when building a package with the cross Makefile and to use /var/packages/{packagename}/target as prefix when building the package in the spk folder.

Copy link
Contributor Author

@vitkabele vitkabele Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for Makefiles you have to use the Makefile Variables as documented in the wiki
like STAGING_INSTALL_PREFIX

As I understand, the STAGING_INSTALL_PREFIX is the location where the files should be copied to be found by the PLIST magic. What I need here is actually the runtime location of the files, because Firebird compiles this information in the binary. If not set properly, it does not find the configuration etc.

If FirebirdSQL follows the known rules, you only have to define FB_PREFIX and other subfolders are defaulted to ${FB_PREFIX}/bin, ${FB_PREFIX}/lib, ...}

This works to a certain extent. With this setup, configuration files are located in $FB_PREFIX, where the installer does not find them. Even if I move them later to $FB_PREFIX/var, the Firebird itself won't find them during startup and crashes.

normally you do not define such FB_* variables as compiler flags but as configure options.

This is true, but the Firebird's build process is non-standard at least. The server is built in two phases, first some native part is built, this is then used to pre-process certain files and then the actual cross toolchain is used to build the binary.

In this process, the --with-fbprefix and similar configure option have only limited usability, because the value from them does not reach the cross phase for the reason you mention in your next comment. The file that should be generated with autoconf is not generated, which is the destination location of the discussed variables.

There is a cli option for firebird server to change the firebird root on startup, but this unfortunately breaks other things. Please see my related question in firebird-support mailing list.

TL;DR The build process cannot handle when install prefix and actual runtime prefix is different. This is the purpose of this -DFB_* fun.


# CXXFLAGS should be set fine by the spksrc for cross-compilation, we will
# use it in cross2 step CROSS_ENV
ADDITIONAL_CXXFLAGS = -Wno-invalid-offsetof \
'-DFB_SECDBDIR="\"$(SYNOPKG_PKGVAR)\""'
ADDITIONAL_CXXFLAGS = -Wno-invalid-offsetof $(ADDITIONAL_CFLAGS)

# Path to the libtool installed in the cross/libtool DEPENDS target
# We need the native libtool for building libommath/libtomcrypt in cross1 step
Expand All @@ -61,7 +80,8 @@ include ../../mk/spksrc.cross-cc.mk
# termlib and editline are disabled because we don't provide ncurses
# and editline libraries
CONFIGURE_ARGS = --without-termlib --with-builtin-tommath --with-builtin-tomcrypt \
--without-editline --with-cross-build=synology.$(ARCH) --prefix=$(INSTALL_PREFIX)
--without-editline --with-cross-build=synology.$(ARCH) --prefix=$(INSTALL_PREFIX) \
--with-fbconf=$(INSTALL_PREFIX)/var

NATIVE_LIBICU_DIR := $(WORK_DIR)/../../../native/libicu/work-native/install/usr/local

Expand Down
14 changes: 7 additions & 7 deletions cross/firebird/PLIST
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rsc:IDPLicense.txt
rsc:IPLicense.txt
rsc:var/IDPLicense.txt
rsc:var/IPLicense.txt
rsc:bin/fb_config
bin:bin/build_file
bin:bin/fb_lock_print
Expand All @@ -15,9 +15,9 @@ bin:bin/gstat
bin:bin/isql
bin:bin/nbackup
rsc:bin/registerDatabase.sh
rsc:databases.conf
rsc:fbtrace.conf
rsc:firebird.conf
rsc:var/databases.conf
rsc:var/fbtrace.conf
rsc:var/firebird.conf
rsc:security4.gbak
rsc:msg.gbak
rsc:intl/fbintl
Expand All @@ -27,7 +27,7 @@ lnk:lib/libfbclient.so.2
lib:lib/libfbclient.so.4.0.3
lib:lib/libib_util.so
rsc:misc/intl.sql
rsc:plugins.conf
rsc:var/plugins.conf
lib:plugins/libChaCha.so
lib:plugins/libEngine13.so
lib:plugins/libLegacy_Auth.so
Expand All @@ -38,4 +38,4 @@ lib:plugins/libudr_engine.so
lib:plugins/udr/libudf_compat.so
rsc:plugins/udr/udf_compat.sql
rsc:plugins/udr_engine.conf
rsc:replication.conf
rsc:var/replication.conf
21 changes: 21 additions & 0 deletions cross/firebird/patches/0002-do-not-build-qli-gpre-examples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- builds/posix/Makefile.in.1 2023-08-18 21:59:51.408045740 +0200
+++ builds/posix/Makefile.in 2023-08-18 22:03:41.578508436 +0200
@@ -348,9 +348,7 @@ cross2:
$(MAKE) engine
$(MAKE) fbintl
$(MAKE) utilities
- $(MAKE) $(GPRE)
$(MAKE) plugins
- $(MAKE) -f Makefile.plugins_examples
$(MAKE) cross_rest


@@ -660,7 +658,7 @@ GBAK_FILES := $(subst Native,$(TARGET),$

rest: qli message_file tzdata

-cross_rest: qli gbak_files
+cross_rest: gbak_files
$(MAKE) $(BUILD_FILE)

qli: $(QLI)
34 changes: 17 additions & 17 deletions cross/firebird/src/cross_config/synology.aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,64 +24,64 @@
#define FB_ALIGNMENT 8

/* executables DIR (PREFIX/bin) */
#define FB_BINDIR ""
/* #define FB_BINDIR "" */

/* config files DIR (PREFIX) */
#define FB_CONFDIR ""
/* #define FB_CONFDIR "" */

/* documentation root DIR (PREFIX/doc) */
#define FB_DOCDIR ""
/* #define FB_DOCDIR "" */

/* Alignment of double */
#define FB_DOUBLE_ALIGN 8

/* guardian lock DIR (PREFIX) */
#define FB_GUARDDIR ""
/* #define FB_GUARDDIR "" */

/* QLI help DIR (PREFIX/help) */
#define FB_HELPDIR ""
/* #define FB_HELPDIR "" */

/* C/C++ header files DIR (PREFIX/include) */
#define FB_INCDIR ""
/* #define FB_INCDIR "" */

/* international DIR (PREFIX/intl) */
#define FB_INTLDIR ""
/* #define FB_INTLDIR "" */

/* Local IPC name */
#define FB_IPC_NAME "FirebirdIPI"

/* object code libraries DIR (PREFIX/lib) */
#define FB_LIBDIR ""
/* #define FB_LIBDIR "" */

/* log files DIR (PREFIX) */
#define FB_LOGDIR ""
/* #define FB_LOGDIR "" */

/* misc DIR (PREFIX/misc) */
#define FB_MISCDIR ""
/* #define FB_MISCDIR "" */

/* message files DIR (PREFIX) */
#define FB_MSGDIR ""
/* #define FB_MSGDIR "" */

/* Wnet pipe name */
#define FB_PIPE_NAME "interbas"

/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* #define FB_PLUGDIR "" */

/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* #define FB_TZDATADIR "" */

/* Installation path prefix */
#define FB_PREFIX "/usr/local/firebird"
/* #define FB_PREFIX "/usr/local/firebird" */

/* examples database DIR (PREFIX/examples/empbuild) */
#define FB_SAMPLEDBDIR ""
/* #define FB_SAMPLEDBDIR "" */

/* examples DIR (PREFIX/examples) */
#define FB_SAMPLEDIR ""
/* #define FB_SAMPLEDIR "" */

/* system admin executables DIR (PREFIX/bin) */
#define FB_SBINDIR ""
/* #define FB_SBINDIR "" */

/* security database DIR (PREFIX) */
/* #define FB_SECDBDIR "" */
Expand Down
34 changes: 17 additions & 17 deletions cross/firebird/src/cross_config/synology.armv7.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,64 +30,64 @@
#define FB_ALIGNMENT 8

/* executables DIR (PREFIX/bin) */
#define FB_BINDIR ""
/* #define FB_BINDIR "" */

/* config files DIR (PREFIX) */
#define FB_CONFDIR ""
/* #define FB_CONFDIR "" */

/* documentation root DIR (PREFIX/doc) */
#define FB_DOCDIR ""
/* #define FB_DOCDIR "" */

/* Alignment of double */
#define FB_DOUBLE_ALIGN 8

/* guardian lock DIR (PREFIX) */
#define FB_GUARDDIR ""
/* #define FB_GUARDDIR "" */

/* QLI help DIR (PREFIX/help) */
#define FB_HELPDIR ""
/* #define FB_HELPDIR "" */

/* C/C++ header files DIR (PREFIX/include) */
#define FB_INCDIR ""
/* #define FB_INCDIR "" */

/* international DIR (PREFIX/intl) */
#define FB_INTLDIR ""
/* #define FB_INTLDIR "" */

/* Local IPC name */
#define FB_IPC_NAME "FirebirdIPI"

/* object code libraries DIR (PREFIX/lib) */
#define FB_LIBDIR ""
/* #define FB_LIBDIR "" */

/* log files DIR (PREFIX) */
#define FB_LOGDIR ""
/* #define FB_LOGDIR "" */

/* misc DIR (PREFIX/misc) */
#define FB_MISCDIR ""
/* #define FB_MISCDIR "" */

/* message files DIR (PREFIX) */
#define FB_MSGDIR ""
/* #define FB_MSGDIR "" */

/* Wnet pipe name */
#define FB_PIPE_NAME "interbas"

/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* #define FB_PLUGDIR "" */

/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* #define FB_TZDATADIR "" */

/* Installation path prefix */
#define FB_PREFIX "/usr/local/firebird"
/* #define FB_PREFIX "/usr/local/firebird" */

/* examples database DIR (PREFIX/examples/empbuild) */
#define FB_SAMPLEDBDIR ""
/* #define FB_SAMPLEDBDIR "" */

/* examples DIR (PREFIX/examples) */
#define FB_SAMPLEDIR ""
/* #define FB_SAMPLEDIR "" */

/* system admin executables DIR (PREFIX/bin) */
#define FB_SBINDIR ""
/* #define FB_SBINDIR "" */

/* security database DIR (PREFIX) */
/* #define FB_SECDBDIR "" */
Expand Down
34 changes: 17 additions & 17 deletions cross/firebird/src/cross_config/synology.x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,64 +24,64 @@
#define FB_ALIGNMENT 8

/* executables DIR (PREFIX/bin) */
#define FB_BINDIR ""
/* #define FB_BINDIR "" */

/* config files DIR (PREFIX) */
#define FB_CONFDIR ""
/* #define FB_CONFDIR "" */

/* documentation root DIR (PREFIX/doc) */
#define FB_DOCDIR ""
/* #define FB_DOCDIR "" */

/* Alignment of double */
#define FB_DOUBLE_ALIGN 8

/* guardian lock DIR (PREFIX) */
#define FB_GUARDDIR ""
/* #define FB_GUARDDIR "" */

/* QLI help DIR (PREFIX/help) */
#define FB_HELPDIR ""
/* #define FB_HELPDIR "" */

/* C/C++ header files DIR (PREFIX/include) */
#define FB_INCDIR ""
/* #define FB_INCDIR "" */

/* international DIR (PREFIX/intl) */
#define FB_INTLDIR ""
/* #define FB_INTLDIR "" */

/* Local IPC name */
#define FB_IPC_NAME "FirebirdIPI"

/* object code libraries DIR (PREFIX/lib) */
#define FB_LIBDIR ""
/* #define FB_LIBDIR "" */

/* log files DIR (PREFIX) */
#define FB_LOGDIR ""
/* #define FB_LOGDIR "" */

/* misc DIR (PREFIX/misc) */
#define FB_MISCDIR ""
/* #define FB_MISCDIR "" */

/* message files DIR (PREFIX) */
#define FB_MSGDIR ""
/* #define FB_MSGDIR "" */

/* Wnet pipe name */
#define FB_PIPE_NAME "interbas"

/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* #define FB_PLUGDIR "" */

/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* #define FB_TZDATADIR "" */

/* Installation path prefix */
#define FB_PREFIX "/usr/local/firebird"
/* #define FB_PREFIX "/usr/local/firebird" */

/* examples database DIR (PREFIX/examples/empbuild) */
#define FB_SAMPLEDBDIR ""
/* #define FB_SAMPLEDBDIR "" */

/* examples DIR (PREFIX/examples) */
#define FB_SAMPLEDIR ""
/* #define FB_SAMPLEDIR "" */

/* system admin executables DIR (PREFIX/bin) */
#define FB_SBINDIR ""
/* #define FB_SBINDIR "" */

/* security database DIR (PREFIX) */
/* #define FB_SECDBDIR "" */
Expand Down