commit:     6c433f974e7cbf9ffe242e4f768136978e647008
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 15 09:09:15 2025 +0000
Commit:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
CommitDate: Mon Sep 15 09:09:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c433f97

dev-db/postgresql: Support LLVM 21

Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 .../postgresql/files/postgresql-17.6-llvm21.patch  | 36 ++++++++++++++++++++++
 ...-13.22-r1.ebuild => postgresql-13.22-r2.ebuild} |  8 +++--
 ...-14.19-r1.ebuild => postgresql-14.19-r2.ebuild} |  5 ++-
 ...-15.14-r1.ebuild => postgresql-15.14-r2.ebuild} |  5 ++-
 ...-16.10-r1.ebuild => postgresql-16.10-r2.ebuild} |  5 ++-
 ...resql-17.6.ebuild => postgresql-17.6-r1.ebuild} |  5 ++-
 ...8_rc1-r1.ebuild => postgresql-18_rc1-r2.ebuild} |  5 ++-
 dev-db/postgresql/postgresql-9999.ebuild           |  2 +-
 8 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/dev-db/postgresql/files/postgresql-17.6-llvm21.patch 
b/dev-db/postgresql/files/postgresql-17.6-llvm21.patch
new file mode 100644
index 000000000000..90e32e872be1
--- /dev/null
+++ b/dev-db/postgresql/files/postgresql-17.6-llvm21.patch
@@ -0,0 +1,36 @@
+From 282d0bdee6192f1a859ee34672ae73abf49794dc Mon Sep 17 00:00:00 2001
+From: Peter Eisentraut <[email protected]>
+Date: Mon, 15 Sep 2025 08:13:21 +0200
+Subject: [PATCH 1/1] jit: fix build with LLVM-21
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+LLVM-21 renamed llvm::GlobalValue::getGUID() to
+getGUIDAssumingExternalLinkage(), so add a version guard.
+
+Author: Holger Hoffstätte <[email protected]>
+Discussion: 
https://www.postgresql.org/message-id/flat/d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d%40applied-asynchrony.com
+---
+ src/backend/jit/llvm/llvmjit_inline.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp 
b/src/backend/jit/llvm/llvmjit_inline.cpp
+index 2764c3bbe2f..51b32cd9f94 100644
+--- a/src/backend/jit/llvm/llvmjit_inline.cpp
++++ b/src/backend/jit/llvm/llvmjit_inline.cpp
+@@ -238,7 +238,11 @@ llvm_build_inline_plan(LLVMContextRef lc, llvm::Module 
*mod)
+ 
+               llvm_split_symbol_name(symbolName.data(), &cmodname, 
&cfuncname);
+ 
++#if LLVM_VERSION_MAJOR >= 21
++              funcGUID = 
llvm::GlobalValue::getGUIDAssumingExternalLinkage(cfuncname);
++#else
+               funcGUID = llvm::GlobalValue::getGUID(cfuncname);
++#endif
+ 
+               /* already processed */
+               if (inlineState.processed)
+-- 
+2.39.5
+

diff --git a/dev-db/postgresql/postgresql-13.22-r1.ebuild 
b/dev-db/postgresql/postgresql-13.22-r2.ebuild
similarity index 98%
rename from dev-db/postgresql/postgresql-13.22-r1.ebuild
rename to dev-db/postgresql/postgresql-13.22-r2.ebuild
index 42fc4b5e7268..bb3afc1c5a60 100644
--- a/dev-db/postgresql/postgresql-13.22-r1.ebuild
+++ b/dev-db/postgresql/postgresql-13.22-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -83,6 +83,9 @@ RDEPEND="${CDEPEND}
 selinux? ( sec-policy/selinux-postgresql )
 "
 
+PATCHES=( "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch
+       "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -92,8 +95,6 @@ pkg_setup() {
 }
 
 src_prepare() {
-       eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch
-
        # Set proper run directory
        sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
                -i src/include/pg_config_manual.h || die
@@ -111,6 +112,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-14.19-r1.ebuild 
b/dev-db/postgresql/postgresql-14.19-r2.ebuild
similarity index 99%
rename from dev-db/postgresql/postgresql-14.19-r1.ebuild
rename to dev-db/postgresql/postgresql-14.19-r2.ebuild
index 487d24d1fd79..b79194a7e287 100644
--- a/dev-db/postgresql/postgresql-14.19-r1.ebuild
+++ b/dev-db/postgresql/postgresql-14.19-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -84,6 +84,8 @@ RDEPEND="${CDEPEND}
 selinux? ( sec-policy/selinux-postgresql )
 "
 
+PATCHES=( "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -110,6 +112,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-15.14-r1.ebuild 
b/dev-db/postgresql/postgresql-15.14-r2.ebuild
similarity index 99%
rename from dev-db/postgresql/postgresql-15.14-r1.ebuild
rename to dev-db/postgresql/postgresql-15.14-r2.ebuild
index 3cb76ce59606..4915a6cd310a 100644
--- a/dev-db/postgresql/postgresql-15.14-r1.ebuild
+++ b/dev-db/postgresql/postgresql-15.14-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -85,6 +85,8 @@ RDEPEND="${CDEPEND}
 selinux? ( sec-policy/selinux-postgresql )
 "
 
+PATCHES=( "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -111,6 +113,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-16.10-r1.ebuild 
b/dev-db/postgresql/postgresql-16.10-r2.ebuild
similarity index 99%
rename from dev-db/postgresql/postgresql-16.10-r1.ebuild
rename to dev-db/postgresql/postgresql-16.10-r2.ebuild
index 9927644fed1e..496e6eae504a 100644
--- a/dev-db/postgresql/postgresql-16.10-r1.ebuild
+++ b/dev-db/postgresql/postgresql-16.10-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -86,6 +86,8 @@ RDEPEND="${CDEPEND}
 selinux? ( sec-policy/selinux-postgresql )
 "
 
+PATCHES=( "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -112,6 +114,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-17.6.ebuild 
b/dev-db/postgresql/postgresql-17.6-r1.ebuild
similarity index 99%
rename from dev-db/postgresql/postgresql-17.6.ebuild
rename to dev-db/postgresql/postgresql-17.6-r1.ebuild
index ec2c1e3ad9d1..aee4242e58dd 100644
--- a/dev-db/postgresql/postgresql-17.6.ebuild
+++ b/dev-db/postgresql/postgresql-17.6-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -98,6 +98,8 @@ dev-libs/libxml2
 dev-libs/libxslt
 "
 
+PATCHES=( "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -124,6 +126,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-18_rc1-r1.ebuild 
b/dev-db/postgresql/postgresql-18_rc1-r2.ebuild
similarity index 99%
rename from dev-db/postgresql/postgresql-18_rc1-r1.ebuild
rename to dev-db/postgresql/postgresql-18_rc1-r2.ebuild
index 5415d8c41bd6..773065596058 100644
--- a/dev-db/postgresql/postgresql-18_rc1-r1.ebuild
+++ b/dev-db/postgresql/postgresql-18_rc1-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 pam python-single-r1 systemd 
tmpfiles
@@ -101,6 +101,8 @@ dev-libs/libxml2
 dev-libs/libxslt
 "
 
+PATCHES=( "${FILESDIR}"/postgresql-17.6-llvm21.patch )
+
 pkg_setup() {
        use llvm && llvm-r1_pkg_setup
 
@@ -127,6 +129,7 @@ src_prepare() {
                        die 'PGSQL_PAM_SERVICE rename failed.'
        fi
 
+       default
        eapply_user
 }
 

diff --git a/dev-db/postgresql/postgresql-9999.ebuild 
b/dev-db/postgresql/postgresql-9999.ebuild
index 6824511bb392..ed78dab54c3c 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9999.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 LLVM_OPTIONAL=1
 
 inherit dot-a flag-o-matic linux-info llvm-r1 meson pam python-single-r1 \

Reply via email to