Files
meta-openembedded/meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb
Gyorgy Sarvari 909985d1b9 pgpool2: fix compiling for 32-bit arches
When compiling for 32-bit targets, two issues came to surface:

1. gcc was complaining that math.h is not included in snprintf, and some
   calls were implicitly defined. Added a patch that includes the required
   headers in snprintf.c file:

| snprintf.c: In function 'fmtfloat':
| snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
|  1232 |         if (isnan(value))
|       |             ^~~~~
| snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'

2. The code passes a time_t argument to a function that expects a long. This works for
   64-bit targets, because on those usually time_t is long.
   However on 32-bit systems time_t is usually long long, which makes compilation fail
   with the following error:

| wd_json_data.c:540:66: error: passing argument 3 of 'json_get_long_value_for_key' from incompatible pointer type [-Wincompatible-pointer-types]
|   540 |         if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
|       |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

   To account for this, add a new helper method in a patch that returns the required json value
   as a time_t value.

The patches are in pending state, because the mailing list of the project is sufferring from
technical problems - when the site loads, sign up attempts throw internal server errors.

It is planned to submit the patches and to update the status once their infrastructure is back.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-09-11 17:31:42 -07:00

57 lines
2.2 KiB
BlitzBasic

SUMMARY = "A language independent connection pool server for PostgreSQL."
DESCRIPTION = "Pgpool-II is a middleware that works between PostgreSQL \
servers and a PostgreSQL database client. It is distributed \
under a license similar to BSD and MIT. It provides the \
following features."
HOMEPAGE = "http://pgpool.net"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=e4b38de086d73e0521de0bbdbaa4a1a9"
SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
file://0001-Fix-build-error-when-build-this-file.patch \
file://0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch \
file://0001-fix-compiling-on-32-bit-systems.patch \
file://define_SIGNAL_ARGS.patch \
file://pgpool.sysconfig \
file://pgpool.service \
"
SRC_URI[sha256sum] = "d1392e74ce2807f8ae628872cb1ab7914249921180dc99df40a1d602647a10fd"
S = "${UNPACKDIR}/pgpool-II-${PV}"
inherit autotools-brokensep systemd
SYSTEMD_SERVICE:${PN} = "pgpool.service"
PACKAGECONFIG ??= " openssl libmemcached postgresql \
"
PACKAGECONFIG[pam] = "--with-pam,,libpam"
PACKAGECONFIG[openssl] = "--with-openssl,,openssl"
PACKAGECONFIG[libmemcached] = "--with-memcached=${STAGING_INCDIR}/libmemcachedutil-1.0,,libmemcached"
PACKAGECONFIG[postgresql] = "--with-pgsql-includedir=${STAGING_INCDIR}/postgresql,, postgresql"
EXTRA_OECONF += "--disable-static \
--disable-rpath \
"
FILES:${PN} += "${datadir}/pgpool-II/ "
do_configure:append() {
echo "#define HAVE_STRCHRNUL 1" >> ${S}/src/include/config.h
sed -i "s,#define USE_REPL_SNPRINTF 1,/* #undef USE_REPL_SNPRINTF*/,g" ${S}/src/include/config.h
}
do_install:append() {
install -d ${D}${sysconfdir}/pgpool-II
install -D -m 0644 ${UNPACKDIR}/pgpool.sysconfig ${D}${sysconfdir}/pgpool-II/pgpool.conf
install -D -m 0644 ${S}/src/sample/pcp.conf.sample ${D}${sysconfdir}/pgpool-II/pcp.conf
install -D -m 0644 ${S}/src/sample/pool_hba.conf.sample ${D}${sysconfdir}/pgpool-II/pool_hba.conf
install -Dm 0644 ${UNPACKDIR}/pgpool.service ${D}${systemd_system_unitdir}/pgpool.service
}
# Avoid build failure with gcc-15:
# http://errors.yoctoproject.org/Errors/Details/853019/
CFLAGS += "-std=gnu17"