From 69cdd58f1925af8c142958e8ddc0779fa4beadb4 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Tue, 27 Jan 2015 10:46:48 +0000 Subject: [PATCH] Work in progress on CORE-3885: Firebird for Android, build is complete --- builds/posix/Makefile.in | 30 +++++++++++++++---- builds/posix/Makefile.in.plugins_examples | 4 +++ builds/posix/make.android.arme | 35 ++++++++++++++++++---- builds/posix/make.defaults | 5 ++-- builds/posix/make.rules | 10 +++++++ configure.ac | 1 + src/common/ThreadStart.cpp | 2 +- src/common/ThreadStart.h | 2 +- src/common/classes/init.cpp | 4 +-- src/include/cross/android.arme | 11 ++++--- src/remote/server/os/posix/inet_server.cpp | 8 ++--- 11 files changed, 86 insertions(+), 26 deletions(-) diff --git a/builds/posix/Makefile.in b/builds/posix/Makefile.in index 86ea5dab87..84b7710e7c 100644 --- a/builds/posix/Makefile.in +++ b/builds/posix/Makefile.in @@ -130,7 +130,7 @@ $(TOMLIB): $(TOM_Objs) # main build target for both debug abd release builds # -.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples +.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest master_process: ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h @@ -187,12 +187,21 @@ endif # even if gpre itself was not rebuilt -$(RM) $(GPRE_CURRENT) (cd $(BIN); $(LN) $(notdir $(RUN_GPRE)) $(notdir $(GPRE_CURRENT))) + $(MAKE) include_generic + $(MAKE) -f Makefile.examples -C $(GEN_ROOT)/examples/ cross2: ln -sf $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h + $(MAKE) prerequisites $(MAKE) tommath $(MAKE) yvalve - + $(MAKE) engine + $(MAKE) fbintl + $(MAKE) utilities + $(MAKE) $(GPRE) + $(MAKE) plugins + $(MAKE) -f Makefile.plugins_examples -C $(GEN_ROOT)/examples/ + $(MAKE) cross_rest #___________________________________________________________________________ # static library - various common code, used in different FB projects @@ -493,10 +502,17 @@ $(IDS): $(SRC_ROOT)/misc/ids.m $(SRC_ROOT)/jrd/relations.h # all the rest we need to build # -.PHONY: qli message_file +.PHONY: qli message_file gbak_files + +FDB_FILES := $(HELP_FDB) $(ROOT)/gen/msg.fdb $(SECURITY_FDB) $(FIREBIRD)/examples/empbuild/employee.fdb +GBAK_FILES := $(FDB_FILES:.fdb=.gbak) $(FIREBIRD)/msg.gbak +GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES)) rest: qli message_file +cross_rest: qli gbak_files + $(MAKE) $(BUILD_FILE) + qli: $(QLI) $(QLI): $(QLI_Objects) $(COMMON_LIB) @@ -508,13 +524,17 @@ examples: include_generic message_file: $(FIREBIRD_MSG) -$(FIREBIRD_MSG): $(RUN_BUILD_FILE) msg.timestamp - $(RUN_BUILD_FILE) -d msg.fdb -f $@ +$(FIREBIRD_MSG): $(BUILD_FILE) msg.timestamp + $(BUILD_FILE) -d msg.fdb -f $@ $(CHMOD_6) $@ $(BUILD_FILE): $(BUILD_Objects) $(COMMON_LIB) $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) +gbak_files: $(GBAK_FILES) + +$(GEN_ROOT)/$(TARGET)/firebird/msg.gbak: $(ROOT)/gen/msg.gbak + cp $^ $@ #--------------------------------------------------------------------------- diff --git a/builds/posix/Makefile.in.plugins_examples b/builds/posix/Makefile.in.plugins_examples index a6cfcefab2..40908f6eb1 100644 --- a/builds/posix/Makefile.in.plugins_examples +++ b/builds/posix/Makefile.in.plugins_examples @@ -39,7 +39,11 @@ endif CPPFLAGS+= -I$(FB_BUILD)/include include $(ROOT)/gen/make.defaults +ifeq ($(CROSS_OUT), Y) +include $(ROOT)/gen/make.crossPlatform +else include $(ROOT)/gen/make.platform +endif include $(ROOT)/gen/make.rules include $(ROOT)/gen/make.shared.variables diff --git a/builds/posix/make.android.arme b/builds/posix/make.android.arme index 6a39d47235..c1c5e1de9c 100644 --- a/builds/posix/make.android.arme +++ b/builds/posix/make.android.arme @@ -3,16 +3,24 @@ ifeq ($(NDK),) $(error Must export NDK location before building for Android) endif NDK_ROOT:=$(NDK) -NDK_LOG:=1 +#NDK_LOG:=1 include $(NDK)/build/core/init.mk + TOOLCHAIN_DIR:=$(foreach chain, $(NDK_ALL_TOOLCHAINS), $(if $(findstring arm, $(chain)), $(chain), )) -TOOLCHAIN_DIR:=$(strip $(TOOLCHAIN_DIR)) +# Filter out clang +TEMP_LIST_DIR := $(foreach chain, $(TOOLCHAIN_DIR), $(if $(findstring clang, $(chain)), , $(chain))) +ifdef TEMP_LIST_DIR + TOOLCHAIN_DIR := $(TEMP_LIST_DIR) +endif +# use freshmost compiler +TOOLCHAIN_DIR:=$(lastword $(TOOLCHAIN_DIR)) + ifeq ($(HOST_TAG64),) HOST_TAG64:=linux-x86 endif NDK_TOOLCHAIN_VERSION:=$(shell echo $(TOOLCHAIN_DIR) | awk -F - '{print $$NF;}') -CROSS_PLATFORM:=$(NDK)/platforms/android-9/arch-arm +CROSS_PLATFORM:=$(NDK)/platforms/android-14/arch-arm CROSS_PREFIX:=$(NDK)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG64)/bin/arm-linux-androideabi- CXX:=$(CROSS_PREFIX)g++ @@ -28,8 +36,9 @@ STRIP:=$(CROSS_PREFIX)strip COMMON_FLAGS=-ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DANDROID -DARM -pipe -MMD -fPIC -fmessage-length=0 \ -I$(ROOT)/extern/libtommath --sysroot=$(CROSS_PLATFORM) \ - -I/usr/include -OPTIMIZE_FLAGS=-O0 -fno-omit-frame-pointer # optimizing cause bugs... - i.e. -O0 + -I$(CROSS_PLATFORM)/usr/include -I$(ROOT)/gen/cross + +OPTIMIZE_FLAGS=-fno-omit-frame-pointer WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable PROD_FLAGS=$(COMMON_FLAGS) $(OPTIMIZE_FLAGS) @@ -47,3 +56,19 @@ SO_LINK_LIBS = $(DroidLibs) EXE_LINK_OPTIONS= $(LDFLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) $(LINK_EMPTY_SYMBOLS) LIB_LINK_OPTIONS= $(LDFLAGS) -shared + +UNICODE_DIR := $(shell dirname `find /usr/include -name ucnv.h`) +UNICODE_DIR := $(filter %unicode, $(UNICODE_DIR)) +UNICODE_DIR := $(firstword $(UNICODE_DIR)) +ifndef UNICODE_DIR + $(error ERROR while locating ICU include directory, probably missing ucnv.h) +endif + +.PHONY: prerequisites +prerequisites: $(ROOT)/gen/cross/unicode + +$(ROOT)/gen/cross/unicode: + echo $(UNICODE_DIR) + rm -rf $(ROOT)/gen/cross + mkdir $(ROOT)/gen/cross + ln -s $(UNICODE_DIR) cross/unicode diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index 1a091f67f8..b349efbc24 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -297,8 +297,8 @@ FB_DAEMON = $(BIN)/firebird$(EXEC_EXT) # Per-library link rules LINK_UDF = $(LIB_LINK) $(LIB_LINK_OPTIONS) $(call LIB_LINK_SONAME,$(1).$(SHRLIB_EXT)) $(UNDEF_FLAGS)\ - $(call LIB_LINK_RPATH,lib) $(SO_LINK_LIBS) -LINK_UDF_LIBS = $(THR_LIBS) -L$(LIB) -lib_util + $(call LIB_LINK_RPATH,lib) +LINK_UDF_LIBS = $(THR_LIBS) -L$(LIB) -lib_util $(SO_LINK_LIBS) LINK_IB_UTIL = $(LIB_LINK) $(LINK_IBUTIL_SYMBOLS) $(LIB_LINK_OPTIONS) $(UNDEF_FLAGS)\ $(call LIB_LINK_SONAME,$(IbUtilLibraryName)) $(call LIB_LINK_RPATH,lib) @@ -375,7 +375,6 @@ GPRE_CURRENT = $(RBIN)/gpre_current$(EXEC_EXT) # From msgs CHECK_MESSAGES = $(BIN)/check_messages$(EXEC_EXT) BUILD_FILE = $(BIN)/build_file$(EXEC_EXT) -RUN_BUILD_FILE = $(RBIN)/build_file$(EXEC_EXT) FIREBIRD_MSG = $(FIREBIRD)/firebird.msg ENTER_MESSAGES = $(BIN)/enter_messages$(EXEC_EXT) diff --git a/builds/posix/make.rules b/builds/posix/make.rules index 62b0ddbd99..42c719dc09 100644 --- a/builds/posix/make.rules +++ b/builds/posix/make.rules @@ -104,3 +104,13 @@ $(OBJ)/%.o: $(SRC_ROOT)/%.cpp $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc windres --output-format=coff --include-dir=$( header file. */ -#define HAVE_AIO_H 1 +/* #undef HAVE_AIO_H */ /* Define this if AO_compare_and_swap_full() is defined in atomic_ops.h */ /* #undef HAVE_AO_COMPARE_AND_SWAP_FULL */ @@ -162,7 +162,7 @@ #define HAVE_DLFCN_H 1 /* Define this if editline is in use */ -#define HAVE_EDITLINE_H 1 +/* #undef HAVE_EDITLINE_H */ /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 @@ -291,7 +291,7 @@ #define HAVE_POLL_H 1 /* Define this if posix_fadvise() is present on the platform */ -#define HAVE_POSIX_FADVISE 1 +/* #undef HAVE_POSIX_FADVISE */ /* Define to 1 if you have the `pread' function. */ #define HAVE_PREAD 1 @@ -369,7 +369,7 @@ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `sigset' function. */ -#define HAVE_SIGSET 1 +/* #undef HAVE_SIGSET */ /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 @@ -587,6 +587,9 @@ /* Architecture is big-edian sh4 */ /* #undef SHEB */ +/* Extension for shared libraries */ +#define SHRLIB_EXT "so" + /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 4 diff --git a/src/remote/server/os/posix/inet_server.cpp b/src/remote/server/os/posix/inet_server.cpp index bc1e400403..4d935e0b86 100644 --- a/src/remote/server/os/posix/inet_server.cpp +++ b/src/remote/server/os/posix/inet_server.cpp @@ -92,12 +92,10 @@ #include "../auth/trusted/AuthSspi.h" #include "../auth/SecureRemotePassword/server/SrpServer.h" -#ifdef UNIX -#ifdef NETBSD -#include -#else +#ifdef HAVE_SYS_SIGNAL_H #include -#endif +#else +#include #endif #ifdef HAVE_SYS_RESOURCE_H