projects/aports·blob master · refs

84 lines · 2.9 KiB

1Author: Martin Pitt <[email protected]>
2Description: 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
10Bug-Debian: http://bugs.debian.org/462037
11Patch-Source: https://sources.debian.org/src/postgresql-14/14.0-1/debian/patches/50-per-version-dirs.patch
12
13--- a/src/Makefile.global.in
14+++ b/src/Makefile.global.in
15@@ -119,7 +119,7 @@ libdir := @libdir@
16 pkglibdir = $(libdir)
17 ifeq "$(findstring pgsql, $(pkglibdir))" ""
18 ifeq "$(findstring postgres, $(pkglibdir))" ""
19-override pkglibdir := $(pkglibdir)/postgresql
20+override pkglibdir := /usr/lib/postgresql@PG_MAJORVERSION@
21 endif
22 endif
23
24@@ -167,7 +167,7 @@ endif # PGXS
25
26 # These derived path variables aren't separately configurable.
27
28-includedir_server = $(pkgincludedir)/server
29+includedir_server = $(pkgincludedir)/@PG_MAJORVERSION@/server
30 includedir_internal = $(pkgincludedir)/internal
31 pgxsdir = $(pkglibdir)/pgxs
32 bitcodedir = $(pkglibdir)/bitcode
33--- a/src/bin/pg_config/pg_config.c
34+++ b/src/bin/pg_config/pg_config.c
35@@ -27,6 +27,8 @@
36 #include "common/config_info.h"
37 #include "port.h"
38
39+#include "../port/pg_config_paths.h"
40+
41 static const char *progname;
42
43 /*
44@@ -149,11 +151,7 @@ main(int argc, char **argv)
45 }
46 }
47
48- if (find_my_exec(argv[0], my_exec_path) < 0)
49- {
50- fprintf(stderr, _("%s: could not find own program executable\n"), progname);
51- exit(1);
52- }
53+ snprintf(my_exec_path, sizeof(my_exec_path), "%s/%s", PGBINDIR, progname);
54
55 configdata = get_configdata(my_exec_path, &configdata_len);
56 /* no arguments -> print everything */
57--- a/src/test/perl/PostgreSQL/Test/Utils.pm
58+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
59@@ -726,6 +726,14 @@
60 or die "could not execute pg_config";
61 chomp($stdout);
62 $stdout =~ s/\r$//;
63+ # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
64+ if (-d "../../../tmp_install/usr/include/postgresql") {
65+ my $result = IPC::Run::run [ 'pg_config', '--major-version' ], '>',
66+ \$stdout, '2>', \$stderr;
67+ chomp($stdout);
68+ $stdout =~ s/\r$//;
69+ $stdout = "../../../tmp_install/usr/include/postgresql/" . $stdout . "/server";
70+ }
71
72 open my $header_h, '<', "$stdout/$header_path" or die "$!";
73
74@@ -764,6 +772,10 @@
75 or die "could not execute pg_config";
76 chomp($stdout);
77 $stdout =~ s/\r$//;
78+ # XXX-Patched: Alpine's pg_config is not relocatable, manually check for correct location
79+ if (-d "../../../tmp_install/usr/include/postgresql") {
80+ $stdout = "../../../tmp_install/usr/include/postgresql";
81+ }
82
83 open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!";
84 my $match = (grep { /^$regexp/ } <$pg_config_h>);