Skip to content

Commit 048176f

Browse files
vitkabeleVít Kabele
authored andcommitted
Add cross/firebird (#5837)
Build FirebirdSQL database The build works for x64 and aarch64 architecture and DSM 7.0 and 7.1 - Use configure --with-cross-build as used by firebird build itself
1 parent 80a50e7 commit 048176f

File tree

10 files changed

+2334
-0
lines changed

10 files changed

+2334
-0
lines changed

cross/firebird/Makefile

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
PKG_NAME = firebird
2+
PKG_VERS = 4.0.3
3+
PKG_EXT = tar.gz
4+
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
5+
PKG_DIST_SITE = https://github.com/FirebirdSQL/firebird/archive/refs/tags
6+
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)
7+
8+
DEPENDS = cross/zlib cross/libicu native/libicu native/libtool
9+
10+
UNSUPPORTED_ARCHS = $(ARMv5_ARCHS) $(OLD_PPC_ARCHS)
11+
12+
# Create proper src/make.synology.evansport to support this
13+
UNSUPPORTED_ARCHS += $(i686_ARCHS)
14+
15+
# Uses too old GCC 4.9
16+
UNSUPPORTED_ARCHS += comcerto2k
17+
18+
include ../../mk/spksrc.common.mk
19+
20+
# Currently v4.0.2 works only with 7.0 and 7.1
21+
# DSM 7.2 has issues with GLIBC version
22+
# DSM 6.x has issues with some C++ libraries versions
23+
ifeq ($(call version_lt,$(TCVERSION),7.0)$(call version_gt,$(TCVERSION),7.1),1)
24+
UNSUPPORTED_ARCHS += $(ARCH)
25+
endif
26+
27+
HOMEPAGE = https://www.firebirdsql.org/
28+
COMMENT = Firebird is a relational database offering many ANSI SQL standard features that runs on Linux, Windows, MacOS and a variety of Unix platforms.
29+
LICENSE = MPL
30+
MAINTAINER = vitkabele
31+
32+
PRE_CONFIGURE_TARGET = firebird_pre_configure
33+
34+
CONFIGURE_TARGET = firebird_configure
35+
36+
COMPILE_TARGET = firebird_compile
37+
38+
INSTALL_TARGET = firebird_install
39+
40+
# CXXFLAGS should be set fine by the spksrc for cross-compilation, we will
41+
# use it in cross2 step CROSS_ENV
42+
ADDITIONAL_CXXFLAGS = -Wno-invalid-offsetof
43+
44+
# Path to the libtool installed in the cross/libtool DEPENDS target
45+
# We need the native libtool for building libommath/libtomcrypt in cross1 step
46+
LIBTOOL_BIN = $(WORK_DIR)/../../../native/libtool/work-native/install/usr/local/bin/libtool
47+
48+
# We need both native and cross compilers for building the binary.
49+
include ../../mk/spksrc.cross-cc.mk
50+
51+
# If we use --with-builtin-tomcrypt/math, the libraries are built during cross1
52+
# phase without -fPIC and then refuse to link during cross2 phase. Further,
53+
# they can be built for different platforms during cross1 and cross2 phase.
54+
#
55+
# termlib and editline are disabled because we don't provide ncurses
56+
# and editline libraries
57+
CONFIGURE_ARGS = --without-termlib --with-builtin-tommath --with-builtin-tomcrypt \
58+
--without-editline --with-cross-build=synology.$(ARCH) --prefix=$(INSTALL_PREFIX)
59+
60+
NATIVE_LIBICU_DIR := $(WORK_DIR)/../../../native/libicu/work-native/install/usr/local
61+
62+
# CFLAGS and CXXFLAGS for cross1 compile stage
63+
NATIVE_CFLAGS := -I$(NATIVE_LIBICU_DIR)/include -L$(NATIVE_LIBICU_DIR)/lib
64+
65+
# Preprocessor flags
66+
NATIVE_CPPFLAGS := -I$(NATIVE_LIBICU_DIR)/include
67+
68+
# This ENV is for cross1 phase where we build native target
69+
#
70+
# The NATIVE flags must be passed to the configure part, because the configure
71+
# fails when it cant find the headers.
72+
NATIVE_ENV = CC=gcc CXX=g++ AS=as AR=ar LD=ld NM=nm OBJCOPY=objcopy OBJDUMP=objdump \
73+
PARALLEL_MAKE=max \
74+
LIBTOOL="$(LIBTOOL_BIN)" \
75+
CFLAGS="$(NATIVE_CFLAGS)" \
76+
CXXFLAGS="$(NATIVE_CFLAGS)" \
77+
CPPFLAGS="$(NATIVE_CPPFLAGS)"
78+
79+
NATIVE_RUN = cd $(WORK_DIR)/$(PKG_DIR) && env $(NATIVE_ENV)
80+
81+
# DO NOT MODIFY $(ENV) variable (too much) a.k.a. only add variables for ourselves
82+
# and do not modify any CFLAGS or other universally recognized variable
83+
# It breaks compilation of dependent cross/* libraries (especially cross/libicu)
84+
#
85+
# This ENV is for cross2 build phase where we build binaries for target platform
86+
# CROSS_ prefixed vars are for the cross2 phase and we "strip" the CROSS_ prefix
87+
# in our provided src/makefile.xxx
88+
#
89+
# The C(XX)FLAGS variables are ready by the spksrc for cross compilation, we
90+
# just use them
91+
ENV += CROSS_TOOLCHAIN=$(TC_PATH)$(TC_PREFIX)
92+
93+
.PHONY: firebird_pre_configure
94+
firebird_pre_configure:
95+
cp src/make.synology.* $(WORK_DIR)/$(PKG_DIR)/builds/posix/
96+
cp src/cross_config/* $(WORK_DIR)/$(PKG_DIR)/src/include/cross/
97+
$(NATIVE_RUN) NOCONFIGURE=1 ./autogen.sh
98+
99+
# Override the configure target, because we must pass it different env than
100+
# ENV. We cannot modify ENV to contain -I for native/libicu, because it breaks
101+
# compilation of native/libicu, but we must have this -I in the configure
102+
# CFLAGS, otherwise the configure step fails with unicode headers not found.
103+
.PHONY: firebird_configure
104+
firebird_configure:
105+
$(NATIVE_RUN) ./configure $(CONFIGURE_ARGS)
106+
107+
# Firebird itself would be compiled by simple make, but we must pass different
108+
# environment to cross1 and cross2 step. The toolchain and CFLAGS differ
109+
.PHONY: firebird_compile
110+
firebird_compile:
111+
$(NATIVE_RUN) make TARGET=Native cross1
112+
$(RUN) make TARGET=Release CROSS_OUT=Y cross2
113+
114+
.PHONY: firebird_install
115+
firebird_install:
116+
$(RUN) make TARGET=Release CROSS_OUT=Y dist
117+
# We assume there is just one buildroot.tar.gz file in the build tree
118+
# This is a little hack since we don't know the exact path where it is
119+
# produced and it is easier than patching the firebird Makefiles
120+
cd $(WORK_DIR)/install && tar xf $$(find ../ -name buildroot.tar.gz)
121+

cross/firebird/PLIST

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
rsc:CHANGELOG.md
2+
rsc:IDPLicense.txt
3+
rsc:IPLicense.txt
4+
rsc:README.md
5+
rsc:bin/changeServerMode.sh
6+
rsc:bin/fb_config
7+
bin:bin/build_file
8+
bin:bin/fb_lock_print
9+
bin:bin/fbguard
10+
bin:bin/fbsvcmgr
11+
bin:bin/fbtracemgr
12+
bin:bin/firebird
13+
bin:bin/gbak
14+
bin:bin/gfix
15+
bin:bin/gpre
16+
bin:bin/gsec
17+
bin:bin/gsplit
18+
bin:bin/gstat
19+
bin:bin/isql
20+
bin:bin/nbackup
21+
bin:bin/qli
22+
rsc:bin/registerDatabase.sh
23+
rsc:databases.conf
24+
rsc:fbtrace.conf
25+
rsc:firebird.conf
26+
rsc:security4.gbak
27+
rsc:msg.gbak
28+
rsc:help/help.gbak
29+
rsc:intl/fbintl
30+
rsc:intl/fbintl.conf
31+
lnk:lib/libfbclient.so
32+
lnk:lib/libfbclient.so.2
33+
lib:lib/libfbclient.so.4.0.3
34+
lib:lib/libib_util.so
35+
rsc:misc/intl.sql
36+
rsc:misc/rc.config.firebird
37+
rsc:misc/upgrade/udf/udf_replace.sql
38+
rsc:misc/upgrade/udf/udf_replace.txt
39+
rsc:plugins.conf
40+
lib:plugins/libChaCha.so
41+
lib:plugins/libEngine13.so
42+
lib:plugins/libLegacy_Auth.so
43+
lib:plugins/libLegacy_UserManager.so
44+
lib:plugins/libSrp.so
45+
lib:plugins/libfbtrace.so
46+
lib:plugins/libudr_engine.so
47+
lib:plugins/udr/libudf_compat.so
48+
rsc:plugins/udr/udf_compat.sql
49+
rsc:plugins/udr_engine.conf
50+
rsc:replication.conf

cross/firebird/digests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
v4.0.3.tar.gz SHA1 02dd8914e80acef2a662eab42b7ee5a3dc41248e
2+
v4.0.3.tar.gz SHA256 90b799043c83325479989b1f44116d1f0112f77c5def4bb452470bf7a0dcc138
3+
v4.0.3.tar.gz MD5 1d57b5ee362be4c0b2c3f28e78f69aaf
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff -u builds/install/arch-specific/linux/makeInstallImage.sh.in builds/install/arch-specific/linux/makeInstallImage.sh.in
2+
--- builds/install/arch-specific/linux/makeInstallImage.sh.in 2023-08-11 11:55:02.848124743 +0200
3+
+++ builds/install/arch-specific/linux/makeInstallImage.sh.in 2023-08-11 13:44:38.846348466 +0200
4+
@@ -34,7 +34,7 @@
5+
BuildRootDir=..
6+
BuiltFBDir=Release/firebird # Where the just build fb exists.
7+
TargetDir=buildroot # Where we want to build the install image
8+
-SecurityDatabase=security4.fdb
9+
+SecurityDatabase=security4.gbak
10+
TomMathBuild="@TOMMATH_BUILD@"
11+
TomCryptBuild="@TOMCRYPT_BUILD@"
12+
13+
@@ -183,6 +183,7 @@
14+
copyIfExists $BuiltFBDir/bin/fbtracemgr ${TargetDir}@FB_BINDIR@
15+
cp $BuiltFBDir/bin/isql ${TargetDir}@FB_BINDIR@/isql
16+
cp $BuiltFBDir/bin/qli ${TargetDir}@FB_BINDIR@/qli
17+
+ cp $BuiltFBDir/bin/build_file ${TargetDir}@FB_BINDIR@/build_file
18+
19+
chmod 0755 ${TargetDir}@FB_BINDIR@/*
20+
21+
@@ -239,6 +240,7 @@
22+
23+
#secureDB (access rights will be set at install time)
24+
cp $BuiltFBDir/$SecurityDatabase ${TargetDir}@FB_SECDBDIR@
25+
+ cp $BuiltFBDir/msg.gbak ${TargetDir}@FB_SECDBDIR@
26+
27+
#include (.h .pas files)
28+
cp $BuiltFBDir/include/*.h ${TargetDir}@FB_INCDIR@

0 commit comments

Comments
 (0)