Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: firebird5-5.0.1.1322~8672410
@ 2024-01-24  3:00 onlylunix
  2024-01-24 11:59 ` [PR PATCH] [Updated] " onlylunix
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: onlylunix @ 2024-01-24  3:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

There is a new pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the packages unified. Also see PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 19662 bytes --]

From c084ea7e36a3ac63c468d53ff21f58c7013be4b8 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 srcpkgs/firebird5/files/fix-perm-fdb          |  46 ++++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 207 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 10 files changed, 482 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100755 srcpkgs/firebird5/files/fix-perm-fdb
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 0000000000000..507291f6a142b
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 0000000000000..15545511b4e6e
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 0000000000000..1c079649d875a
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 0000000000000..fba70a34cc262
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/bin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 0000000000000..cb77ccce54321
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/files/fix-perm-fdb b/srcpkgs/firebird5/files/fix-perm-fdb
new file mode 100755
index 0000000000000..ecee85932a50c
--- /dev/null
+++ b/srcpkgs/firebird5/files/fix-perm-fdb
@@ -0,0 +1,46 @@
+#!/bin/bash
+bn=$(basename $0)
+ECHO(){ echo "$bn: $@"; }
+
+RunUser=_firebird
+RunGroup=_firebird
+config='/etc/firebirdXXX/databases.conf'
+ECHO "$config"
+
+fixperm(){
+if [ -z "$y1" ]; then
+	ECHO "Need to be fixed: $fdb";
+else
+	ECHO "Fix permissions: $fdb"
+	chown $RunUser:$RunGroup -- "$fdb" && chmod 600 -- "$fdb"
+fi
+}
+
+chkperm(){
+fdb=$(realpath -- "$1")
+#ECHO "fdb: $fdb"
+ext=${fdb: -4}
+[ "$ext" = '.fdb' ] || { ECHO "Warning! Skip. File extension must be .fdb: $fdb" && return; } # Simple protection against dangerous links e.t.c.
+[ -f "$fdb" ] || { ECHO "Warning! Skip. Is not a file: $fdb" && return; }
+chpst -u $RunUser:$RunGroup test -r "$fdb" -a -w "$fdb" && ECHO "Writable. Skip: $fdb" || fixperm "$fdb"
+}
+
+[ "$1" = '-y' ] && y1=1
+# A number of predefined macros (syntax $(name)) is available for use in the configuration files 
+# to substitute for a directory name (src: https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html)
+# dir_sampledb='/usr/share/firebirdXXX/examples/empbuild' # employee.fdb
+# dir_secdb='/var/lib/firebirdXXX/system'
+for i in $(grep '^[^#]*=.*\.fdb.*$' "$config" | 
+sed "s|#.*||; s|^\(.*=\s*\)\(.*\)$|\2|; 
+# s|\$(dir_sampledb)|$dir_sampledb|i; 
+")
+do
+	chkperm "$i"
+done
+
+# security.db = /var/lib/firebird*/system/security*.fdb !!! chmod 600 !!!
+chmod 600 -- /var/lib/firebirdXXX/system/security*.fdb
+chown $RunUser:$RunGroup -- /var/lib/firebirdXXX/system/security*.fdb
+
+[ -z "$y1" ] && ECHO 'To confirm, run with -y'
+ECHO 'Done.'
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 0000000000000..7a79cfb302e3d
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 0000000000000..d2b2112bfbfe3
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,207 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1322
+revision=1
+
+_commit=86724101c9356ae61967b6bc0ee973ffe932bb16
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbmisc
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=2af8d921d1648629a38115d93943717c05a212f90746766e73844a3a6cd27159
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fix-perm-fdb 755 ${_PREFIX}/bin
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}${_PREFIX}/bin/fix-perm-fdb -e "s|firebirdXXX|${pkgname}|g"
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg" # add to alternatives?
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config # add to alternatives?
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird # add to alternatives?
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1322~8672410
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
@ 2024-01-24 11:59 ` onlylunix
  2024-01-25 14:18 ` onlylunix
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-01-24 11:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 19663 bytes --]

From 1760232a6d04388400ca79a2a80a6ba98114c052 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 srcpkgs/firebird5/files/fix-perm-fdb          |  46 ++++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 207 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 10 files changed, 482 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100755 srcpkgs/firebird5/files/fix-perm-fdb
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 0000000000000..507291f6a142b
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 0000000000000..15545511b4e6e
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 0000000000000..1c079649d875a
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 0000000000000..805a123200e46
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 0000000000000..cb77ccce54321
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/files/fix-perm-fdb b/srcpkgs/firebird5/files/fix-perm-fdb
new file mode 100755
index 0000000000000..ecee85932a50c
--- /dev/null
+++ b/srcpkgs/firebird5/files/fix-perm-fdb
@@ -0,0 +1,46 @@
+#!/bin/bash
+bn=$(basename $0)
+ECHO(){ echo "$bn: $@"; }
+
+RunUser=_firebird
+RunGroup=_firebird
+config='/etc/firebirdXXX/databases.conf'
+ECHO "$config"
+
+fixperm(){
+if [ -z "$y1" ]; then
+	ECHO "Need to be fixed: $fdb";
+else
+	ECHO "Fix permissions: $fdb"
+	chown $RunUser:$RunGroup -- "$fdb" && chmod 600 -- "$fdb"
+fi
+}
+
+chkperm(){
+fdb=$(realpath -- "$1")
+#ECHO "fdb: $fdb"
+ext=${fdb: -4}
+[ "$ext" = '.fdb' ] || { ECHO "Warning! Skip. File extension must be .fdb: $fdb" && return; } # Simple protection against dangerous links e.t.c.
+[ -f "$fdb" ] || { ECHO "Warning! Skip. Is not a file: $fdb" && return; }
+chpst -u $RunUser:$RunGroup test -r "$fdb" -a -w "$fdb" && ECHO "Writable. Skip: $fdb" || fixperm "$fdb"
+}
+
+[ "$1" = '-y' ] && y1=1
+# A number of predefined macros (syntax $(name)) is available for use in the configuration files 
+# to substitute for a directory name (src: https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html)
+# dir_sampledb='/usr/share/firebirdXXX/examples/empbuild' # employee.fdb
+# dir_secdb='/var/lib/firebirdXXX/system'
+for i in $(grep '^[^#]*=.*\.fdb.*$' "$config" | 
+sed "s|#.*||; s|^\(.*=\s*\)\(.*\)$|\2|; 
+# s|\$(dir_sampledb)|$dir_sampledb|i; 
+")
+do
+	chkperm "$i"
+done
+
+# security.db = /var/lib/firebird*/system/security*.fdb !!! chmod 600 !!!
+chmod 600 -- /var/lib/firebirdXXX/system/security*.fdb
+chown $RunUser:$RunGroup -- /var/lib/firebirdXXX/system/security*.fdb
+
+[ -z "$y1" ] && ECHO 'To confirm, run with -y'
+ECHO 'Done.'
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 0000000000000..7a79cfb302e3d
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 0000000000000..d2b2112bfbfe3
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,207 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1322
+revision=1
+
+_commit=86724101c9356ae61967b6bc0ee973ffe932bb16
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbmisc
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=2af8d921d1648629a38115d93943717c05a212f90746766e73844a3a6cd27159
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fix-perm-fdb 755 ${_PREFIX}/bin
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}${_PREFIX}/bin/fix-perm-fdb -e "s|firebirdXXX|${pkgname}|g"
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg" # add to alternatives?
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config # add to alternatives?
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird # add to alternatives?
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1322~8672410
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
  2024-01-24 11:59 ` [PR PATCH] [Updated] " onlylunix
@ 2024-01-25 14:18 ` onlylunix
  2024-01-25 14:18 ` onlylunix
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-01-25 14:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 19608 bytes --]

From 3125304bb0cffed1da132cd1c9934b247d4fe314 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 srcpkgs/firebird5/files/fix-perm-fdb          |  46 ++++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 206 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 10 files changed, 481 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100755 srcpkgs/firebird5/files/fix-perm-fdb
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 0000000000000..507291f6a142b
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 0000000000000..15545511b4e6e
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 0000000000000..1c079649d875a
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 0000000000000..805a123200e46
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 0000000000000..cb77ccce54321
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/files/fix-perm-fdb b/srcpkgs/firebird5/files/fix-perm-fdb
new file mode 100755
index 0000000000000..ecee85932a50c
--- /dev/null
+++ b/srcpkgs/firebird5/files/fix-perm-fdb
@@ -0,0 +1,46 @@
+#!/bin/bash
+bn=$(basename $0)
+ECHO(){ echo "$bn: $@"; }
+
+RunUser=_firebird
+RunGroup=_firebird
+config='/etc/firebirdXXX/databases.conf'
+ECHO "$config"
+
+fixperm(){
+if [ -z "$y1" ]; then
+	ECHO "Need to be fixed: $fdb";
+else
+	ECHO "Fix permissions: $fdb"
+	chown $RunUser:$RunGroup -- "$fdb" && chmod 600 -- "$fdb"
+fi
+}
+
+chkperm(){
+fdb=$(realpath -- "$1")
+#ECHO "fdb: $fdb"
+ext=${fdb: -4}
+[ "$ext" = '.fdb' ] || { ECHO "Warning! Skip. File extension must be .fdb: $fdb" && return; } # Simple protection against dangerous links e.t.c.
+[ -f "$fdb" ] || { ECHO "Warning! Skip. Is not a file: $fdb" && return; }
+chpst -u $RunUser:$RunGroup test -r "$fdb" -a -w "$fdb" && ECHO "Writable. Skip: $fdb" || fixperm "$fdb"
+}
+
+[ "$1" = '-y' ] && y1=1
+# A number of predefined macros (syntax $(name)) is available for use in the configuration files 
+# to substitute for a directory name (src: https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html)
+# dir_sampledb='/usr/share/firebirdXXX/examples/empbuild' # employee.fdb
+# dir_secdb='/var/lib/firebirdXXX/system'
+for i in $(grep '^[^#]*=.*\.fdb.*$' "$config" | 
+sed "s|#.*||; s|^\(.*=\s*\)\(.*\)$|\2|; 
+# s|\$(dir_sampledb)|$dir_sampledb|i; 
+")
+do
+	chkperm "$i"
+done
+
+# security.db = /var/lib/firebird*/system/security*.fdb !!! chmod 600 !!!
+chmod 600 -- /var/lib/firebirdXXX/system/security*.fdb
+chown $RunUser:$RunGroup -- /var/lib/firebirdXXX/system/security*.fdb
+
+[ -z "$y1" ] && ECHO 'To confirm, run with -y'
+ECHO 'Done.'
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 0000000000000..7a79cfb302e3d
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 0000000000000..184ebbcae8022
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,206 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1322
+revision=1
+
+_commit=86724101c9356ae61967b6bc0ee973ffe932bb16
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbmisc
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=2af8d921d1648629a38115d93943717c05a212f90746766e73844a3a6cd27159
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}${_PREFIX}/bin/fix-perm-fdb -e "s|firebirdXXX|${pkgname}|g"
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg" # add to alternatives?
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config # add to alternatives?
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird # add to alternatives?
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1322~8672410
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
  2024-01-24 11:59 ` [PR PATCH] [Updated] " onlylunix
  2024-01-25 14:18 ` onlylunix
@ 2024-01-25 14:18 ` onlylunix
  2024-01-25 14:31 ` onlylunix
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-01-25 14:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17735 bytes --]

From 996c788e8fc1c2817f53262964626bd6caf42048 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 206 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 435 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 0000000000000..507291f6a142b
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 0000000000000..15545511b4e6e
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 0000000000000..1c079649d875a
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 0000000000000..805a123200e46
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 0000000000000..cb77ccce54321
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 0000000000000..7a79cfb302e3d
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 0000000000000..184ebbcae8022
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,206 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1322
+revision=1
+
+_commit=86724101c9356ae61967b6bc0ee973ffe932bb16
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbmisc
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=2af8d921d1648629a38115d93943717c05a212f90746766e73844a3a6cd27159
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}${_PREFIX}/bin/fix-perm-fdb -e "s|firebirdXXX|${pkgname}|g"
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg" # add to alternatives?
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config # add to alternatives?
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird # add to alternatives?
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1322~8672410
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (2 preceding siblings ...)
  2024-01-25 14:18 ` onlylunix
@ 2024-01-25 14:31 ` onlylunix
  2024-02-22  2:03 ` onlylunix
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-01-25 14:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17655 bytes --]

From 3feb06a8bfcf93ec92e18011f23e1b87c80ebb0a Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 205 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 434 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 0000000000000..507291f6a142b
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 0000000000000..15545511b4e6e
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 0000000000000..1c079649d875a
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 0000000000000..805a123200e46
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 0000000000000..cb77ccce54321
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 0000000000000..7a79cfb302e3d
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 0000000000000..8d999abdfbf58
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,205 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1322
+revision=1
+
+_commit=86724101c9356ae61967b6bc0ee973ffe932bb16
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbmisc
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=2af8d921d1648629a38115d93943717c05a212f90746766e73844a3a6cd27159
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg" # add to alternatives?
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config # add to alternatives?
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird # add to alternatives?
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 0000000000000..539464d4cfe59
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1322~8672410
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (3 preceding siblings ...)
  2024-01-25 14:31 ` onlylunix
@ 2024-02-22  2:03 ` onlylunix
  2024-03-11 22:59 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1344~9a3b71b onlylunix
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-02-22  2:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1322~8672410
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17617 bytes --]

From f6bb5b84bd3bd41a7423f1ba230c23e3ee6f80f5 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 205 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 434 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..d698f46c380608
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,205 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1344
+revision=1
+
+_commit=9a3b71b5471cf88d55997c4c7e69ab9533cad61f
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=3c9e9c3b85b6ca4a19d8b7fd4a34fe28f85c58de7e9b336c2f82b61e4474be20
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="
+ /etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1344~9a3b71b
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (4 preceding siblings ...)
  2024-02-22  2:03 ` onlylunix
@ 2024-03-11 22:59 ` onlylunix
  2024-03-14  2:10 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1353~728f8ee onlylunix
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-03-11 22:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1344~9a3b71b
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17614 bytes --]

From 3b1ea98c849eb803deeff46ec4161bd733173ccb Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..82f73f50203993
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1353
+revision=1
+
+_commit=728f8ee29e356daa544639f4ceecd89d516cc681
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=a1575dce89ef77288a6ee5308043608e9702a4d206fcda5d37fdb037493dc005
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5-5.0.1.1353~728f8ee
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (5 preceding siblings ...)
  2024-03-11 22:59 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1344~9a3b71b onlylunix
@ 2024-03-14  2:10 ` onlylunix
  2024-03-14  9:12 ` [PR PATCH] [Updated] New package: firebird5 onlylunix
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-03-14  2:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5-5.0.1.1353~728f8ee
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17614 bytes --]

From 9b8fb5f9b2a65bdb41fb9b345ee265f62bae1093 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5-5.0.1.1322~8672410

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..5fe4032baf3050
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1360
+revision=1
+
+_commit=7b875696c3ed435006d0cfef6341a738990ad33b
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=db4973f288814fd52db946b91b2f58be1948ffb9ae74c4fe231c8f03609133a7
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (6 preceding siblings ...)
  2024-03-14  2:10 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1353~728f8ee onlylunix
@ 2024-03-14  9:12 ` onlylunix
  2024-03-14 23:45 ` onlylunix
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-03-14  9:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17595 bytes --]

From 020ff0302c7c2c0ba8921a5d449fee0eaaffafe1 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..5fe4032baf3050
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1360
+revision=1
+
+_commit=7b875696c3ed435006d0cfef6341a738990ad33b
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=db4973f288814fd52db946b91b2f58be1948ffb9ae74c4fe231c8f03609133a7
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (7 preceding siblings ...)
  2024-03-14  9:12 ` [PR PATCH] [Updated] New package: firebird5 onlylunix
@ 2024-03-14 23:45 ` onlylunix
  2024-03-30  1:34 ` onlylunix
  2024-04-05  2:54 ` onlylunix
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-03-14 23:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17595 bytes --]

From 1beaf3cf8dfc83ffdbd9ec4bf13b3ba3b3840198 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..fa81cee85e85d8
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1363
+revision=1
+
+_commit=24b2547d3ca1ad194f18b152c4629965fe6615cc
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=37c3e6eca777f25dfcd35cb4276ff960354d71c9fb068c4b01590512725f6b0b
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (8 preceding siblings ...)
  2024-03-14 23:45 ` onlylunix
@ 2024-03-30  1:34 ` onlylunix
  2024-04-05  2:54 ` onlylunix
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-03-30  1:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17595 bytes --]

From 39fe371f1527cf73fac059045a1b28c997654fd6 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..ef83a84be811e6
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1372
+revision=1
+
+_commit=f1bbc2d76750156d599d6007157e760b6fe11d51
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${version}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=7dadd5c2649339cb8be99caef102ecd9d9b165eabe1a9763f6b0392aec95fc60
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: firebird5
  2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
                   ` (9 preceding siblings ...)
  2024-03-30  1:34 ` onlylunix
@ 2024-04-05  2:54 ` onlylunix
  10 siblings, 0 replies; 12+ messages in thread
From: onlylunix @ 2024-04-05  2:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

There is an updated pull request by onlylunix against master on the void-packages repository

https://github.com/onlylunix/void-packages firebird5
https://github.com/void-linux/void-packages/pull/48350

New package: firebird5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: YES

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC, i686-LIBC, x86_64-musl)

New features:
You can now install and run several different versions of Firebird at the same time, including client and development libraries, since the databases require the corresponding server versions.

Made the template unified. Also see Firebird3 PR https://github.com/void-linux/void-packages/pull/46672

A patch file from https://github.com/void-linux/void-packages/pull/48350.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-firebird5-48350.patch --]
[-- Type: text/x-diff, Size: 17591 bytes --]

From 878636b838ca48ece7a082a1241b952e74329638 Mon Sep 17 00:00:00 2001
From: onlylunix <userpc2021@yandex.ru>
Date: Wed, 24 Jan 2024 05:54:20 +0300
Subject: [PATCH] New package: firebird5

---
 srcpkgs/firebird5/INSTALL                     |  14 ++
 srcpkgs/firebird5/files/cross-compile.patch   | 127 +++++++++++
 srcpkgs/firebird5/files/fb-exe                |  26 +++
 srcpkgs/firebird5/files/firebird.xinetd       |  16 ++
 srcpkgs/firebird5/files/firebird5/run         |  31 +++
 .../patches/fix-databases-conf.patch          |  13 ++
 srcpkgs/firebird5/template                    | 204 ++++++++++++++++++
 srcpkgs/libfbclient5                          |   1 +
 srcpkgs/libfbclient5-devel                    |   1 +
 9 files changed, 433 insertions(+)
 create mode 100644 srcpkgs/firebird5/INSTALL
 create mode 100644 srcpkgs/firebird5/files/cross-compile.patch
 create mode 100755 srcpkgs/firebird5/files/fb-exe
 create mode 100644 srcpkgs/firebird5/files/firebird.xinetd
 create mode 100755 srcpkgs/firebird5/files/firebird5/run
 create mode 100644 srcpkgs/firebird5/patches/fix-databases-conf.patch
 create mode 100644 srcpkgs/firebird5/template
 create mode 120000 srcpkgs/libfbclient5
 create mode 120000 srcpkgs/libfbclient5-devel

diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL
new file mode 100644
index 00000000000000..507291f6a142b8
--- /dev/null
+++ b/srcpkgs/firebird5/INSTALL
@@ -0,0 +1,14 @@
+case "${ACTION}" in
+post)
+	if [ "$UPDATE" = "no" ]
+	then
+		# $2 = PKGNAME
+		chmod 600 -- /var/lib/$2/system/security*.fdb
+		echo "$2: POST INSTALL: ATTENTION! TRY ADD USER sysdba WITH PASSWORD masterkey ..."
+		{ LD_LIBRARY_PATH="/usr/lib/$2/lib:$LD_LIBRARY_PATH" /usr/lib/$2/bin/gsec -add sysdba -pw masterkey && echo "... SUCCESSFULL."; } || echo "... FAIL."
+		chown _firebird:_firebird -- /var/lib/$2/system/security*.fdb
+		chown _firebird:_firebird /tmp/firebird
+		find /tmp/firebird -type f -name 'fb_*' -user 0 -exec chown _firebird:_firebird -- {} \;
+	fi
+	;;
+esac
diff --git a/srcpkgs/firebird5/files/cross-compile.patch b/srcpkgs/firebird5/files/cross-compile.patch
new file mode 100644
index 00000000000000..15545511b4e6e6
--- /dev/null
+++ b/srcpkgs/firebird5/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 <dirent.h>])
+ 
+-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 <semaphore.h>
+-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/firebird5/files/fb-exe b/srcpkgs/firebird5/files/fb-exe
new file mode 100755
index 00000000000000..1c079649d875a9
--- /dev/null
+++ b/srcpkgs/firebird5/files/fb-exe
@@ -0,0 +1,26 @@
+#!/bin/sh
+[ -z "$_FBEXE_" ] || exit 231
+export _FBEXE_=1
+
+bn=$(basename -- "$0")
+EXE=${bn#*-} # prefix-name -> name
+FBDIRBIN=$(dirname -- "$(realpath -- "$0")")
+FBROOT=$(dirname -- "$FBDIRBIN")
+FBDIRLIB="$FBROOT/lib"
+
+show(){
+echo "bn=$bn"
+echo "EXE=$EXE"
+echo "FBDIRBIN=$FBDIRBIN"
+echo "FBROOT=$FBROOT"
+echo "FBDIRLIB=$FBDIRLIB"
+exit 2
+}
+
+#show
+
+export LD_LIBRARY_PATH="$FBDIRLIB:$LD_LIBRARY_PATH"
+export FIREBIRD_MSG="$FBROOT/lib/msg"
+export PATH="$FBDIRBIN:$PATH"
+#exec "$FBDIRBIN/$EXE" "$@"
+exec "$EXE" "$@"
diff --git a/srcpkgs/firebird5/files/firebird.xinetd b/srcpkgs/firebird5/files/firebird.xinetd
new file mode 100644
index 00000000000000..805a123200e46a
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird.xinetd
@@ -0,0 +1,16 @@
+# default: off
+# description: firebirdXXX
+service gds-dbXXX
+{
+	disable         	= yes
+	flags			= REUSE NODELAY
+	socket_type		= stream
+	wait			= no
+	user			= _firebird
+# These lines cause problems with Windows XP SP2 clients
+# using default firewall configuration (SF#1065511)
+#	log_on_success		+= USERID
+#	log_on_failure 		+= USERID
+# Requires ServerMode = Classic in /etc/firebirdXXX/firebird.conf
+	server			= /usr/lib/firebirdXXX/sbin/firebird
+}
diff --git a/srcpkgs/firebird5/files/firebird5/run b/srcpkgs/firebird5/files/firebird5/run
new file mode 100755
index 00000000000000..cb77ccce543217
--- /dev/null
+++ b/srcpkgs/firebird5/files/firebird5/run
@@ -0,0 +1,31 @@
+#!/bin/sh
+FBUSER=_firebird
+FBGROUP=_firebird
+FBNAME=$(basename -- "$PWD")
+FBROOT="/usr/lib/$FBNAME"
+FBLOGDIR="/var/log/$FBNAME" # chmod 750
+FBLOGFILE="${FBLOGDIR}/firebird.log"
+
+CHK(){ chpst -u $FBUSER:$FBGROUP test $@; }
+BKP(){ mv -T --backup=numbered -- "$1" "$1".bkp; }
+
+D='/tmp/firebird' # 700 ?
+[ -e "$D" ] && { CHK -d "$D" -a -O "$D" || { BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; } }
+
+F="$FBLOGFILE"
+if ! CHK -f "$F" -a -w "$F"
+then
+	if [ -e "$F" ]
+	then
+		BKP "$F"
+	else
+		D="$FBLOGDIR"
+		CHK -d "$D" -a -w "$D" || { [ -e "$D" ] && BKP "$D"; install -m 750 -o $FBUSER -g $FBGROUP -d "$D"; }
+	fi
+fi
+
+F="/etc/${FBNAME}/fb_guard"
+CHK -f "$F" -a -O "$F" || install --backup -m 640 -o $FBUSER -g $FBGROUP /dev/null "$F"
+
+export LD_LIBRARY_PATH="${FBROOT}/lib:$LD_LIBRARY_PATH"
+exec chpst -u $FBUSER:$FBGROUP /usr/lib/${FBNAME}/sbin/fbguard -forever
diff --git a/srcpkgs/firebird5/patches/fix-databases-conf.patch b/srcpkgs/firebird5/patches/fix-databases-conf.patch
new file mode 100644
index 00000000000000..7a79cfb302e3d7
--- /dev/null
+++ b/srcpkgs/firebird5/patches/fix-databases-conf.patch
@@ -0,0 +1,13 @@
+--- a/builds/install/misc/databases.conf	2024-01-11 04:17:47.000000000 +0300
++++ b/builds/install/misc/databases.conf	2024-01-14 05:39:44.684927372 +0300
+@@ -17,8 +17,8 @@
+ #
+ # Example Database:
+ #
+-employee.fdb = $(dir_sampleDb)/employee.fdb
+-employee = $(dir_sampleDb)/employee.fdb
++#employee.fdb = $(dir_sampleDb)/employee.fdb
++#employee = $(dir_sampleDb)/employee.fdb
+ 
+ #
+ # Master security database specific setup.
diff --git a/srcpkgs/firebird5/template b/srcpkgs/firebird5/template
new file mode 100644
index 00000000000000..4032069d305606
--- /dev/null
+++ b/srcpkgs/firebird5/template
@@ -0,0 +1,204 @@
+# Template file for 'firebird5'
+pkgname=firebird5
+
+version=5.0.1.1378
+revision=1
+
+_commit=a4c3536df584e43577dafa74ad9038b589284cb2
+
+[ -z "$_commit" ] || version=$version~${_commit:0:7}
+
+_build=0
+#_uver=${version//./_}
+
+#_n1=${version%%.*}
+_n1=$(expr "$version" : '\([^.]*\)')
+#n2=$(expr "$version" : '\([^.]*.[^.]*\)')
+_n3=$(expr "$version" : '\([^.]*.[^.]*.[^.]*\)')
+_fbN=fb${_n1}
+
+build_style=gnu-configure
+build_helper="qemu"
+
+_PREFIX=/usr/lib/${pkgname}
+_INCLUDE=/usr/include/${pkgname}
+configure_args="--prefix=${_PREFIX}
+ --with-fbconf=/etc/${pkgname}
+ --with-fbbin=${_PREFIX}/bin
+ --with-fbsbin=${_PREFIX}/sbin
+ --with-fblib=${_PREFIX}/lib
+ --with-fbmsg=${_PREFIX}/lib/msg
+ --with-fbintl=${_PREFIX}/lib/intl
+ --with-fbplugins=${_PREFIX}/lib/plugins
+ --with-fbmisc=${_PREFIX}/misc
+ --with-fbsecure-db=/var/lib/${pkgname}/system
+ --with-fblog=/var/log/${pkgname}
+ --with-fbdoc=/usr/share/doc/${pkgname}
+ --with-fbsample=/usr/share/${pkgname}/examples
+ --with-fbinclude=${_INCLUDE}
+ --without-fbsample-db
+ --without-fbtzdata
+ --with-system-editline"
+
+# --with-fbsample-db=/usr/share/${pkgname}/examples/empbuild
+# --with-service-name 	specify inet service name (default=gds_db)
+# --with-service-port 	specify inet service port (default=3050)
+# --with-ipc-name 	specify local IPC name (default=FirebirdIPI)
+
+hostmakedepends="automake libtool pkg-config icu rsync cmake unzip"
+makedepends="boost-devel libedit-devel icu-devel ncurses-devel libatomic_ops-devel
+ libtommath-devel zlib-devel libtomcrypt-devel"
+
+short_desc="Relational database offering many ANSI SQL standard features (V${_n1})"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="custom:IDPL-1.0, Interbase-1.0"
+homepage="https://www.firebirdsql.org"
+
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/R${_uver%_*}/Firebird-${version}-${_build}.tar.bz2" # old
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.bz2" # V3
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}.tar.xz" # V4
+# distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+# distfiles="https://github.com/FirebirdSQL/firebird/archive/refs/tags/v${_n3}.tar.gz" # tags
+
+if [ -z "$_commit" ]; then
+	distfiles="https://github.com/FirebirdSQL/firebird/releases/download/v${_n3}/Firebird-${version}-${_build}-source.tar.xz" # V5
+else
+	distfiles="https://github.com/FirebirdSQL/firebird/archive/${_commit}.tar.gz"
+fi
+
+checksum=691441c1a30752f808313898dfac6de001869078ccb362d1d90396dec829387f
+
+nocross="Fails to build gpre_boot for host but builds for target"
+
+CFLAGS="-fno-strict-aliasing"
+CXXFLAGS="-fno-delete-null-pointer-checks -Wno-deprecated -Wno-deprecated-declarations"
+
+# Create firebird system user/group
+system_accounts="_firebird _firebird"
+_firebird_homedir="/var/lib/firebird"
+_firebird_descr="Firebird Database Owner"
+triggers="system-accounts"
+
+conf_files="/etc/${pkgname}/databases.conf
+ /etc/${pkgname}/fbtrace.conf
+ /etc/${pkgname}/firebird.conf
+ /etc/${pkgname}/plugins.conf
+ /var/lib/${pkgname}/system/security${_n1}.fdb"
+
+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() {
+	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-<target>-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* \
+			builds/posix/prefix.linux_arm* \
+			builds/posix/prefix.linux_mips*
+	fi
+
+	# Avoid errors telling we are not 'root' and
+	# do not change ownership to root:root and
+	# do not change permissions to read-only
+	find -iname "*.sh.in" -exec sed -i "{}" \
+		-e 's;"\x60whoami\x60";"root";' \
+		-e 's;chown root:root;echo skip: &;' \
+		-e 's;chown -R;echo skip: &;' \
+		-e 's;chmod 0444;chmod 0644;' \
+		-e 's;chmod 0555;chmod 0755;' \;
+
+	NOCONFIGURE=1 ./autogen.sh
+}
+
+do_install() {
+	cd ${wrksrc}/gen
+	./install/makeInstallImage.sh
+	cd ${wrksrc}
+
+	# Fix permissions
+	find gen/buildroot -type f -perm 0444 -exec chmod 0644 "{}" \;
+	find gen/buildroot -type f -perm 0555 -exec chmod 0755 "{}" \;
+
+	vlicense doc/license/IDPL.txt IDPL
+	vlicense doc/license/README.license.usage.txt LICENSE
+
+	rsync -a --exclude={'*.sh',"${_PREFIX}/no","${_PREFIX}/yes","usr/share/${pkgname}/examples/prebuilt"} gen/buildroot/ ${DESTDIR}/ # Exclude unused files and dirs
+
+	vinstall ${FILESDIR}/fb-exe 755 ${_PREFIX}/bin
+
+	# Fix conflicts with isql from unixodbc and other versions Firebird
+	mkdir -p ${DESTDIR}/usr/bin
+	find ${DESTDIR}${_PREFIX}/bin -type f ! -name fb-exe -printf '%f\n' | xargs -I {} -n1 ln -sf ${_PREFIX}/bin/fb-exe ${DESTDIR}/usr/bin/${_fbN}-{}
+
+	vinstall ${FILESDIR}/firebird.xinetd 644 etc/xinetd.d ${pkgname} # xinetd, requires ServerMode = Classic
+	vsv ${pkgname} # runit service, default ServerMode = Super, see: /etc/${pkgname}/firebird.conf
+
+	# REPLASE: firebirdXXX, gds-dbXXX
+	vsed -i ${DESTDIR}/etc/xinetd.d/${pkgname} -e "s|firebirdXXX|${pkgname}|g; s|gds-dbXXX|firebird${_n1}|g"
+
+	# Example https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firebird-superserver
+}
+
+libfbclient5_package() {
+	short_desc+=" - client libraries"
+	alternatives="libfbclient:/usr/lib/libfbclient.so.2:${_PREFIX}/lib/libfbclient.so.2"
+	pkg_install() {
+		vmove "${_PREFIX}/lib/libfbclient.so*"
+		vmove "${_PREFIX}/lib/msg/firebird.msg"
+
+		vlicense doc/license/IDPL.txt IDPL
+		vlicense doc/license/README.license.usage.txt LICENSE
+	}
+}
+
+libfbclient5-devel_package() {
+	short_desc+=" - development files"
+
+	alternatives="libfbclient-devel:/usr/include/ibase.h:${_INCLUDE}/ibase.h
+			libfbclient-devel:/usr/include/iberror.h:${_INCLUDE}/iberror.h
+			libfbclient-devel:/usr/include/ib_util.h:${_INCLUDE}/ib_util.h
+			libfbclient-devel:/usr/lib/libfbclient.so:/usr/lib/libfbclient.so.2"
+
+	depends="libfbclient5>=${version}_${revision}"
+	pkg_install() {
+		vmove ${_PREFIX}/sbin/fb_config
+		vmove usr/include
+
+		# Delete unused link
+		rm ${PKGDESTDIR}/usr/include/firebird
+
+		# Fix conflict, use alternatives
+		rm ${PKGDESTDIR}/usr/include/*.h
+	}
+}
diff --git a/srcpkgs/libfbclient5 b/srcpkgs/libfbclient5
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file
diff --git a/srcpkgs/libfbclient5-devel b/srcpkgs/libfbclient5-devel
new file mode 120000
index 00000000000000..539464d4cfe59b
--- /dev/null
+++ b/srcpkgs/libfbclient5-devel
@@ -0,0 +1 @@
+firebird5
\ No newline at end of file

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-04-05  2:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24  3:00 [PR PATCH] New package: firebird5-5.0.1.1322~8672410 onlylunix
2024-01-24 11:59 ` [PR PATCH] [Updated] " onlylunix
2024-01-25 14:18 ` onlylunix
2024-01-25 14:18 ` onlylunix
2024-01-25 14:31 ` onlylunix
2024-02-22  2:03 ` onlylunix
2024-03-11 22:59 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1344~9a3b71b onlylunix
2024-03-14  2:10 ` [PR PATCH] [Updated] New package: firebird5-5.0.1.1353~728f8ee onlylunix
2024-03-14  9:12 ` [PR PATCH] [Updated] New package: firebird5 onlylunix
2024-03-14 23:45 ` onlylunix
2024-03-30  1:34 ` onlylunix
2024-04-05  2:54 ` onlylunix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).