aports/main/postgresql17/per-version-dirs.patch
Andy Postnikov d69ead2c87 main/postgresql17: new aport
It cannot be built against older libpq, so we have to build it as the
default version right away.

    ld: ../../../src/fe_utils/libpgfeutils.a(connect_utils.o): in function `disconnectDatabase':
      connect_utils.c:(.text+0x35d): undefined reference to `PQcancelCreate'
    ld: connect_utils.c:(.text+0x369): undefined reference to `PQcancelBlocking'
    ld: connect_utils.c:(.text+0x372): undefined reference to `PQcancelFinish'

Co-Authored-By: Jakub Jirutka <jakub@jirutka.cz>
2024-11-01 12:59:50 +01:00

84 lines
2.9 KiB
Diff

Author: Martin Pitt <mpitt@debian.org>
Description: Use version specific installation directories so that several major versions can be installed in parallel.
* Install server lib files into /usr/lib/postgresql<version>/
* Install server related header files into /usr/include/postgresql/<version>/server/
* Disable PostgreSQL's automagic path mangling and fix libdir for pg_config,
so that pg_config in /usr/bin and /usr/libexec/postgresql<version> behave
identically.
Bug-Debian: http://bugs.debian.org/462037
Patch-Source: https://sources.debian.org/src/postgresql-14/14.0-1/debian/patches/50-per-version-dirs.patch
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -119,7 +119,7 @@ libdir := @libdir@
pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
+override pkglibdir := /usr/lib/postgresql@PG_MAJORVERSION@
endif
endif
@@ -167,7 +167,7 @@ endif # PGXS
# These derived path variables aren't separately configurable.
-includedir_server = $(pkgincludedir)/server
+includedir_server = $(pkgincludedir)/@PG_MAJORVERSION@/server
includedir_internal = $(pkgincludedir)/internal
pgxsdir = $(pkglibdir)/pgxs
bitcodedir = $(pkglibdir)/bitcode
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -27,6 +27,8 @@
#include "common/config_info.h"
#include "port.h"
+#include "../port/pg_config_paths.h"
+
static const char *progname;
/*
@@ -149,11 +151,7 @@ main(int argc, char **argv)
}
}
- if (find_my_exec(argv[0], my_exec_path) < 0)
- {
- fprintf(stderr, _("%s: could not find own program executable\n"), progname);
- exit(1);
- }
+ snprintf(my_exec_path, sizeof(my_exec_path), "%s/%s", PGBINDIR, progname);
configdata = get_configdata(my_exec_path, &configdata_len);
/* no arguments -> print everything */
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -726,6 +726,14 @@
or die "could not execute pg_config";
chomp($stdout);
$stdout =~ s/\r$//;
+ # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
+ if (-d "../../../tmp_install/usr/include/postgresql") {
+ my $result = IPC::Run::run [ 'pg_config', '--major-version' ], '>',
+ \$stdout, '2>', \$stderr;
+ chomp($stdout);
+ $stdout =~ s/\r$//;
+ $stdout = "../../../tmp_install/usr/include/postgresql/" . $stdout . "/server";
+ }
open my $header_h, '<', "$stdout/$header_path" or die "$!";
@@ -764,6 +772,10 @@
or die "could not execute pg_config";
chomp($stdout);
$stdout =~ s/\r$//;
+ # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
+ if (-d "../../../tmp_install/usr/include/postgresql") {
+ $stdout = "../../../tmp_install/usr/include/postgresql";
+ }
open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!";
my $match = (grep { /^$regexp/ } <$pg_config_h>);