|
| 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 | + |
0 commit comments