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

Make posix build use libtomcrypt from extern or system.

This commit is contained in:
Adriano dos Santos Fernandes 2017-09-06 16:32:12 +00:00
parent 24db8f62ac
commit 98702b9cda
7 changed files with 129 additions and 52 deletions

View File

@ -35,7 +35,8 @@ 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@"
TomMathBuild="@TOMMATH_BUILD@"
TomCryptBuild="@TOMCRYPT_BUILD@"
#------------------------------------------------------------------------
@ -235,11 +236,16 @@ 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
if [ "$TomMathBuild" = "Y" ]; then
makeDirs @FB_LIBDIR@/.tm
cp -df $BuildRootDir/extern/libtommath/.libs/libtommath.so* ${TargetDir}@FB_LIBDIR@/.tm
fi
if [ "$TomCryptBuild" = "Y" ]; then
makeDirs @FB_LIBDIR@/.tm
cp -df $BuildRootDir/extern/libtomcrypt/.libs/libtomcrypt.so* ${TargetDir}@FB_LIBDIR@/.tm
fi
chmod 0755 ${TargetDir}@FB_LIBDIR@/*.so*
#plugins

View File

@ -219,10 +219,15 @@ checkLibrary() {
#------------------------------------------------------------------------
# Make sure we have required libraries installed
checkLibraries() {
if [ "@TOMBUILD@" != "Y" ]
if [ "@TOMMATH_BUILD@" != "Y" ]
then
checkLibrary tommath
fi
if [ "@TOMCRYPT_BUILD@" != "Y" ]
then
checkLibrary tomcrypt
fi
}
@ -285,21 +290,21 @@ checkIfServerRunning() {
# The following check for running interbase or firebird 1.0 servers.
checkString=`grepProcess "ibserver|ibguard"`
if [ ! -z "$checkString" ]
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird/InterBase Super server seems to be running."
echo "An instance of the Firebird/InterBase Super server seems to be running."
echo "(the ibserver or ibguard process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed."
exit 1
exit 1
fi
checkString=`grepProcess "gds_inet_server|gds_pipe"`
if [ ! -z "$checkString" ]
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird/InterBase Classic server seems to be running."
echo "An instance of the Firebird/InterBase Classic server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed."
exit 1
echo "Please quit all Firebird applications and then proceed."
exit 1
fi
}
@ -344,7 +349,7 @@ replaceLineInFile() {
newLine="$2"
oldLine=`grep "$3" $FileName`
if [ -z "$oldLine" ]
if [ -z "$oldLine" ]
then
echo "$newLine" >> "$FileName"
elif [ "$oldLine" != "$newLine" ]
@ -702,7 +707,7 @@ archivePriorInstallSystemFiles() {
echo " The installation target directory $DestFile already exists."
echo " This and other related files found will be"
echo " archived in the file : ${tarArc}"
echo ""
echo ""
if [ ! -z "$InteractiveInstall" ]
then
@ -797,7 +802,7 @@ removeInstalledFiles() {
#------------------------------------------------------------------------
# removeUninstallFiles
# Under the install directory remove all the empty directories
# Under the install directory remove all the empty directories
# If some files remain then
removeUninstallFiles() {
@ -809,7 +814,7 @@ removeUninstallFiles() {
#------------------------------------------------------------------------
# removeEmptyDirs
# Under the install directory remove all the empty directories
# Under the install directory remove all the empty directories
# This routine loops, since deleting a directory possibly makes
# the parent empty as well

View File

@ -9,29 +9,29 @@
# version 2.1 of the License, or (at your option) any later version.
# You may obtain a copy of the Licence at
# http://www.gnu.org/licences/lgpl.html
#
#
# As a special exception this file can also be included in modules
# with other source code as long as that source code has been
# released under an Open Source Initiative certificed licence.
# More information about OSI certification can be found at:
# http://www.opensource.org
#
# with other source code as long as that source code has been
# released under an Open Source Initiative certificed licence.
# More information about OSI certification can be found at:
# http://www.opensource.org
#
# This module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public Licence for more details.
#
# This module was created by members of the firebird development
# team. All individual contributions remain the Copyright (C) of
# those individuals and all rights are reserved. Contributors to
# this file are either listed below or can be obtained from a SVN
#
# This module was created by members of the firebird development
# team. All individual contributions remain the Copyright (C) of
# those individuals and all rights are reserved. Contributors to
# this file are either listed below or can be obtained from a SVN
# history command.
#
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
#
# Contributor(s):
# Alex Peshkoff - created single makefile based on Mark's files
#
#
ROOT=$(shell cd ..; pwd)
@ -137,12 +137,18 @@ external:
$(MAKE) -C $(ROOT)/extern/decNumber
ln -sf $(ROOT)/extern/decNumber/libdecFloat.a $(LIB)
ifeq ($(TOMBUILD_FLG),Y)
ifeq ($(TOMMATH_BUILD_FLG),Y)
CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC=$(GCC)
ln -sf $(TOMMATH_SO).$(TOMMATH_VER) $(LIB)
ln -sf $(TOMMATH_SO) $(LIB)
endif
ifeq ($(TOMCRYPT_BUILD_FLG),Y)
CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtomcrypt -f makefile.shared GCC=$(GCC)
ln -sf $(TOMCRYPT_SO).$(TOMCRYPT_VER) $(LIB)
ln -sf $(TOMCRYPT_SO) $(LIB)
endif
ifeq ($(STD_EDITLINE),false)
ifeq ($(EDITLINE_FLG),Y)
$(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline
@ -164,12 +170,26 @@ export_lists: $(ALLVERS)
#
.PHONY: tommath
TOMLIB=$(LIB)/libtommath.a
TOMMATH_LIB=$(LIB)/libtommath.a
TOM_Objs=$(addprefix ../extern/libtommath/,$(call doObjects,$(call dirFiles,../extern/libtommath)))
tommath: $(TOMLIB)
tommath: $(TOMMATH_LIB)
$(TOMLIB): $(TOM_Objs)
$(TOMMATH_LIB): $(TOM_Objs)
-$(RM) $@
$(STATICLIB_LINK) $@ $^
#___________________________________________________________________________
# LibTomCrypt - used by cross-builds
#
.PHONY: tomcrypt
TOMCRYPT_LIB=$(LIB)/libtomcrypt.a
TOM_Objs=$(addprefix ../extern/libtomcrypt/,$(call doObjects,$(call dirFiles,../extern/libtomcrypt)))
tomcrypt: $(TOMCRYPT_LIB)
$(TOMCRYPT_LIB): $(TOM_Objs)
-$(RM) $@
$(STATICLIB_LINK) $@ $^
@ -197,7 +217,7 @@ endif
# Now having ready such useful tools as gbak and isql, we may restore / create
# required databases and switch to full-featured gpre
$(MAKE) gpre
# Pay attention - after build force gpre_current to point to gpre
# Pay attention - after build force gpre_current to point to gpre
# even if gpre itself was not rebuilt
-$(RM) $(GPRE_CURRENT)
(cd $(BIN); $(LN) $(notdir $(GPRE)) $(notdir $(GPRE_CURRENT)))
@ -232,7 +252,7 @@ endif
# Now having ready such useful tools as gbak and isql, we may restore / create
# required databases and switch to full-featured gpre
$(MAKE) gpre
# Pay attention - after build force gpre_current to point to gpre
# Pay attention - after build force gpre_current to point to gpre
# even if gpre itself was not rebuilt
-$(RM) $(GPRE_CURRENT)
(cd $(BIN); $(LN) $(notdir $(RUN_GPRE)) $(notdir $(GPRE_CURRENT)))
@ -243,6 +263,7 @@ cross2:
ln -sf $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h
$(MAKE) prerequisites
$(MAKE) tommath
$(MAKE) tomcrypt
$(MAKE) yvalve
$(MAKE) engine
$(MAKE) fbintl
@ -641,7 +662,7 @@ $(INCLUDE_DEST)/firebird/%: $(SRC_ROOT)/include/firebird/%
include $(ROOT)/gen/make.shared.targets
Dependencies = $(AllObjects:.o=.d)
Dependencies = $(AllObjects:.o=.d)
-include $(Dependencies)
@ -650,7 +671,7 @@ Dependencies = $(AllObjects:.o=.d)
#
.PHONY: install silent_install install-embedded package packages dist
install install-embedded silent_install package packages dist:
$(MAKE) -f Makefile.install $@
@ -665,7 +686,7 @@ install install-embedded silent_install package packages dist:
clean: clean_objects clean_dependancies clean_extern_objects clean_build \
clean_yacc_gen clean_gpre_gen clean_dbs clean_examples clean_tommath \
clean_decfloat
clean_tomcrypt clean_decfloat
ifeq ($(EDITLINE_FLG),Y)
ifeq ($(STD_EDITLINE),false)
@ -705,6 +726,9 @@ clean_editline:
clean_tommath:
-$(MAKE) -C $(ROOT)/extern/libtommath clean
clean_tomcrypt:
-$(MAKE) -C $(ROOT)/extern/libtomcrypt clean
clean_decfloat:
-$(MAKE) -C $(ROOT)/extern/decNumber clean

View File

@ -48,7 +48,8 @@ LNG_ROOT=$(ROOT)/lang_helpers
EXA_ROOT=$(ROOT)/examples
IsCross=@IS_CROSS@
TOMBUILD_FLG=@TOMBUILD@
TOMMATH_BUILD_FLG=@TOMMATH_BUILD@
TOMCRYPT_BUILD_FLG=@TOMCRYPT_BUILD@
FB_BUILD=$(GEN_ROOT)/$(TARGET)/firebird
ifeq ($(IsCross), Y)
@ -134,6 +135,9 @@ CAS_OPTIONS=@CAS_OPTIONS@
MATHLIB=@MATHLIB@
DECLIB=-ldecFloat
# crypt library
CRYPTLIB=@CRYPTLIB@
LSB_FLG=@LSB_FLG@
ifeq ($(LSB_FLG), Y)
LSB_UNDEF=-Wl,--allow-shlib-undefined
@ -211,7 +215,7 @@ vpath %.dll $(LIB)
# From jrd
# The firebird shared library name
# The firebird shared library name
# SD: This name is also hard-coded in builds/install/.../linux/classic scripts.
# Scold me, but I don't want library names to be in configure.in
#
@ -256,6 +260,12 @@ TOMMATH_INC=$(TOMMATH)
TOMMATH_SO=$(TOMMATH)/.libs/libtommath.so
TOMMATH_VER=0
# Own tomcrypt support
TOMCRYPT=$(ROOT)/extern/libtomcrypt
TOMCRYPT_INC=$(TOMCRYPT)/src/headers
TOMCRYPT_SO=$(TOMCRYPT)/.libs/libtomcrypt.so
TOMCRYPT_VER=0
# LINKER OPTIONS
#
@ -296,7 +306,7 @@ endif
LIB_PATH_OPTS = $(call LIB_LINK_RPATH,lib) $(call LIB_LINK_RPATH,intl)
LIB_LINK_SONAME= -Wl,-soname,$(1)
LIB_LINK_MAPFILE= -Wl,--version-script,$(1)
FIREBIRD_LIBRARY_LINK= -L$(LIB) -lfbclient $(MATHLIB)
FIREBIRD_LIBRARY_LINK= -L$(LIB) -lfbclient $(MATHLIB) $(CRYPTLIB)
EXE_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) $(LINK_EMPTY_SYMBOLS)
LIB_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) -shared
@ -322,7 +332,7 @@ LINK_TRACE_LIBS = -L$(LIB) $(SO_LINK_LIBS)
LINK_FIREBIRD = $(LIB_LINK) $(LINK_FIREBIRD_SYMBOLS) $(LIB_LINK_OPTIONS) $(LIB_FIREBIRD_OPTIONS) $(UNDEF_FLAGS)\
$(call LIB_LINK_SONAME,$(LibrarySoName)) $(call LIB_LINK_RPATH,lib)
LINK_FIREBIRD_LIBS = -L$(LIB) $(LIB_GUI) $(SO_LINK_LIBS) $(MATHLIB)
LINK_FIREBIRD_LIBS = -L$(LIB) $(LIB_GUI) $(SO_LINK_LIBS) $(MATHLIB) $(CRYPTLIB)
LINK_ENGINE = $(LIB_LINK) $(LINK_PLUGIN_SYMBOLS) $(LIB_LINK_OPTIONS) $(LIB_FIREBIRD_OPTIONS) $(UNDEF_FLAGS)\
$(call LIB_LINK_SONAME,$(EngineSoName)) $(call LIB_LINK_RPATH,lib)

View File

@ -34,10 +34,14 @@
# 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)
ifeq ($(TOMMATH_BUILD_FLG),Y)
WFLAGS += -I$(TOMMATH_INC)
endif
ifeq ($(TOMCRYPT_BUILD_FLG),Y)
WFLAGS += -I$(TOMCRYPT_INC)
endif
ifeq ($(LSB_FLG),Y)
WFLAGS += -DLSB_BUILD
endif

View File

@ -237,7 +237,7 @@ dnl CPU_TYPE=ppc64
STD_EDITLINE=true
;;
aarch64*-*-linux*)
aarch64*-*-linux*)
MAKEFILE_PREFIX=linux_arm64
INSTALL_PREFIX=linux
PLATFORM=LINUX
@ -249,7 +249,7 @@ dnl CPU_TYPE=ppc64
libdir=/usr/lib64
;;
powerpc64le-*-linux*)
powerpc64le-*-linux*)
MAKEFILE_PREFIX=linux_powerpc64el
INSTALL_PREFIX=linux
PLATFORM=LINUX
@ -261,7 +261,7 @@ dnl CPU_TYPE=ppc64
libdir=/usr/lib64
;;
powerpc64-*-linux*)
powerpc64-*-linux*)
MAKEFILE_PREFIX=linux_powerpc64
INSTALL_PREFIX=linux
PLATFORM=LINUX
@ -525,11 +525,17 @@ AC_ARG_WITH(cross-build,
IS_CROSS=Y])
AC_SUBST(IS_CROSS)
TOMBUILD=N
TOMMATH_BUILD=N
AC_ARG_WITH(builtin-tommath,
[ --with-builtin-tommath build libtommath library from firebird tree],
[TOMBUILD=Y])
AC_SUBST(TOMBUILD)
[TOMMATH_BUILD=Y])
AC_SUBST(TOMMATH_BUILD)
TOMCRYPT_BUILD=N
AC_ARG_WITH(builtin-tomcrypt,
[ --with-builtin-tomcrypt build libtomcrypt library from firebird tree],
[TOMCRYPT_BUILD=Y])
AC_SUBST(TOMCRYPT_BUILD)
dnl Avoid dumb '-g -O2' autoconf's default
dnl Debugging information and optimization flags should be set in prefix.$platform file
@ -582,9 +588,10 @@ AC_ARG_ENABLE(lsb-build,
esac])
AC_SUBST(LSB_FLG)
if test "$LSB_FLG" = "Y"; then
CFLAGS="$CFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath --lsb-target-version=4.1"
CXXFLAGS="$CXXFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath --lsb-target-version=4.1"
AC_SUBST(TOMBUILD, Y)
CFLAGS="$CFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath:tomcrypt --lsb-target-version=4.1"
CXXFLAGS="$CXXFLAGS --lsb-besteffort --lsb-shared-libs=fbclient:ib_util:tommath:tomcrypt --lsb-target-version=4.1"
AC_SUBST(TOMMATH_BUILD, Y)
AC_SUBST(TOMCRYPT_BUILD, Y)
AC_PATH_PROG(CC, lsbcc, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR])
AC_PATH_PROG(CXX, lsbc++, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR])
if test "x$CC" = "x" || test "x$CXX" = "x" ; then
@ -812,7 +819,7 @@ AC_CHECK_LIB(icuuc, main, ICU_OK=yes, AC_MSG_ERROR(ICU support not found - pleas
fi
dnl check for tommath presence
if test "$TOMBUILD" = "Y"; then
if test "$TOMMATH_BUILD" = "Y"; then
MATHLIB=-ltommath
else
AC_CHECK_HEADER(tommath.h,,
@ -825,6 +832,23 @@ else
fi
AC_SUBST(MATHLIB)
dnl check for tomcrypt presence
if test "$TOMCRYPT_BUILD" = "Y"; then
CRYPTLIB=-ltomcrypt
else
XE_SAVE_ENV()
CFLAGS="$CFLAGS -DLTC_NO_ASM"
AC_CHECK_HEADER(tomcrypt.h,,
AC_MSG_ERROR(Include file for tomcrypt not found - please install development tomcrypt package or use --with-builtin-tomcrypt))
XE_RESTORE_ENV()
XE_SAVE_ENV()
LIBS=
AC_CHECK_LIB(tomcrypt, sha1_init, CRYPTLIB=-ltomcrypt,
AC_MSG_ERROR(Library tomcrypt not found - please install development tomcrypt package or use --with-builtin-tomcrypt))
XE_RESTORE_ENV()
fi
AC_SUBST(CRYPTLIB)
dnl Check for libraries
AC_SEARCH_LIBS(dlopen, dl)
AC_CHECK_LIB(m, main)
@ -860,7 +884,7 @@ AC_COMPILE_IFELSE(
dnl check for va_copy() in stdarg.h
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <stdarg.h>
void vafun(const char* fmt, ...) {va_list par, par2; va_start(par, fmt); va_copy(par2, par); va_end(par2); va_end(par);}]],
void vafun(const char* fmt, ...) {va_list par, par2; va_start(par, fmt); va_copy(par2, par); va_end(par2); va_end(par);}]],
[[return 0;]])],
AC_DEFINE(HAVE_VA_COPY, 1, [Define this if va_copy() is defined in stdarg.h]))

View File

@ -24,7 +24,11 @@
#include "firebird.h"
#include "../common/classes/Hash.h"
#include "../common/tomcrypt/tomcrypt.h"
#if !defined(__GNUC__) || defined(__clang__)
#define LTC_NO_ASM // disable ASM in tomcrypt headers
#endif
#include <tomcrypt.h>
using namespace Firebird;