From 54c3eb4204cb5211ab8c15a98c9012254ba3abc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Thu, 17 Sep 2020 06:49:33 +0200 Subject: [PATCH] firebird3: update to 3.0.6.33328 First steps at making this cross build for libreoffice to become cross buildable as well. Help is welcome. --- srcpkgs/firebird3/files/cross-compile.patch | 127 ++++++++++++++++++ .../patches/cloop-honour-build-flags.patch | 27 ---- srcpkgs/firebird3/patches/fix-std-isnan.patch | 13 ++ srcpkgs/firebird3/template | 50 ++++++- 4 files changed, 183 insertions(+), 34 deletions(-) create mode 100644 srcpkgs/firebird3/files/cross-compile.patch delete mode 100644 srcpkgs/firebird3/patches/cloop-honour-build-flags.patch create mode 100644 srcpkgs/firebird3/patches/fix-std-isnan.patch diff --git a/srcpkgs/firebird3/files/cross-compile.patch b/srcpkgs/firebird3/files/cross-compile.patch new file mode 100644 index 00000000000..15545511b4e --- /dev/null +++ b/srcpkgs/firebird3/files/cross-compile.patch @@ -0,0 +1,127 @@ +--- extern/cloop/Makefile 2020-06-26 12:02:51.000000000 +0200 ++++ extern/cloop/Makefile 2020-09-16 18:36:31.230025798 +0200 +@@ -4,9 +4,9 @@ + + TARGET := release + +-CC := $(CC) +-CXX := $(CXX) +-LD := $(CXX) ++CC := $(CC_host) ++CXX := $(CXX_host) ++LD := $(CXX_host) + + SRC_DIR := src + BUILD_DIR := build +@@ -27,8 +27,9 @@ + OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C)) + OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP)) + +-C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter +-CXX_FLAGS := $(C_FLAGS) ++COMMON_C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter ++C_FLAGS := $(COMMON_C_FLAGS) $(CFLAGS_host) $(CPPFLAGS) ++CXX_FLAGS := $(COMMON_C_FLAGS) $(CXXFLAGS_host) $(CPPFLAGS) + FPC_FLAGS := -Mdelphi + + ifeq ($(TARGET),release) +@@ -81,7 +82,7 @@ + $(OBJ_DIR)/cloop/Parser.o \ + $(OBJ_DIR)/cloop/Main.o \ + +- $(LD) $^ -o $@ ++ $(LD) $(LDFLAGS_host) $^ -o $@ + + $(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl + $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I +@@ -108,23 +109,23 @@ + $(OBJ_DIR)/tests/test1/CalcCApi.o \ + $(OBJ_DIR)/tests/test1/CTest.o \ + +- $(LD) $^ -shared -ldl -o $@ ++ $(LD) $(LDFLAGS_host) $^ -shared -ldl -o $@ + + $(BIN_DIR)/test1-c$(EXE_EXT): \ + $(OBJ_DIR)/tests/test1/CalcCApi.o \ + $(OBJ_DIR)/tests/test1/CTest.o \ + +- $(LD) $^ -ldl -o $@ ++ $(LD) $(LDFLAGS_host) $^ -ldl -o $@ + + $(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \ + $(OBJ_DIR)/tests/test1/CppTest.o \ + +- $(LD) $^ -shared -ldl -o $@ ++ $(LD) $(LDFLAGS_host) $^ -shared -ldl -o $@ + + $(BIN_DIR)/test1-cpp$(EXE_EXT): \ + $(OBJ_DIR)/tests/test1/CppTest.o \ + +- $(LD) $^ -ldl -o $@ ++ $(LD) $(LDFLAGS_host) $^ -ldl -o $@ + + $(BIN_DIR)/test1-pascal$(SHRLIB_EXT): \ + $(SRC_DIR)/tests/test1/PascalClasses.pas \ +--- configure.ac 2020-06-26 12:02:51.000000000 +0200 ++++ configure.ac 2020-09-17 04:29:43.550904331 +0200 +@@ -1021,37 +1021,13 @@ + AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE,1,[Define this if struct dirent has d_type]),, + [#include ]) + +-dnl EKU: try to determine the alignment of long and double +-dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h +-AC_MSG_CHECKING(alignment of long) +-AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +-main () { +- struct s { +- char a; +- union { long long x; sem_t y; } b; +- }; +- exit((int)&((struct s*)0)->b); +-}]])],[ac_cv_c_alignment=$ac_status],[ac_cv_c_alignment=$ac_status],[]) +-AC_MSG_RESULT($ac_cv_c_alignment) + AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_c_alignment, [Alignment of long]) +- +-AC_MSG_CHECKING(alignment of double) +-AC_RUN_IFELSE([AC_LANG_SOURCE([[main () { +- struct s { +- char a; +- double b; +- }; +- exit((int)&((struct s*)0)->b); +-}]])],[ac_cv_c_double_align=$ac_status],[ac_cv_c_double_align=$ac_status],[]) +-AC_MSG_RESULT($ac_cv_c_double_align) + AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_c_double_align, [Alignment of double]) + + dnl EKU: Add any platform specific tests below + case "$PLATFORM" in + LINUX) +- dnl MOD: Check for /proc/self/exe mainly used on linux systems +- dnl this is used to determine path to executable file. +- AC_CHECK_FILES(/proc/self/exe) ++ AC_DEFINE_UNQUOTED(HAVE_PROC_SELF_EXEC, 1, [Void Linux has /proc/self/exe]) + ;; + + FREEBSD|GENTOOFREEBSD) +@@ -1216,10 +1216,6 @@ + ]) + done + +-if test "x$CROSS" != "x"; then +-AC_CONFIG_FILES([gen/make.crossPlatform:builds/posix/make.$CROSS]) +-fi +- + AC_CONFIG_FILES([ + gen/Release/firebird/bin/fb_config:builds/install/posix-common/fb_config.in + gen/Release/firebird/bin/posixLibrary.sh:builds/install/posix-common/posixLibrary.sh.in +--- src/misc/writeBuildNum.sh 2020-06-26 12:02:52.000000000 +0200 ++++ src/misc/writeBuildNum.sh 2020-09-17 04:42:28.645858727 +0200 +@@ -114,7 +114,7 @@ + $CXX $TestCpp -o $AOut + if [ -x $AOut ] + then +- $AOut ++ qemu-${XBPS_TARGET_QEMU_MACHINE}-static $AOut + OdsVersion=$? + else + OdsVersion=0 diff --git a/srcpkgs/firebird3/patches/cloop-honour-build-flags.patch b/srcpkgs/firebird3/patches/cloop-honour-build-flags.patch deleted file mode 100644 index 1f556e0fcb9..00000000000 --- a/srcpkgs/firebird3/patches/cloop-honour-build-flags.patch +++ /dev/null @@ -1,27 +0,0 @@ -Description: make cloop build honor compiler/linker flags from the environment -Author: Damyan Ivanov -Forwarded: no - ---- a/extern/cloop/Makefile -+++ b/extern/cloop/Makefile -@@ -6,7 +6,7 @@ TARGET := release - - CC := gcc - CXX := g++ --LD := $(CXX) -+LD := $(CXX) $(LDFLAGS) - - SRC_DIR := src - BUILD_DIR := build -@@ -27,8 +27,9 @@ SRCS_CPP := $(foreach sdir,$(SRC_DIRS),$ - OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C)) - OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP)) - --C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter --CXX_FLAGS := $(C_FLAGS) -+COMMON_C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter -+C_FLAGS := $(COMMON_C_FLAGS) $(CFLAGS) $(CPPFLAGS) -+CXX_FLAGS := $(COMMON_C_FLAGS) $(CXXFLAGS) $(CPPFLAGS) - FPC_FLAGS := -Mdelphi - - ifeq ($(TARGET),release) diff --git a/srcpkgs/firebird3/patches/fix-std-isnan.patch b/srcpkgs/firebird3/patches/fix-std-isnan.patch new file mode 100644 index 00000000000..9da229bdc86 --- /dev/null +++ b/srcpkgs/firebird3/patches/fix-std-isnan.patch @@ -0,0 +1,13 @@ +--- a/src/common/classes/FpeControl.h 2020-06-26 12:02:51.000000000 +0200 ++++ b/src/common/classes/FpeControl.h 2020-09-17 06:04:30.516565361 +0200 +@@ -42,6 +42,10 @@ + #include + #endif + ++#if !defined(__GLIBC__) ++#define isinf std::isinf ++#endif ++ + namespace Firebird + { + diff --git a/srcpkgs/firebird3/template b/srcpkgs/firebird3/template index 93b6c0b6305..df02ac1379c 100644 --- a/srcpkgs/firebird3/template +++ b/srcpkgs/firebird3/template @@ -1,11 +1,12 @@ # Template file for 'firebird3' pkgname=firebird3 -version=3.0.4.33054 -revision=3 +version=3.0.6.33328 +revision=1 _build=0 _uver=${version//./_} wrksrc="Firebird-${version}-${_build}" build_style=gnu-configure +build_helper="qemu" configure_args="--prefix=/usr --with-fbbin=/usr/bin --with-fbconf=/etc/firebird @@ -25,7 +26,6 @@ configure_args="--prefix=/usr --without-fbsample-db --with-system-icu --with-system-editline" -nocross=yes hostmakedepends="automake libtool pkg-config icu" makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel libtommath-devel zlib-devel" @@ -34,15 +34,50 @@ maintainer="Jürgen Buchmüller " license="custom" homepage="https://www.firebirdsql.org/en/start/" distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" -checksum=b208931d309029d05dbcd8f6c1b4fd9d21be1d60cee2ff29c08b5002db83756b +checksum=34c1d2a29bbaf288e682cd1b5f8083f2baf73f351062245ace0bee35a3f7d35f replaces="firebird>=0" patch_args="-Np1" +nocross="Fails to build gpre_boot for host but builds for target" CFLAGS="-fno-strict-aliasing" -CXXFLAGS="-fno-delete-null-pointer-checks" +CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations" + +if [ "$CROSS_BUILD" ]; then + configure_args+=" --enable-binreloc" + configure_args+=" ac_cv_func_sem_init=no" + configure_args+=" ac_cv_c_alignment=$((${XBPS_TARGET_WORDSIZE}/8))" + configure_args+=" ac_cv_c_double_align=$((${XBPS_TARGET_WORDSIZE}/8))" + configure_args+=" ac_cv_sys_file_offset_bits=64" + CXXFLAGS+=" -D_FILE_OFFSET_BITS=64" +fi pre_configure() { - # musl does not have gcrt1.o needed for -p + local _arch + if [ "$CROSS_BUILD" ]; then + # XXX: This is not yet working right and needs more work. + # The generated gpre_boot is built with the target C++ and can + # not be executed. Trying to run it with qemu--static + # fails because it cannot connect to a localhost port. + # + patch -Np0 -i ${FILESDIR}/cross-compile.patch + case "$XBPS_TARGET_MACHINE" in + aarch64*) _arch="linux_arm64";; + arm*) _arch="linux_arm";; + mipsel*) _arch="linux_mipsel";; + mips*) _arch="linux_mips";; + ppc64le*) _arch="linux_powerpc64le";; + ppc64*) _arch="linux_powerpc64";; + ppc*) _arch="linux_powerpc";; + x86_64*) _arch="linux_amd64";; + esac + configure_args+=" --with-cross-build=$_arch" + # Remove -msse4 for non-x86_64 arch because it leaks + # into the target CXXFLAGS. + if [ "$_arch" != "linux_amd64" ]; then + vsed -i builds/posix/prefix.linux{,_amd64} -e "s;-msse4;;" + fi + fi + if [ "$XBPS_TARGET_LIBC" = musl ]; then vsed -i -e '/FLAGS=/s/ \-p / /g' \ builds/posix/prefix.linux_powerpc* \ @@ -59,7 +94,8 @@ pre_configure() { -e 's;chown -R;#&;' \ -e 's;chmod 0444;chmod 0644;' \ -e 's;chmod 0555;chmod 0755;' \; - autoreconf -if + + NOCONFIGURE=1 ./autogen.sh } do_install() {