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

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