summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:08 +0000
commitc8f4a18517306b8e4f0c467df5c021593c47e550 (patch)
treea485b32d21dc418a66ef7fc9ef93ca29fed61573 /debian/patches
parentAdding upstream version 14.5. (diff)
downloadpostgresql-14-debian.tar.xz
postgresql-14-debian.zip
Adding debian version 14.5-3.debian/14.5-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/50-per-version-dirs.patch69
-rw-r--r--debian/patches/51-default-sockets-in-var.patch20
-rw-r--r--debian/patches/52-tutorial-README.patch16
-rw-r--r--debian/patches/53-pg_service.conf_directory_doc.patch19
-rw-r--r--debian/patches/54-debian-alternatives-for-external-tools.patch28
-rw-r--r--debian/patches/70-history13
-rw-r--r--debian/patches/autoconf2.697
-rw-r--r--debian/patches/extension_destdir270
-rw-r--r--debian/patches/filter-debug-prefix-map44
-rw-r--r--debian/patches/focal-arm64-outline-atomics23
-rw-r--r--debian/patches/libpgport-pkglibdir84
-rw-r--r--debian/patches/series11
12 files changed, 604 insertions, 0 deletions
diff --git a/debian/patches/50-per-version-dirs.patch b/debian/patches/50-per-version-dirs.patch
new file mode 100644
index 0000000..7819df3
--- /dev/null
+++ b/debian/patches/50-per-version-dirs.patch
@@ -0,0 +1,69 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Use version specific installation directories so that several major versions can be installed in parallel.
+Forwarded: No, Debian specific packaging with postgresql-common
+
+ * Install lib files into /usr/lib/postgresql/<version>/lib/
+ * 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/lib/postgresql/<version>/bin behave
+ identically.
+
+Bug-Debian: http://bugs.debian.org/462037
+
+--- 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@/lib
+ 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/TestLib.pm
++++ b/src/test/perl/TestLib.pm
+@@ -591,6 +591,10 @@ sub check_pg_config
+ or die "could not execute pg_config";
+ chomp($stdout);
+ $stdout =~ s/\r$//;
++ # Debian's pg_config is not relocatable, manually check for correct location
++ if (-d "../../../build/tmp_install/usr/include/postgresql") {
++ $stdout = "../../../build/tmp_install/usr/include/postgresql";
++ }
+
+ open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!";
+ my $match = (grep { /^$regexp/ } <$pg_config_h>);
diff --git a/debian/patches/51-default-sockets-in-var.patch b/debian/patches/51-default-sockets-in-var.patch
new file mode 100644
index 0000000..5ea8488
--- /dev/null
+++ b/debian/patches/51-default-sockets-in-var.patch
@@ -0,0 +1,20 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Put server Unix sockets into /var/run/postgresql/ by default
+Forwarded: No, Debian specific configuration with postgresql-common
+
+Using /tmp for sockets allows everyone to spoof a PostgreSQL server. Thus use
+/var/run/postgresql/ for "system" clusters which run as 'postgres' (user
+clusters will still use /tmp). Since system cluster are by far the common case,
+set it as default.
+
+--- a/src/include/pg_config_manual.h
++++ b/src/include/pg_config_manual.h
+@@ -201,7 +201,7 @@
+ * support them yet.
+ */
+ #ifndef WIN32
+-#define DEFAULT_PGSOCKET_DIR "/tmp"
++#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
+ #else
+ #define DEFAULT_PGSOCKET_DIR ""
+ #endif
diff --git a/debian/patches/52-tutorial-README.patch b/debian/patches/52-tutorial-README.patch
new file mode 100644
index 0000000..9eb3263
--- /dev/null
+++ b/debian/patches/52-tutorial-README.patch
@@ -0,0 +1,16 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Update tutorial README for required build dependencies.
+Forwarded: No, Debian specific
+
+--- a/src/tutorial/README
++++ b/src/tutorial/README
+@@ -6,8 +6,7 @@ tutorial
+ This directory contains SQL tutorial scripts. To look at them, first do a
+ % make
+ to compile all the scripts and C files for the user-defined functions
+-and types. (make needs to be GNU make --- it may be named something
+-different on your system, often 'gmake')
++and types. This requires a postgresql-server-dev-* package to be installed.
+
+ Then, run psql with the -s (single-step) flag:
+ % psql -s
diff --git a/debian/patches/53-pg_service.conf_directory_doc.patch b/debian/patches/53-pg_service.conf_directory_doc.patch
new file mode 100644
index 0000000..584b41c
--- /dev/null
+++ b/debian/patches/53-pg_service.conf_directory_doc.patch
@@ -0,0 +1,19 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Update pg_service.conf example to tell the Debian specific file location.
+Forwarded: No, Debian specific
+
+Index: postgresql-9.2-9.2~beta1/src/interfaces/libpq/pg_service.conf.sample
+===================================================================
+--- postgresql-9.2-9.2~beta1.orig/src/interfaces/libpq/pg_service.conf.sample 2011-04-27 23:17:22.000000000 +0200
++++ postgresql-9.2-9.2~beta1/src/interfaces/libpq/pg_service.conf.sample 2011-05-10 11:25:42.151949794 +0200
+@@ -8,8 +8,8 @@
+ # to look up such parameters. A sample configuration for postgres is
+ # included in this file. Lines beginning with '#' are comments.
+ #
+-# Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
+-# rename it pg_service.conf.
++# Copy this to /etc/postgresql-common/ (or select its location with the
++# PGSYSCONFDIR environment variable) and rename it pg_service.conf.
+ #
+ #
+ #[postgres]
diff --git a/debian/patches/54-debian-alternatives-for-external-tools.patch b/debian/patches/54-debian-alternatives-for-external-tools.patch
new file mode 100644
index 0000000..0031989
--- /dev/null
+++ b/debian/patches/54-debian-alternatives-for-external-tools.patch
@@ -0,0 +1,28 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Use Debian alternatives for external tools instead of hardcoded programs
+Forwarded: No, Debian specific
+
+--- a/src/bin/psql/settings.h
++++ b/src/bin/psql/settings.h
+@@ -19,8 +19,8 @@
+ #define DEFAULT_EDITOR "notepad.exe"
+ /* no DEFAULT_EDITOR_LINENUMBER_ARG for Notepad */
+ #else
+-#define DEFAULT_EDITOR "vi"
+-#define DEFAULT_EDITOR_LINENUMBER_ARG "+"
++#define DEFAULT_EDITOR "sensible-editor"
++/*#define DEFAULT_EDITOR_LINENUMBER_ARG "+"*/
+ #endif
+
+ #define DEFAULT_PROMPT1 "%/%R%x%# "
+--- a/src/include/fe_utils/print.h
++++ b/src/include/fe_utils/print.h
+@@ -20,7 +20,7 @@
+
+ /* This is not a particularly great place for this ... */
+ #ifndef __CYGWIN__
+-#define DEFAULT_PAGER "more"
++#define DEFAULT_PAGER "pager"
+ #else
+ #define DEFAULT_PAGER "less"
+ #endif
diff --git a/debian/patches/70-history b/debian/patches/70-history
new file mode 100644
index 0000000..34c8683
--- /dev/null
+++ b/debian/patches/70-history
@@ -0,0 +1,13 @@
+Author: Christoph Berg <myon@debian.org>
+Description: Document Debian location of release notes files.
+Forwarded: No, Debian specific
+
+--- a/HISTORY
++++ b/HISTORY
+@@ -3,3 +3,6 @@
+
+ Distribution file sets include release notes for their version and preceding
+ versions. Visit the file doc/src/sgml/html/release.html in an HTML browser.
++
++On Debian systems, the release notes are contained in the postgresql-doc-*
++packages, located in /usr/share/doc/postgresql-doc-*/html/release.html.
diff --git a/debian/patches/autoconf2.69 b/debian/patches/autoconf2.69
new file mode 100644
index 0000000..009955f
--- /dev/null
+++ b/debian/patches/autoconf2.69
@@ -0,0 +1,7 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -22,4 +21,0 @@ AC_INIT([PostgreSQL], [14.1], [pgsql-bug
+-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
+-Untested combinations of 'autoconf' and PostgreSQL versions are not
+-recommended. You can remove the check from 'configure.ac' but it is then
+-your responsibility whether the result works or not.])])
diff --git a/debian/patches/extension_destdir b/debian/patches/extension_destdir
new file mode 100644
index 0000000..a9d0799
--- /dev/null
+++ b/debian/patches/extension_destdir
@@ -0,0 +1,270 @@
+--- a/src/backend/utils/misc/guc.c
++++ b/src/backend/utils/misc/guc.c
+@@ -599,6 +599,7 @@ char *ConfigFileName;
+ char *HbaFileName;
+ char *IdentFileName;
+ char *external_pid_file;
++char *extension_destdir;
+
+ char *pgstat_temp_directory;
+
+@@ -4384,6 +4385,17 @@ static struct config_string ConfigureNam
+ },
+
+ {
++ {"extension_destdir", PGC_SUSET, FILE_LOCATIONS,
++ gettext_noop("Path to prepend for extension loading"),
++ gettext_noop("This directory is prepended to paths when loading extensions (control and SQL files), and to the '$libdir' directive when loading modules that back functions. The location is made configurable to allow build-time testing of extensions that do not have been installed to their proper location yet."),
++ GUC_SUPERUSER_ONLY
++ },
++ &extension_destdir,
++ "",
++ NULL, NULL, NULL
++ },
++
++ {
+ {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Shows the name of the SSL library."),
+ NULL,
+--- a/src/backend/commands/extension.c
++++ b/src/backend/commands/extension.c
+@@ -128,6 +128,8 @@ static void ApplyExtensionUpdates(Oid ex
+ bool cascade,
+ bool is_create);
+ static char *read_whole_file(const char *filename, int *length);
++static bool file_exists(const char *name);
++static bool directory_exists(const char *dir);
+
+
+ /*
+@@ -388,6 +390,16 @@ get_extension_control_filename(const cha
+
+ get_share_path(my_exec_path, sharepath);
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ snprintf(result, MAXPGPATH, "%s%s/extension/%s.control",
++ extension_destdir, sharepath, extname);
++ if (file_exists(result))
++ return result;
++ }
+ snprintf(result, MAXPGPATH, "%s/extension/%s.control",
+ sharepath, extname);
+
+@@ -427,6 +439,16 @@ get_extension_aux_control_filename(Exten
+ scriptdir = get_extension_script_directory(control);
+
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s.control",
++ extension_destdir, scriptdir, control->name, version);
++ if (file_exists(result))
++ return result;
++ }
+ snprintf(result, MAXPGPATH, "%s/%s--%s.control",
+ scriptdir, control->name, version);
+
+@@ -445,6 +467,23 @@ get_extension_script_filename(ExtensionC
+ scriptdir = get_extension_script_directory(control);
+
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ if (from_version)
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s--%s.sql",
++ extension_destdir, scriptdir, control->name, from_version, version);
++ else
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s.sql",
++ extension_destdir, scriptdir, control->name, version);
++ if (file_exists(result))
++ {
++ pfree(scriptdir);
++ return result;
++ }
++ }
+ if (from_version)
+ snprintf(result, MAXPGPATH, "%s/%s--%s--%s.sql",
+ scriptdir, control->name, from_version, version);
+@@ -1122,6 +1161,59 @@ get_ext_ver_list(ExtensionControlFile *c
+ DIR *dir;
+ struct dirent *de;
+
++ /*
++ * If extension_destdir is set, try to find the files there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ char location[MAXPGPATH];
++
++ snprintf(location, MAXPGPATH, "%s%s", extension_destdir,
++ get_extension_script_directory(control));
++ dir = AllocateDir(location);
++ while ((de = ReadDir(dir, location)) != NULL)
++ {
++ char *vername;
++ char *vername2;
++ ExtensionVersionInfo *evi;
++ ExtensionVersionInfo *evi2;
++
++ /* must be a .sql file ... */
++ if (!is_extension_script_filename(de->d_name))
++ continue;
++
++ /* ... matching extension name followed by separator */
++ if (strncmp(de->d_name, control->name, extnamelen) != 0 ||
++ de->d_name[extnamelen] != '-' ||
++ de->d_name[extnamelen + 1] != '-')
++ continue;
++
++ /* extract version name(s) from 'extname--something.sql' filename */
++ vername = pstrdup(de->d_name + extnamelen + 2);
++ *strrchr(vername, '.') = '\0';
++ vername2 = strstr(vername, "--");
++ if (!vername2)
++ {
++ /* It's an install, not update, script; record its version name */
++ evi = get_ext_ver_info(vername, &evi_list);
++ evi->installable = true;
++ continue;
++ }
++ *vername2 = '\0'; /* terminate first version */
++ vername2 += 2; /* and point to second */
++
++ /* if there's a third --, it's bogus, ignore it */
++ if (strstr(vername2, "--"))
++ continue;
++
++ /* Create ExtensionVersionInfos and link them together */
++ evi = get_ext_ver_info(vername, &evi_list);
++ evi2 = get_ext_ver_info(vername2, &evi_list);
++ evi->reachable = lappend(evi->reachable, evi2);
++ }
++ FreeDir(dir);
++ }
++
+ location = get_extension_script_directory(control);
+ dir = AllocateDir(location);
+ while ((de = ReadDir(dir, location)) != NULL)
+@@ -3470,3 +3562,32 @@ read_whole_file(const char *filename, in
+ buf[*length] = '\0';
+ return buf;
+ }
++
++static bool
++file_exists(const char *name)
++{
++ struct stat st;
++
++ AssertArg(name != NULL);
++
++ if (stat(name, &st) == 0)
++ return S_ISDIR(st.st_mode) ? false : true;
++ else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
++ ereport(ERROR,
++ (errcode_for_file_access(),
++ errmsg("could not access file \"%s\": %m", name)));
++
++ return false;
++}
++
++static bool
++directory_exists(const char *dir)
++{
++ struct stat st;
++
++ if (stat(dir, &st) != 0)
++ return false;
++ if (S_ISDIR(st.st_mode))
++ return true;
++ return false;
++}
+--- a/src/include/utils/guc.h
++++ b/src/include/utils/guc.h
+@@ -270,6 +270,7 @@ extern PGDLLIMPORT char *ConfigFileName;
+ extern char *HbaFileName;
+ extern char *IdentFileName;
+ extern char *external_pid_file;
++extern char *extension_destdir;
+
+ extern PGDLLIMPORT char *application_name;
+
+--- a/src/backend/utils/fmgr/dfmgr.c
++++ b/src/backend/utils/fmgr/dfmgr.c
+@@ -34,6 +34,7 @@
+ #include "lib/stringinfo.h"
+ #include "miscadmin.h"
+ #include "storage/shmem.h"
++#include "utils/guc.h"
+ #include "utils/hsearch.h"
+
+
+@@ -487,7 +488,7 @@ expand_dynamic_library_name(const char *
+ {
+ bool have_slash;
+ char *new;
+- char *full;
++ char *full, *full2;
+
+ AssertArg(name);
+
+@@ -502,6 +503,19 @@ expand_dynamic_library_name(const char *
+ else
+ {
+ full = substitute_libpath_macro(name);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ full2 = psprintf("%s%s", extension_destdir, full);
++ if (file_exists(full2))
++ {
++ pfree(full);
++ return full2;
++ }
++ pfree(full2);
++ }
+ if (file_exists(full))
+ return full;
+ pfree(full);
+@@ -520,6 +534,19 @@ expand_dynamic_library_name(const char *
+ {
+ full = substitute_libpath_macro(new);
+ pfree(new);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ full2 = psprintf("%s%s", extension_destdir, full);
++ if (file_exists(full2))
++ {
++ pfree(full);
++ return full2;
++ }
++ pfree(full2);
++ }
+ if (file_exists(full))
+ return full;
+ pfree(full);
+--- a/src/backend/utils/misc/postgresql.conf.sample
++++ b/src/backend/utils/misc/postgresql.conf.sample
+@@ -725,6 +725,8 @@
+ # - Other Defaults -
+
+ #dynamic_library_path = '$libdir'
++#extension_destdir = '' # prepend path when loading extensions
++ # and shared objects (added by Debian)
+ #gin_fuzzy_search_limit = 0
+
+
diff --git a/debian/patches/filter-debug-prefix-map b/debian/patches/filter-debug-prefix-map
new file mode 100644
index 0000000..e1b6709
--- /dev/null
+++ b/debian/patches/filter-debug-prefix-map
@@ -0,0 +1,44 @@
+To make the PostgreSQL server packages build reproducibly, we need to remove
+the build path from -fdebug-prefix-map and -ffile-prefix-map in CFLAGS.
+
+* The actual server build still uses the original CFLAGS so the build path is
+ correctly mapped in the object files.
+* The information printed by the pg_config binary and the system view is
+ filtered in src/common/Makefile and the configure script.
+* The build paths stored in Makefile.global are filtered in debian/rules.
+ (abs_top_builddir, abs_top_srcdir, configure_args, CFLAGS)
+* To make PGXS module builds reproducible, pg_buildext copies the environment
+ CFLAGS to COPT where Makefile.global picks them up, using the prefix maps
+ from dpkg-buildflags.
+
+--- a/src/common/Makefile
++++ b/src/common/Makefile
+@@ -33,7 +33,7 @@ STD_CPPFLAGS := $(filter-out -I$(top_src
+ STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
+ override CPPFLAGS += -DVAL_CC="\"$(CC)\""
+ override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
+-override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\""
++override CPPFLAGS += -DVAL_CFLAGS="\"$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,$(CFLAGS))\""
+ override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
+ override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
+ override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
+--- a/configure.ac
++++ b/configure.ac
+@@ -27,6 +27,7 @@ AC_COPYRIGHT([Copyright (c) 1996-2020, P
+ AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
+ AC_CONFIG_AUX_DIR(config)
+ AC_PREFIX_DEFAULT(/usr/local/pgsql)
++[ac_configure_args=$(echo "$ac_configure_args" | sed -e "s/ -f\(debug\|file\)-prefix-map=[^' ]*//g")]
+ AC_DEFINE_UNQUOTED(CONFIGURE_ARGS, ["$ac_configure_args"], [Saved arguments from configure])
+
+ [PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`]
+--- a/configure
++++ b/configure
+@@ -2796,6 +2796,7 @@ ac_config_sub="$SHELL $ac_aux_dir/config
+ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
++ac_configure_args=$(echo "$ac_configure_args" | sed -e "s/ -f\(debug\|file\)-prefix-map=[^' ]*//g")
+
+
+ cat >>confdefs.h <<_ACEOF
diff --git a/debian/patches/focal-arm64-outline-atomics b/debian/patches/focal-arm64-outline-atomics
new file mode 100644
index 0000000..7d101f1
--- /dev/null
+++ b/debian/patches/focal-arm64-outline-atomics
@@ -0,0 +1,23 @@
+Enable outline-atomics on arm64.
+
+The flag was added in focal's gcc, but is off by default there. It is enabled
+by default on all later distributions (hirsute, impish, bullseye, bookwork,
+sid).
+
+https://www.postgresql.org/message-id/flat/1635221042457.21654%40amazon.com
+
+This patch can be removed once focal is EOL.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -538,6 +538,10 @@ if test "$GCC" = yes -a "$ICC" = no; the
+ if test -n "$NOT_THE_CFLAGS"; then
+ CFLAGS="$CFLAGS -Wno-stringop-truncation"
+ fi
++ if test x"$host_cpu" == x"aarch64"; then
++ PGAC_PROG_CC_CFLAGS_OPT([-moutline-atomics])
++ PGAC_PROG_CXX_CFLAGS_OPT([-moutline-atomics])
++ fi
+ elif test "$ICC" = yes; then
+ # Intel's compiler has a bug/misoptimization in checking for
+ # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
diff --git a/debian/patches/libpgport-pkglibdir b/debian/patches/libpgport-pkglibdir
new file mode 100644
index 0000000..0677f5b
--- /dev/null
+++ b/debian/patches/libpgport-pkglibdir
@@ -0,0 +1,84 @@
+Author: Christoph Berg <myon@debian.org>
+Description: Move libpgport/libpgcommon/libpgfeutils from libdir to pkglibdir
+ This allows client applications to link to version-specific libraries.
+ Used by pg-checksums.
+Forwarded: No, (somewhat) Debian specific
+
+--- a/src/common/Makefile
++++ b/src/common/Makefile
+@@ -68,15 +68,15 @@ all: libpgcommon.a libpgcommon_shlib.a l
+
+ # libpgcommon is needed by some contrib
+ install: all installdirs
+- $(INSTALL_STLIB) libpgcommon.a '$(DESTDIR)$(libdir)/libpgcommon.a'
+- $(INSTALL_STLIB) libpgcommon_shlib.a '$(DESTDIR)$(libdir)/libpgcommon_shlib.a'
++ $(INSTALL_STLIB) libpgcommon.a '$(DESTDIR)$(pkglibdir)/libpgcommon.a'
++ $(INSTALL_STLIB) libpgcommon_shlib.a '$(DESTDIR)$(pkglibdir)/libpgcommon_shlib.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgcommon.a'
+- rm -f '$(DESTDIR)$(libdir)/libpgcommon_shlib.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgcommon.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgcommon_shlib.a'
+
+ libpgcommon.a: $(OBJS_FRONTEND)
+ rm -f $@
+--- a/src/fe_utils/Makefile
++++ b/src/fe_utils/Makefile
+@@ -35,13 +35,13 @@ distprep: psqlscan.c
+
+ # libpgfeutils could be useful to contrib, so install it
+ install: all installdirs
+- $(INSTALL_STLIB) libpgfeutils.a '$(DESTDIR)$(libdir)/libpgfeutils.a'
++ $(INSTALL_STLIB) libpgfeutils.a '$(DESTDIR)$(pkglibdir)/libpgfeutils.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgfeutils.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgfeutils.a'
+
+ clean distclean:
+ rm -f libpgfeutils.a $(OBJS) lex.backup
+--- a/src/port/Makefile
++++ b/src/port/Makefile
+@@ -54,15 +54,15 @@ all: libpgport.a libpgport_shlib.a libpg
+
+ # libpgport is needed by some contrib
+ install: all installdirs
+- $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
+- $(INSTALL_STLIB) libpgport_shlib.a '$(DESTDIR)$(libdir)/libpgport_shlib.a'
++ $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(pkglibdir)/libpgport.a'
++ $(INSTALL_STLIB) libpgport_shlib.a '$(DESTDIR)$(pkglibdir)/libpgport_shlib.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgport.a'
+- rm -f '$(DESTDIR)$(libdir)/libpgport_shlib.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgport.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgport_shlib.a'
+
+ libpgport.a: $(OBJS)
+ rm -f $@
+--- a/src/Makefile.global.in
++++ b/src/Makefile.global.in
+@@ -549,8 +549,8 @@ libpq = -L$(libpq_builddir) -lpq
+ # on client link lines, since that also appears in $(LIBS).
+ # libpq_pgport_shlib is the same idea, but for use in client shared libraries.
+ ifdef PGXS
+-libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
+-libpq_pgport_shlib = -L$(libdir) -lpgcommon_shlib -lpgport_shlib $(libpq)
++libpq_pgport = -L$(pkglibdir) -lpgcommon -lpgport $(libpq)
++libpq_pgport_shlib = -L$(pkglibdir) -lpgcommon_shlib -lpgport_shlib $(libpq)
+ else
+ libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
+ libpq_pgport_shlib = -L$(top_builddir)/src/common -lpgcommon_shlib -L$(top_builddir)/src/port -lpgport_shlib $(libpq)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..411958b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,11 @@
+50-per-version-dirs.patch
+51-default-sockets-in-var.patch
+52-tutorial-README.patch
+53-pg_service.conf_directory_doc.patch
+54-debian-alternatives-for-external-tools.patch
+70-history
+filter-debug-prefix-map
+libpgport-pkglibdir
+extension_destdir
+autoconf2.69
+focal-arm64-outline-atomics