Revert "postgresql: update to version 16.3"
authorHannu Nyman <[email protected]>
Tue, 9 Jul 2024 10:05:57 +0000 (13:05 +0300)
committerHannu Nyman <[email protected]>
Tue, 9 Jul 2024 10:09:18 +0000 (13:09 +0300)
This reverts commit 6a46887e60d969cf718de3a212aa1847277ed4b3
from PR https://github.com/openwrt/packages/pull/24327

Postgresql version upgrade fails in buildbot for all targets
with error like:

[236/1612] Generating src/fe_utils/psqlscan with a custom command
FAILED: src/fe_utils/psqlscan.c
/builder/shared-workdir/build/sdk/staging_dir/host/bin/python3 ../src/tools/pgflex --builddir . --srcdir .. --privatedir src/fe_utils/psqlscan.c.p --flex /builder/shared-workdir/build/sdk/staging_dir/host/bin/flex --perl /builder/shared-workdir/build/sdk/staging_dir/host/bin/perl -i ../src/fe_utils/psqlscan.l -o src/fe_utils/psqlscan.c --no-backup --fix-warnings -- -Cfe -p -p
flex: fatal internal error, exec of /builder/shared-workdir/build/staging_dir/host/bin/m4 failed
[237/1612] Compiling C object src/interfaces/libpq/libpq.so.5.16.p/pqexpbuffer.c.o
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:264: /builder/shared-workdir/build/sdk/build_dir/target-aarch64_cortex-a53_musl/postgresql-16.3/.built] Error 1

Several dozen packages depend upon postgresql, so the fallout is
rather large. Let's revert the upgrade until a fix is found.

Signed-off-by: Hannu Nyman <[email protected]>
libs/postgresql/Makefile
libs/postgresql/patches/050-build-contrib.patch [new file with mode: 0644]
libs/postgresql/patches/200-ranlib.patch [new file with mode: 0644]
libs/postgresql/patches/300-fix-includes.patch
libs/postgresql/patches/700-no-arm-crc-march-change.patch
libs/postgresql/patches/900-pg_ctl-setuid.patch

index 710623fc43a260894f9c2234938d735fc88af62c..f0cd1b2c75100eca368c208859b2d35e7f0986c8 100644 (file)
@@ -5,7 +5,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=postgresql
-PKG_VERSION:=16.3
+PKG_VERSION:=15.6
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Daniel Golle <[email protected]>
 PKG_LICENSE:=PostgreSQL
@@ -17,20 +17,21 @@ PKG_SOURCE_URL:=\
        http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
        ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
 
-PKG_HASH:=331963d5d3dc4caf4216a049fa40b66d6bcb8c730615859411b9518764e60585
+PKG_HASH:=8455146ed9c69c93a57de954aead0302cafad035c2b242175d6aa1e17ebcb2fb
 
 PKG_BUILD_FLAGS:=no-mips16
-PKG_BUILD_DEPENDS:=perl/host postgresql/host
+PKG_FIXUP:=autoreconf
+PKG_MACRO_PATHS:=config
+PKG_BUILD_DEPENDS:=postgresql/host
 PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/meson.mk
 
 define Package/libpq
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+BUILD_NLS:icu +libpthread
+  DEPENDS:=+libpthread
   TITLE:=PostgreSQL client library
   URL:=http://www.postgresql.org/
   SUBMENU:=Database
@@ -113,12 +114,29 @@ PGSQL_CLI_EXTRA_BIN := \
        vacuumdb        \
        vacuumlo
 
-FAKE_CONFIGURE_ARGS := \
+PGSQL_CONFIG_VARS:= \
+       pgac_cv_snprintf_long_long_int_format="%lld" \
+       pgac_cv_snprintf_size_t_support=yes \
+       USE_DEV_URANDOM=1 \
+       ac_cv_file__dev_urandom="/dev/urandom" \
+       ZIC=zic
+
+ifeq ($(CONFIG_USE_UCLIBC),y)
+# PostgreSQL does not build against uClibc with locales
+# enabled, due to an uClibc bug, see
+# http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
+# so overwrite automatic detection and disable locale support
+PGSQL_CONFIG_VARS+= \
+               pgac_cv_type_locale_t=no
+endif
+
+TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
+
+HOST_CONFIGURE_ARGS += \
                        --disable-nls \
                        --disable-rpath \
                        --without-bonjour \
                        --without-gssapi \
-                       --without-icu \
                        --without-ldap \
                        --without-openssl \
                        --without-pam \
@@ -130,50 +148,24 @@ FAKE_CONFIGURE_ARGS := \
                        --with-zlib="yes" \
                        --enable-depend
 
-HOST_CONFIGURE_ARGS += \
-                       --disable-nls \
+CONFIGURE_ARGS += \
+                       $(DISABLE_NLS) \
                        --disable-rpath \
                        --without-bonjour \
                        --without-gssapi \
-                       --without-icu \
                        --without-ldap \
                        --without-openssl \
                        --without-pam \
                        --without-perl \
                        --without-python \
-                       --without-readline \
                        --without-tcl \
                        --without-systemd \
                        --with-zlib="yes" \
-                       --enable-depend
+                       --enable-depend \
+                       $(if $(CONFIG_arc),--disable-spinlocks)
 
 HOST_CFLAGS += -std=gnu99
 
-MESON_ARGS += \
-               -Dnls=$(if $(CONFIG_BUILD_NLS),en,dis)abled \
-               -Dicu=$(if $(CONFIG_BUILD_NLS),en,dis)abled \
-               -Ddocs=disabled \
-               -Ddocs_pdf=disabled \
-               -Drpath=false \
-               -Dbonjour=disabled \
-               -Dbsd_auth=disabled \
-               -Dgssapi=disabled \
-               -Dldap=disabled \
-               -Dlibxml=disabled \
-               -Dlibxslt=disabled \
-               -Dssl=none \
-               -Dpam=disabled \
-               -Dplperl=disabled \
-               -Dplpython=disabled \
-               -Dpltcl=disabled \
-               -Dsystemd=disabled \
-               -Dzlib=enabled \
-               -Dspinlocks=$(if $(CONFIG_arc),true,false)
-
-define Host/Configure
-       $(call Host/Configure/Default)
-endef
-
 # Need a native zic and pg_config for build
 define Host/Compile
        +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
@@ -189,6 +181,13 @@ define Host/Install
        $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
 endef
 
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
+endef
+
+# because PROFILE means something else in the project Makefile
+unexport PROFILE
+
 define Package/libpq/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
@@ -232,12 +231,6 @@ define Package/pgsql-server/install
        $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
 endef
 
-define Build/Configure
-       $(call Build/Configure/Default,$(FAKE_CONFIGURE_ARGS))
-       make -C $(PKG_BUILD_DIR) maintainer-clean
-       $(call Build/Configure/Meson)
-endef
-
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/bin
        $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
diff --git a/libs/postgresql/patches/050-build-contrib.patch b/libs/postgresql/patches/050-build-contrib.patch
new file mode 100644 (file)
index 0000000..88a23f0
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/GNUmakefile.in
++++ b/GNUmakefile.in
+@@ -8,7 +8,7 @@ subdir =
+ top_builddir = .
+ include $(top_builddir)/src/Makefile.global
+-$(call recurse,all install,src config)
++$(call recurse,all install,src config contrib)
+ docs:
+       $(MAKE) -C doc all
diff --git a/libs/postgresql/patches/200-ranlib.patch b/libs/postgresql/patches/200-ranlib.patch
new file mode 100644 (file)
index 0000000..d4184a3
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/port/Makefile
++++ b/src/port/Makefile
+@@ -83,6 +83,7 @@ uninstall:
+ libpgport.a: $(OBJS)
+       rm -f $@
+       $(AR) $(AROPT) $@ $^
++      $(RANLIB) libpgport.a
+ # getaddrinfo.o and getaddrinfo_shlib.o need PTHREAD_CFLAGS (but getaddrinfo_srv.o does not)
+ getaddrinfo.o: CFLAGS+=$(PTHREAD_CFLAGS)
index 4109f2d7690ed96cde356a940e6289b1b149b4fa..3611c8e00a3dc88605200ee9a5ab75921c4f27a6 100644 (file)
@@ -1,15 +1,13 @@
 --- a/src/bin/pg_ctl/pg_ctl.c
 +++ b/src/bin/pg_ctl/pg_ctl.c
-@@ -12,11 +12,13 @@
+@@ -12,9 +12,11 @@
  #include "postgres_fe.h"
  
  #include <fcntl.h>
 +#include <pwd.h>
  #include <signal.h>
  #include <time.h>
- #include <sys/resource.h>
  #include <sys/stat.h>
- #include <sys/time.h>
 +#include <sys/types.h>
  #include <sys/wait.h>
  #include <unistd.h>
index 18ed97e3fbbd4c37a5fb21ae761f9b99fdf20c54..33637f5d5920da0d61c441b26cbd6fec25452996 100644 (file)
@@ -1,17 +1,15 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -2124,10 +2124,10 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
- # First check if __crc32c* intrinsics can be used with the default compiler
+@@ -2239,9 +2239,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  # flags. If not, check if adding -march=armv8-a+crc flag helps.
- # CFLAGS_CRC is set if the extra flag is required.
--PGAC_ARMV8_CRC32C_INTRINSICS([])
+ # CFLAGS_ARMV8_CRC32C is set if the extra flag is required.
+ PGAC_ARMV8_CRC32C_INTRINSICS([])
 -if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
 -  PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc])
 -fi
-+#PGAC_ARMV8_CRC32C_INTRINSICS([])
 +#if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
 +#  PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc])
 +#fi
+ AC_SUBST(CFLAGS_ARMV8_CRC32C)
  
- AC_SUBST(CFLAGS_CRC)
+ # Select CRC-32C implementation.
index b969d172aa869b1e4785ba90849acd8cd22d3e56..64d558fcc03cf6971a7f2aa4a64a3917acdf7acc 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/bin/pg_ctl/pg_ctl.c
 +++ b/src/bin/pg_ctl/pg_ctl.c
-@@ -91,6 +91,7 @@ static char *event_source = NULL;
+@@ -96,6 +96,7 @@ static char *event_source = NULL;
  static char *register_servicename = "PostgreSQL";     /* FIXME: + version ID? */
  static char *register_username = NULL;
  static char *register_password = NULL;
@@ -8,7 +8,7 @@
  static char *argv0 = NULL;
  static bool allow_core_files = false;
  static time_t start_time;
-@@ -1991,6 +1992,9 @@ do_help(void)
+@@ -2086,6 +2087,9 @@ do_help(void)
  #endif
        printf(_("  -s, --silent           only print errors, no informational messages\n"));
        printf(_("  -t, --timeout=SECS     seconds to wait when using -w option\n"));
@@ -18,7 +18,7 @@
        printf(_("  -V, --version          output version information, then exit\n"));
        printf(_("  -w, --wait             wait until operation completes (default)\n"));
        printf(_("  -W, --no-wait          do not wait until operation completes\n"));
-@@ -2203,6 +2207,7 @@ main(int argc, char **argv)
+@@ -2298,6 +2302,7 @@ main(int argc, char **argv)
                {"options", required_argument, NULL, 'o'},
                {"silent", no_argument, NULL, 's'},
                {"timeout", required_argument, NULL, 't'},
@@ -26,7 +26,7 @@
                {"core-files", no_argument, NULL, 'c'},
                {"wait", no_argument, NULL, 'w'},
                {"no-wait", no_argument, NULL, 'W'},
-@@ -2243,20 +2248,6 @@ main(int argc, char **argv)
+@@ -2338,20 +2343,6 @@ main(int argc, char **argv)
                }
        }
  
@@ -47,7 +47,7 @@
  
        env_wait = getenv("PGCTLTIMEOUT");
        if (env_wait != NULL)
-@@ -2342,11 +2333,15 @@ main(int argc, char **argv)
+@@ -2437,11 +2428,15 @@ main(int argc, char **argv)
                                        wait_seconds_arg = true;
                                        break;
                                case 'U':
@@ -63,7 +63,7 @@
                                        break;
                                case 'w':
                                        do_wait = true;
-@@ -2428,6 +2423,41 @@ main(int argc, char **argv)
+@@ -2523,6 +2518,41 @@ main(int argc, char **argv)
                exit(1);
        }