diff --git a/srcpkgs/firebird5/INSTALL b/srcpkgs/firebird5/INSTALL new file mode 100644 index 00000000000000..60d6de73c7d285 --- /dev/null +++ b/srcpkgs/firebird5/INSTALL @@ -0,0 +1,39 @@ +_PASSW_SET(){ +local _n1=$(expr "${VERSION}" : '\([^.]*\)') +local _securitydb=/var/lib/${PKGNAME}/system/security${_n1}.fdb +LD_LIBRARY_PATH="/usr/lib/${PKGNAME}/lib:${LD_LIBRARY_PATH}" /usr/lib/${PKGNAME}/bin/isql <> "${_savef}" <]) + +-dnl EKU: try to determine the alignment of long and double +-dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h +-AC_MSG_CHECKING(alignment of long) +-AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +-main () { +- struct s { +- char a; +- union { long long x; sem_t y; } b; +- }; +- exit((int)&((struct s*)0)->b); +-}]])],[ac_cv_c_alignment=$ac_status],[ac_cv_c_alignment=$ac_status],[]) +-AC_MSG_RESULT($ac_cv_c_alignment) + AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_c_alignment, [Alignment of long]) +- +-AC_MSG_CHECKING(alignment of double) +-AC_RUN_IFELSE([AC_LANG_SOURCE([[main () { +- struct s { +- char a; +- double b; +- }; +- exit((int)&((struct s*)0)->b); +-}]])],[ac_cv_c_double_align=$ac_status],[ac_cv_c_double_align=$ac_status],[]) +-AC_MSG_RESULT($ac_cv_c_double_align) + AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_c_double_align, [Alignment of double]) + + dnl EKU: Add any platform specific tests below + case "$PLATFORM" in + LINUX) +- dnl MOD: Check for /proc/self/exe mainly used on linux systems +- dnl this is used to determine path to executable file. +- AC_CHECK_FILES(/proc/self/exe) ++ AC_DEFINE_UNQUOTED(HAVE_PROC_SELF_EXEC, 1, [Void Linux has /proc/self/exe]) + ;; + + FREEBSD|GENTOOFREEBSD) +@@ -1216,10 +1216,6 @@ + ]) + done + +-if test "x$CROSS" != "x"; then +-AC_CONFIG_FILES([gen/make.crossPlatform:builds/posix/make.$CROSS]) +-fi +- + AC_CONFIG_FILES([ + gen/Release/firebird/bin/fb_config:builds/install/posix-common/fb_config.in + gen/Release/firebird/bin/posixLibrary.sh:builds/install/posix-common/posixLibrary.sh.in +--- src/misc/writeBuildNum.sh 2020-06-26 12:02:52.000000000 +0200 ++++ src/misc/writeBuildNum.sh 2020-09-17 04:42:28.645858727 +0200 +@@ -114,7 +114,7 @@ + $CXX $TestCpp -o $AOut + if [ -x $AOut ] + then +- $AOut ++ qemu-${XBPS_TARGET_QEMU_MACHINE}-static $AOut + OdsVersion=$? + else + OdsVersion=0 diff --git a/srcpkgs/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..7db27fcc41b203 --- /dev/null +++ b/srcpkgs/firebird5/template @@ -0,0 +1,202 @@ +# Template file for 'firebird5' +pkgname=firebird5 + +version=5.0.2.1601 +revision=1 + +_commit=f0949361fe0f6095336e42ad34cebb12941ff3c5 +_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 tar 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 (Firebird ${_n1})" +maintainer="Orphaned " +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>Firebird-${version}-${_build}-source.tar.gz" +fi + +checksum=618e7c5e2577cd08cc855a1eda6f59705101825dc27511c41c743d38df6aa975 + +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--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 -o -perm 0600 -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:${_PREFIX}/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