From a47a1699af0ea72eced944f4970905ee183a3e2d Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Fri, 23 Sep 2022 21:25:52 -0300 Subject: [PATCH] Allow to build using prefixed toolchain (configure --host). --- builds/install/arch-specific/linux/Makefile.in | 6 +++--- .../arch-specific/linux/makeInstallImage.sh.in | 6 +++--- builds/posix/Makefile.in | 16 ++++++++-------- builds/posix/make.defaults | 3 +++ configure.ac | 4 +++- extern/cloop/Makefile | 10 +++++++--- extern/editline/src/Makefile.in | 2 +- extern/libtommath/makefile.shared | 2 +- 8 files changed, 29 insertions(+), 20 deletions(-) diff --git a/builds/install/arch-specific/linux/Makefile.in b/builds/install/arch-specific/linux/Makefile.in index 347fbe13eb..320b96386a 100644 --- a/builds/install/arch-specific/linux/Makefile.in +++ b/builds/install/arch-specific/linux/Makefile.in @@ -93,13 +93,13 @@ buildDebugInfo: buildRoot for x in `(cd $(GEN_ROOT)/buildroot; find)`; do \ FIL=$(GEN_ROOT)/buildroot/$$x; \ D_FIL=$(GEN_ROOT)/$(DebugDir)/`dirname $${x}`/.debug/`basename $${x}`.debug; \ - if [ ! -h $$FIL ] && readelf -h $$FIL > /dev/null 2> /dev/null; then \ + if [ ! -h $$FIL ] && $(READELF) -h $$FIL > /dev/null 2> /dev/null; then \ mkdir -p $(GEN_ROOT)/$(DebugDir)/`dirname $$x`/.debug; \ echo Generating external debug info for $$x; \ cp $${FIL} $${D_FIL}; \ - objcopy --add-gnu-debuglink=$${D_FIL} $${FIL}; \ + $(OBJCOPY) --add-gnu-debuglink=$${D_FIL} $${FIL}; \ echo Stripping unneeded symbols from $${x}; \ - objcopy --strip-debug --strip-unneeded $${FIL}; \ + $(OBJCOPY) --strip-debug --strip-unneeded $${FIL}; \ fi; \ done (cd $(GEN_ROOT)/$(DebugDir); mkdir -p ./$(MiscDir); \ diff --git a/builds/install/arch-specific/linux/makeInstallImage.sh.in b/builds/install/arch-specific/linux/makeInstallImage.sh.in index 50ef9415ac..d5f9d5827d 100644 --- a/builds/install/arch-specific/linux/makeInstallImage.sh.in +++ b/builds/install/arch-specific/linux/makeInstallImage.sh.in @@ -37,7 +37,7 @@ TargetDir=buildroot # Where we want to build the install image SecurityDatabase=security5.fdb TomMathBuild="@TOMMATH_BUILD@" TomCryptBuild="@TOMCRYPT_BUILD@" - +OBJDUMP=@OBJDUMP@ #------------------------------------------------------------------------ # addLibs @@ -55,9 +55,9 @@ addLibs() { echo "#!/bin/sh" >>$libTarget echo >>$libTarget - LIB=`objdump -p $libSdir/firebird|grep NEEDED|grep tomcrypt|awk '{print $2;}'` + LIB=`$OBJDUMP -p $libSdir/firebird|grep NEEDED|grep tomcrypt|awk '{print $2;}'` [ "$LIB" ] && echo "export LIBTOMCRYPT=$LIB" >>$libTarget - LIB=$(echo `objdump -p $libSdir/isql|grep NEEDED|egrep "(curses|termcap|tinfo)"|awk '{print $2;}'`) + LIB=$(echo `$OBJDUMP -p $libSdir/isql|grep NEEDED|egrep "(curses|termcap|tinfo)"|awk '{print $2;}'`) [ "$LIB" ] && echo "export LIBCURSES='$LIB'" >>$libTarget echo >>$libTarget diff --git a/builds/posix/Makefile.in b/builds/posix/Makefile.in index 7a378cc51e..a60c72a64a 100644 --- a/builds/posix/Makefile.in +++ b/builds/posix/Makefile.in @@ -174,10 +174,10 @@ $(GEN_ROOT)/Make.Version : $(SRC_ROOT)/misc/writeBuildNum.sh # external: - CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/btyacc - CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(ROOT)/extern/cloop TARGET=release WITH_FPC=0 BUILD_DIR=$(TMP_ROOT)/cloop OUT_DIR=$(GEN_ROOT)/$(TARGET)/cloop + CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/btyacc + CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(ROOT)/extern/cloop TARGET=release WITH_FPC=0 BUILD_DIR=$(TMP_ROOT)/cloop OUT_DIR=$(GEN_ROOT)/$(TARGET)/cloop core - CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/decNumber + CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/decNumber ln -sf $(ROOT)/extern/decNumber/libdecFloat.a $(LIB) ifeq ($(ABSEIL_BUILD_FLG),Y) @@ -186,12 +186,12 @@ ifeq ($(ABSEIL_BUILD_FLG),Y) endif ifeq ($(RE2_BUILD_FLG),Y) - CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) -O3 -g -fPIC" $(MAKE) -C $(ROOT)/extern/re2 + CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) -O3 -g -fPIC" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/re2 ln -sf $(ROOT)/extern/re2/obj/libre2.a $(LIB) endif ifeq ($(TOMMATH_BUILD_FLG),Y) - CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC=$(GCC) + CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/libtommath -f makefile.shared GCC="$(CC)" ifeq ($(PLATFORM),DARWIN) install_name_tool -id "@rpath/lib/libtommath.dylib" $(TOMMATH)/.libs/libtommath.0.dylib @@ -203,7 +203,7 @@ endif endif ifeq ($(TOMCRYPT_BUILD_FLG),Y) - CC="$(CC)" CFLAGS="$(CFLAGS) $(TOM2TOM_CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtomcrypt -f makefile.shared GCC=$(GCC) LTC_LDFLAGS=$(LTC_LDFLAGS) + CC="$(CC)" CFLAGS="$(CFLAGS) $(TOM2TOM_CFLAGS)" $(MAKE) -C $(ROOT)/extern/libtomcrypt -f makefile.shared GCC="$(CC)" LTC_LDFLAGS=$(LTC_LDFLAGS) ifeq ($(PLATFORM),DARWIN) install_name_tool -id "@rpath/lib/libtomcrypt.dylib" $(TOMCRYPT)/.libs/libtomcrypt.1.dylib @@ -216,7 +216,7 @@ endif ifeq ($(STD_EDITLINE),false) ifeq ($(EDITLINE_FLG),Y) - CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline + CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline endif endif @@ -339,7 +339,7 @@ cross2: $(MAKE) tommath $(MAKE) LTCSOURCE=-DLTC_SOURCE tomcrypt $(MAKE) re2 - CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) -C $(ROOT)/extern/decNumber + CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" $(MAKE) -C $(ROOT)/extern/decNumber ln -sf $(ROOT)/extern/decNumber/libdecFloat$(CROSS).a $(LIB) CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(ROOT)/extern/int128/absl/numeric ln -sf $(ROOT)/extern/int128/absl/numeric/libi128$(CROSS).a $(LIB) diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index 03bb389dcd..44290a5451 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -181,9 +181,12 @@ RANLIB= @RANLIB@ BTYACC=$(ROOT)/extern/btyacc/btyacc CLOOP=$(GEN_ROOT)/$(TARGET)/cloop/release/bin/cloop +AR = @AR@ CC = @CC@ CXX = @CXX@ LD = @CXX@ +OBJCOPY = @OBJCOPY@ +READELF = @READELF@ AC_CFLAGS = @CFLAGS@ AC_CXXFLAGS = @CXXFLAGS@ diff --git a/configure.ac b/configure.ac index 839b8459e5..7a20587d89 100644 --- a/configure.ac +++ b/configure.ac @@ -794,6 +794,8 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_CHECK_TOOL([OBJCOPY], [objcopy]) +AC_CHECK_TOOL([READELF], [readelf]) LT_INIT([dlopen win32-dll]) dnl Check for system header files @@ -1283,7 +1285,7 @@ AC_SUBST(SFIO_LDFLAGS) AC_SUBST(SFIO_EXAMPLES) dnl The following file defines the version number strings. Specially for install/uninstall routines -. ./src/misc/writeBuildNum.sh +CXX="$CXX" . ./src/misc/writeBuildNum.sh AC_SUBST(FIREBIRD_VERSION) AC_SUBST(FIREBIRD_PACKAGE_VERSION) diff --git a/extern/cloop/Makefile b/extern/cloop/Makefile index c5a2b52628..2613b88a5a 100644 --- a/extern/cloop/Makefile +++ b/extern/cloop/Makefile @@ -61,10 +61,14 @@ $1/%.o: %.cpp | $1 $(CXX) -c $$(CXX_FLAGS) $$< -o $$@ endef -.PHONY: all mkdirs clean +.PHONY: all core mkdirs clean -all: mkdirs \ - $(BIN_DIR)/cloop \ +all: core tests + +core: mkdirs \ + $(BIN_DIR)/cloop + +tests: mkdirs \ $(BIN_DIR)/test1-c$(SHRLIB_EXT) \ $(BIN_DIR)/test1-c$(EXE_EXT) \ $(BIN_DIR)/test1-cpp$(SHRLIB_EXT) \ diff --git a/extern/editline/src/Makefile.in b/extern/editline/src/Makefile.in index 9c0cbdb11f..84af2b3ec1 100644 --- a/extern/editline/src/Makefile.in +++ b/extern/editline/src/Makefile.in @@ -95,7 +95,7 @@ srcdir = . BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c \ $(append_1) -AHDR = vi.h emacs.h common.h +AHDR = vi.h emacs.h common.h ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c CLEANFILES = $(BUILT_SOURCES) LIBRARY = libedit.a diff --git a/extern/libtommath/makefile.shared b/extern/libtommath/makefile.shared index fdc478c362..8998f2505a 100644 --- a/extern/libtommath/makefile.shared +++ b/extern/libtommath/makefile.shared @@ -94,7 +94,7 @@ bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o objs: $(OBJECTS) $(LIBNAME): $(OBJECTS) - $(LIBTOOL) --mode=link --tag=CC 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)