| 1 | Author: Martin Pitt <[email protected]>
|
| 2 | Description: Use version specific installation directories so that several major versions can be installed in parallel.
|
| 3 |
|
| 4 | * Install server lib files into /usr/lib/postgresql<version>/
|
| 5 | * Install server related header files into /usr/include/postgresql/<version>/server/
|
| 6 | * Disable PostgreSQL's automagic path mangling and fix libdir for pg_config,
|
| 7 | so that pg_config in /usr/bin and /usr/libexec/postgresql<version> behave
|
| 8 | identically.
|
| 9 |
|
| 10 | Bug-Debian: http://bugs.debian.org/462037
|
| 11 | Patch-Source: https://sources.debian.org/src/postgresql-14/14.0-1/debian/patches/50-per-version-dirs.patch
|
| 12 |
|
| 13 | diff --git a/src/Makefile.global.in b/src/Makefile.global.in
|
| 14 | index 8b1b357..18dd786 100644
|
| 15 | |
| 16 | |
| 17 | @@ -129,7 +129,7 @@ libdir := @libdir@
|
| 18 | pkglibdir = $(libdir)
|
| 19 | ifeq "$(findstring pgsql, $(pkglibdir))" ""
|
| 20 | ifeq "$(findstring postgres, $(pkglibdir))" ""
|
| 21 | -override pkglibdir := $(pkglibdir)/postgresql
|
| 22 | +override pkglibdir := /usr/lib/postgresql@PG_MAJORVERSION@
|
| 23 | endif
|
| 24 | endif
|
| 25 |
|
| 26 | @@ -172,7 +172,7 @@ endif # PGXS
|
| 27 |
|
| 28 | # These derived path variables aren't separately configurable.
|
| 29 |
|
| 30 | -includedir_server = $(pkgincludedir)/server
|
| 31 | +includedir_server = $(pkgincludedir)/@PG_MAJORVERSION@/server
|
| 32 | includedir_internal = $(pkgincludedir)/internal
|
| 33 | pgxsdir = $(pkglibdir)/pgxs
|
| 34 | bitcodedir = $(pkglibdir)/bitcode
|
| 35 | diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c
|
| 36 | index 28db024..4b96e65 100644
|
| 37 | |
| 38 | |
| 39 | @@ -26,6 +26,8 @@
|
| 40 |
|
| 41 | #include "common/config_info.h"
|
| 42 |
|
| 43 | +#include "../port/pg_config_paths.h"
|
| 44 | +
|
| 45 | static const char *progname;
|
| 46 |
|
| 47 | /*
|
| 48 | @@ -148,11 +150,7 @@ main(int argc, char **argv)
|
| 49 | }
|
| 50 | }
|
| 51 |
|
| 52 | - if (find_my_exec(argv[0], my_exec_path) < 0)
|
| 53 | - {
|
| 54 | - fprintf(stderr, _("%s: could not find own program executable\n"), progname);
|
| 55 | - exit(1);
|
| 56 | - }
|
| 57 | + snprintf(my_exec_path, sizeof(my_exec_path), "%s/%s", PGBINDIR, progname);
|
| 58 |
|
| 59 | configdata = get_configdata(my_exec_path, &configdata_len);
|
| 60 | /* no arguments -> print everything */
|
| 61 | diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
|
| 62 | index 7d7ca83..a378517 100644
|
| 63 | |
| 64 | |
| 65 | @@ -730,6 +730,14 @@ sub scan_server_header
|
| 66 | or die "could not execute pg_config";
|
| 67 | chomp($stdout);
|
| 68 | $stdout =~ s/\r$//;
|
| 69 | + # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
|
| 70 | + if (-d "../../../tmp_install/usr/include/postgresql") {
|
| 71 | + my $result = IPC::Run::run [ 'pg_config', '--major-version' ], '>',
|
| 72 | + \$stdout, '2>', \$stderr;
|
| 73 | + chomp($stdout);
|
| 74 | + $stdout =~ s/\r$//;
|
| 75 | + $stdout = "../../../tmp_install/usr/include/postgresql/" . $stdout . "/server";
|
| 76 | + }
|
| 77 |
|
| 78 | open my $header_h, '<', "$stdout/$header_path" or die "$!";
|
| 79 |
|
| 80 | @@ -769,6 +777,10 @@ sub check_pg_config
|
| 81 | or die "could not execute pg_config";
|
| 82 | chomp($stdout);
|
| 83 | $stdout =~ s/\r$//;
|
| 84 | + # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
|
| 85 | + if (-d "../../../tmp_install/usr/include/postgresql") {
|
| 86 | + $stdout = "../../../tmp_install/usr/include/postgresql";
|
| 87 | + }
|
| 88 |
|
| 89 | open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!";
|
| 90 | my $match = (grep { /^$regexp/ } <$pg_config_h>);
|