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

Fixed CORE-5205: Add a switch to build linux binaries with builtin libtommath

This commit is contained in:
Alexander Peshkov 2016-04-24 18:09:48 +03:00
parent fd5b922cd1
commit a11b0adb1e
10 changed files with 85 additions and 8 deletions

View File

@ -573,3 +573,10 @@ haveLibrary() {
return $?
}
#------------------------------------------------------------------------
# refresh cache of dynamic loader after add/delete files in system libdir
reconfigDynamicLoader() {
ldconfig
}

View File

@ -33,6 +33,7 @@ BuildRootDir=..
BuiltFBDir=Release/firebird # Where the just build fb exists.
TargetDir=buildroot # Where we want to build the install image
SecurityDatabase=security4.fdb
TomBuild="@TOMBUILD@"
#------------------------------------------------------------------------
@ -238,6 +239,11 @@ copyFiles() {
cp -df $BuiltFBDir/lib/libfbclient.so* ${TargetDir}@FB_LIBDIR@
cp -f $BuiltFBDir/lib/libib_util.so ${TargetDir}@FB_LIBDIR@/libib_util.so
if [ "$TomBuild" = "Y" ]; then
makeDirs @FB_LIBDIR@/.tm
cp -df $BuildRootDir/extern/libtommath/.libs/libtommath.so* ${TargetDir}@FB_LIBDIR@/.tm
fi
chmod 0755 ${TargetDir}@FB_LIBDIR@/*.so*
#plugins

View File

@ -164,10 +164,22 @@ missingLibrary() {
}
#------------------------------------------------------------------------
# Check library presence, errorexit when missing
checkLibrary() {
libName=${1}
haveLibrary $libName || missingLibrary $libName
}
#------------------------------------------------------------------------
# Make sure we have required libraries installed
checkLibraries() {
haveLibrary tommath || missingLibrary tommath
if [ "@TOMBUILD@" != "Y" ]
then
checkLibrary tommath
fi
}
@ -583,8 +595,10 @@ createLinksForBackCompatibility() {
createLinksInSystemLib() {
LibDir=`CorrectLibDir @libdir@`
tommath=libtommath.@SHRLIB_EXT@
tomdir=@FB_LIBDIR@/.tm
origDirLinksInSystemLib=`pwd`
cd @FB_LIBDIR@
Libraries=`echo libfbclient.@SHRLIB_EXT@* libib_util.@SHRLIB_EXT@`
@ -594,7 +608,23 @@ createLinksInSystemLib() {
safeLink @FB_LIBDIR@/$l .$LibDir/$l ${MANIFEST_TXT}
done
if [ -d $tomdir ]; then
cd $tomdir
Libraries=""
if [ ! -f $LibDir/$tommath ]; then
Libraries=`echo ${tommath}*`
fi
cd /
for l in $Libraries
do
safeLink @FB_LIBDIR@/.tm/$l .$LibDir/$l ${MANIFEST_TXT}
done
fi
cd $origDirLinksInSystemLib
reconfigDynamicLoader
}
#------------------------------------------------------------------------

View File

@ -36,3 +36,5 @@ if [ -d $PidDir ]
then
rm -rf $PidDir
fi
reconfigDynamicLoader

View File

@ -126,6 +126,12 @@ extern:
$(MAKE) -C $(ROOT)/extern/btyacc
$(MAKE) -C $(ROOT)/extern/cloop TARGET=release WITH_FPC=0 BUILD_DIR=$(TMP_ROOT)/cloop OUT_DIR=$(GEN_ROOT)/$(TARGET)/cloop
ifeq ($(TOMBUILD_FLG),Y)
$(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared
ln -sf $(TOMMATH_SO).$(TOMMATH_VER) $(LIB)
ln -sf $(TOMMATH_SO) $(LIB)
endif
ifeq ($(STD_EDITLINE),false)
ifeq ($(EDITLINE_FLG),Y)
$(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline

View File

@ -48,6 +48,7 @@ LNG_ROOT=$(ROOT)/lang_helpers
EXA_ROOT=$(ROOT)/examples
IsCross=@IS_CROSS@
TOMBUILD_FLG=@TOMBUILD@
FB_BUILD=$(GEN_ROOT)/$(TARGET)/firebird
ifeq ($(IsCross), Y)
@ -249,6 +250,12 @@ endif
IbUtilLibraryName = $(LIB_PREFIX)ib_util.$(SHRLIB_EXT)
LIBIBUTIL_SO = $(LIB)/$(IbUtilLibraryName)
# Own tommath support
TOMMATH=$(ROOT)/extern/libtommath
TOMMATH_INC=$(TOMMATH)
TOMMATH_SO=$(TOMMATH)/.libs/libtommath.so
TOMMATH_VER=0
# LINKER OPTIONS
#

View File

@ -34,6 +34,10 @@
# Please don't use compiler/platform specific flags here - nmcc 02-Nov-2002
WFLAGS =-I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include $(CPPFLAGS)
ifeq ($(TOMBUILD_FLG),Y)
WFLAGS += -I$(TOMMATH_INC)
endif
ifeq ($(TARGET),Release)
WFLAGS += $(PROD_FLAGS)
else

View File

@ -508,6 +508,12 @@ AC_ARG_WITH(cross-build,
IS_CROSS=Y])
AC_SUBST(IS_CROSS)
TOMBUILD=N
AC_ARG_WITH(builtin-tommath,
[ --with-builtin-tommath build libtommath library from firebird tree],
[TOMBUILD=Y])
AC_SUBST(TOMBUILD)
dnl Avoid dumb '-g -O2' autoconf's default
dnl Debugging information and optimization flags should be set in prefix.$platform file
dnl Should be replaced with AC_PROG_GCC_DEFAULT_FLAGS() when available
@ -765,11 +771,17 @@ dnl setting ICU_OK here is done to only avoid default action
AC_CHECK_LIB(icuuc, main, ICU_OK=yes, AC_MSG_ERROR(ICU support not found - please install development ICU package))
dnl check for tommath presence
XE_SAVE_ENV()
LIBS=
AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
AC_CHECK_LIB(tommath, mp_init, MATHLIB=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
XE_RESTORE_ENV()
if test "$TOMBUILD" = "Y"; then
MATHLIB=-ltommath
else
AC_CHECK_HEADER(tommath.h,,
AC_MSG_ERROR(Include file for tommath not found - please install development tommath package or use --with-builtin-tommath))
XE_SAVE_ENV()
LIBS=
AC_CHECK_LIB(tommath, mp_init, MATHLIB=-ltommath,
AC_MSG_ERROR(Library tommath not found - please install development tommath package or use --with-builtin-tommath))
XE_RESTORE_ENV()
fi
AC_SUBST(MATHLIB)
dnl Check for libraries

View File

@ -1,2 +1,5 @@
lib/
temp/
*.o
*.l*
.libs/

View File

@ -83,7 +83,7 @@ bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o
objs: $(OBJECTS)
$(LIBNAME): $(OBJECTS)
libtool --mode=link gcc *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
libtool --mode=link --tag=CC gcc *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)