8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Work in progress on CORE-3885: Firebird for Android, build is complete

This commit is contained in:
alexpeshkoff 2015-01-27 10:46:48 +00:00
parent 6271ba0476
commit 69cdd58f19
11 changed files with 86 additions and 26 deletions

View File

@ -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 $^ $@
#---------------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -104,3 +104,13 @@ $(OBJ)/%.o: $(SRC_ROOT)/%.cpp
$(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
windres --output-format=coff --include-dir=$(<D) $< $@
# Rule for making gbak files when cross-compiling
.SUFFIXES: .gbak .fdb
$(GEN_ROOT)/$(TARGET)/%.gbak: $(GEN_ROOT)/Native/%.fdb
$(RUN_GBAK) -b $(firstword $<) $(firstword $@)
$(GEN_ROOT)/%.gbak: $(GEN_ROOT)/%.fdb
$(RUN_GBAK) -b $(firstword $<) $(firstword $@)

View File

@ -706,6 +706,7 @@ AC_CHECK_HEADERS(sys/mount.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/syscall.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(setjmp.h)
AC_CHECK_HEADERS(stdarg.h)

View File

@ -200,7 +200,7 @@ void Thread::kill(Handle& thread)
ThreadId Thread::getId()
{
#ifdef LINUX
#if defined(LINUX) && !defined(ANDROID)
return syscall(SYS_gettid);
#else
return pthread_self();

View File

@ -56,7 +56,7 @@ typedef THREAD_ENTRY_DECLARE ThreadEntryPoint(THREAD_ENTRY_PARAM);
#if defined(WIN_NT)
typedef DWORD ThreadId;
#elif defined(LINUX)
#elif defined(LINUX) && !defined(ANDROID)
typedef int ThreadId;
#elif defined(USE_POSIX_THREADS)
typedef pthread_t ThreadId;

View File

@ -56,7 +56,7 @@ namespace
// This helps initialize globals, needed before regular ctors run
int initDone = 0;
#ifndef WIN_NT
#ifdef HAVE_PTHREAD_ATFORK
void child(void)
{
// turn off dtors execution in forked process
@ -132,7 +132,7 @@ namespace
#endif //DEBUG_INIT
initDone = 1;
#ifndef WIN_NT
#ifdef HAVE_PTHREAD_ATFORK
int ret = pthread_atfork(NULL, NULL, child);
#endif

View File

@ -125,7 +125,7 @@
/* #undef GPRE_PASCAL */
/* Define to 1 if you have the <aio.h> 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 <errno.h> 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

View File

@ -92,12 +92,10 @@
#include "../auth/trusted/AuthSspi.h"
#include "../auth/SecureRemotePassword/server/SrpServer.h"
#ifdef UNIX
#ifdef NETBSD
#include <signal.h>
#else
#ifdef HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
#else
#include <signal.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H