diff --git a/builds/install/arch-specific/linux/linuxLibrary.sh.in b/builds/install/arch-specific/linux/linuxLibrary.sh.in index f5217ebf9a..f1fe91e7d7 100644 --- a/builds/install/arch-specific/linux/linuxLibrary.sh.in +++ b/builds/install/arch-specific/linux/linuxLibrary.sh.in @@ -573,3 +573,10 @@ haveLibrary() { return $? } + +#------------------------------------------------------------------------ +# refresh cache of dynamic loader after add/delete files in system libdir + +reconfigDynamicLoader() { + ldconfig +} diff --git a/builds/install/arch-specific/linux/makeInstallImage.sh.in b/builds/install/arch-specific/linux/makeInstallImage.sh.in index 028aab726d..45baa9689e 100644 --- a/builds/install/arch-specific/linux/makeInstallImage.sh.in +++ b/builds/install/arch-specific/linux/makeInstallImage.sh.in @@ -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 diff --git a/builds/install/posix-common/posixLibrary.sh.in b/builds/install/posix-common/posixLibrary.sh.in index 7e4acafe88..c7910eaaad 100644 --- a/builds/install/posix-common/posixLibrary.sh.in +++ b/builds/install/posix-common/posixLibrary.sh.in @@ -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 } #------------------------------------------------------------------------ diff --git a/builds/install/posix-common/postuninstall.sh.in b/builds/install/posix-common/postuninstall.sh.in index e46e8a2004..2b3311e861 100644 --- a/builds/install/posix-common/postuninstall.sh.in +++ b/builds/install/posix-common/postuninstall.sh.in @@ -36,3 +36,5 @@ if [ -d $PidDir ] then rm -rf $PidDir fi + +reconfigDynamicLoader diff --git a/builds/posix/Makefile.in b/builds/posix/Makefile.in index 09f78d78f8..0097f69fde 100644 --- a/builds/posix/Makefile.in +++ b/builds/posix/Makefile.in @@ -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 diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index fb96fad291..f93ad7155b 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -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 # diff --git a/builds/posix/make.rules b/builds/posix/make.rules index 0d1769b5a5..e48228ef1d 100644 --- a/builds/posix/make.rules +++ b/builds/posix/make.rules @@ -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 diff --git a/configure.ac b/configure.ac index 9c2c22269b..0dd5403c7c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/extern/libtommath/.gitignore b/extern/libtommath/.gitignore index f3868f90cd..86cbfa9b3b 100644 --- a/extern/libtommath/.gitignore +++ b/extern/libtommath/.gitignore @@ -1,2 +1,5 @@ lib/ temp/ +*.o +*.l* +.libs/ diff --git a/extern/libtommath/makefile.shared b/extern/libtommath/makefile.shared index f17bbbd484..c0d159caf8 100644 --- a/extern/libtommath/makefile.shared +++ b/extern/libtommath/makefile.shared @@ -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)