Blame SOURCES/libpq-13.1-symbol-versioning.patch

650c73
- The libpq package is supposed to be used for all the PostgreSQL modules
650c73
650c73
- available in RHEL 8, and ABI versioning will guarantee us that modular RPMs will
650c73
- depend on appropriate libpq ABI version (picked at build-time).
813fcf
813fcf
diff --git a/config/Makefile b/config/Makefile
813fcf
index 67e7998f55..86612a42c3 100644
813fcf
--- a/config/Makefile
813fcf
+++ b/config/Makefile
813fcf
@@ -8,6 +8,7 @@ include $(top_builddir)/src/Makefile.global
813fcf
 install: all installdirs
813fcf
 	$(INSTALL_SCRIPT) $(srcdir)/install-sh '$(DESTDIR)$(pgxsdir)/config/install-sh'
813fcf
 	$(INSTALL_SCRIPT) $(srcdir)/missing '$(DESTDIR)$(pgxsdir)/config/missing'
813fcf
+	$(INSTALL_SCRIPT) $(srcdir)/build-exports-gnu-ld '$(DESTDIR)$(pgxsdir)/config/build-exports-gnu-ld'
813fcf
 
813fcf
 installdirs:
813fcf
 	$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/config'
813fcf
diff --git a/config/build-exports-gnu-ld b/config/build-exports-gnu-ld
813fcf
new file mode 100755
650c73
index 0000000000..84c48e3ade
813fcf
--- /dev/null
813fcf
+++ b/config/build-exports-gnu-ld
813fcf
@@ -0,0 +1,41 @@
813fcf
+#! /bin/sh
813fcf
+
813fcf
+# by default use PG_ prefix
813fcf
+: "${SYMBOL_VERSION_PREFIX=PG_}"
813fcf
+
813fcf
+# we started symbol versioning since v10
813fcf
+: "${SYMBOL_VERSION_START=9.6}"
813fcf
+
813fcf
+version=$SYMBOL_VERSION_START
813fcf
+version_prev=
813fcf
+first=:
813fcf
+
813fcf
+open_block ()
813fcf
+{
813fcf
+	$first || echo
813fcf
+	first=false
813fcf
+	echo "${SYMBOL_VERSION_PREFIX}$version {"
813fcf
+	echo "global:"
813fcf
+}
813fcf
+
813fcf
+close_block ()
813fcf
+{
813fcf
+	echo "}${version_prev:+ $SYMBOL_VERSION_PREFIX$version_prev};"
813fcf
+	version_prev=$version
813fcf
+	version=$1
813fcf
+}
813fcf
+
813fcf
+open_block
813fcf
+while read -r symbol _ new_version
813fcf
+do
813fcf
+	case $symbol in '#'*) continue ;; esac
813fcf
+	if test -n "$new_version" && test "$new_version" != "$version"; then
813fcf
+		close_block "$new_version"
813fcf
+		open_block
813fcf
+	fi
813fcf
+	echo "	$symbol;"
813fcf
+done
813fcf
+
813fcf
+echo "local:"
813fcf
+echo "	*;"
813fcf
+close_block
813fcf
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
650c73
index 373d73caef..d5bd5468cd 100644
813fcf
--- a/src/Makefile.shlib
813fcf
+++ b/src/Makefile.shlib
650c73
@@ -231,7 +231,7 @@ ifeq ($(PORTNAME), linux)
813fcf
   ifdef soname
813fcf
     LINK.shared		+= -Wl,-soname,$(soname)
813fcf
   endif
813fcf
-  BUILD.exports		= ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
813fcf
+  BUILD.exports		= $(SHELL) $(top_srcdir)/config/build-exports-gnu-ld < $< > $@
813fcf
   exports_file		= $(SHLIB_EXPORTS:%.txt=%.list)
813fcf
   ifneq (,$(exports_file))
813fcf
     LINK.shared		+= -Wl,--version-script=$(exports_file)
813fcf
diff --git a/src/interfaces/libpq/exports.txt b/src/interfaces/libpq/exports.txt
650c73
index ccec59919b..4c2be8b7d5 100644
813fcf
--- a/src/interfaces/libpq/exports.txt
813fcf
+++ b/src/interfaces/libpq/exports.txt
4792ec
@@ -171,11 +171,11 @@
813fcf
 PQsslAttribute            169
813fcf
 PQsetErrorContextVisibility 170
813fcf
 PQresultVerboseErrorMessage 171
813fcf
-PQencryptPasswordConn     172
650c73
-PQresultMemorySize        173
650c73
+PQencryptPasswordConn     172      10
650c73
+PQresultMemorySize        173      12
650c73
 PQhostaddr                174
650c73
 PQgssEncInUse             175
650c73
 PQgetgssctx               176
4792ec
-PQsetSSLKeyPassHook_OpenSSL         177
4792ec
+PQsetSSLKeyPassHook_OpenSSL         177      13
4792ec
 PQgetSSLKeyPassHook_OpenSSL         178
4792ec
 PQdefaultSSLKeyPassHook_OpenSSL     179