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

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