commit: 4e6174c72b182b4e10556950cc4be63422df131a Author: Marek Szuba <marecki <AT> gentoo <DOT> org> AuthorDate: Fri Aug 13 11:31:04 2021 +0000 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> CommitDate: Fri Aug 13 11:34:03 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e6174c7
dev-db/postgresql: enable native spinlock support on riscv Don't bother with a revbump even though this is a run-time change - 13.4 and 14_beta3 were released yesterday so in the rather unlikely event of someone already running a PostgreSQL server on a Gentoo/RISC-V system, they will receive this change along with the the hopefully-imminent version bump. Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> .../files/postgresql-13.3-riscv-spinlocks.patch | 26 ++++++++++++++++++++++ dev-db/postgresql/postgresql-13.3.ebuild | 4 +++- dev-db/postgresql/postgresql-14_beta2.ebuild | 4 +++- dev-db/postgresql/postgresql-9999.ebuild | 5 ++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/dev-db/postgresql/files/postgresql-13.3-riscv-spinlocks.patch b/dev-db/postgresql/files/postgresql-13.3-riscv-spinlocks.patch new file mode 100644 index 00000000000..86d1fae20d8 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-13.3-riscv-spinlocks.patch @@ -0,0 +1,26 @@ +--- a/src/include/storage/s_lock.h ++++ b/src/include/storage/s_lock.h +@@ -315,12 +315,12 @@ + #endif /* __ia64__ || __ia64 */ + + /* +- * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. ++ * On ARM, ARM64 and RISC-V, we use __sync_lock_test_and_set(int *, int) if available. + * + * We use the int-width variant of the builtin because it works on more chips + * than other widths. + */ +-#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) ++#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__riscv) + #ifdef HAVE_GCC__SYNC_INT32_TAS + #define HAS_TEST_AND_SET + +@@ -337,7 +337,7 @@ + #define S_UNLOCK(lock) __sync_lock_release(lock) + + #endif /* HAVE_GCC__SYNC_INT32_TAS */ +-#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ ++#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */ + + + /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ diff --git a/dev-db/postgresql/postgresql-13.3.ebuild b/dev-db/postgresql/postgresql-13.3.ebuild index 85d7618669c..4063b6442c5 100644 --- a/dev-db/postgresql/postgresql-13.3.ebuild +++ b/dev-db/postgresql/postgresql-13.3.ebuild @@ -91,6 +91,8 @@ 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 @@ -159,7 +161,7 @@ src_configure() { $(use_with xml libxslt) \ $(use_with zlib) \ $(use_enable nls)" - if use alpha || use riscv; then + if use alpha; then myconf+=" --disable-spinlocks" else # Should be the default but just in case diff --git a/dev-db/postgresql/postgresql-14_beta2.ebuild b/dev-db/postgresql/postgresql-14_beta2.ebuild index e6463312ebc..7cf4067cc08 100644 --- a/dev-db/postgresql/postgresql-14_beta2.ebuild +++ b/dev-db/postgresql/postgresql-14_beta2.ebuild @@ -92,6 +92,8 @@ 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 @@ -161,7 +163,7 @@ src_configure() { $(use_with xml libxslt) \ $(use_with zlib) \ $(use_enable nls)" - if use alpha || use riscv; then + if use alpha; then myconf+=" --disable-spinlocks" else # Should be the default but just in case diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild index 8bdc4467a14..9b90b0ee77a 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-9999.ebuild @@ -110,6 +110,9 @@ pkg_setup() { } src_prepare() { + # still needed as of 2021-08-13 + 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 @@ -177,7 +180,7 @@ src_configure() { $(use_with zlib) \ $(use_with systemd) \ ${uuid_config}" - if use alpha || use riscv; then + if use alpha; then myconf+=" --disable-spinlocks" else # Should be the default but just in case