diff --git a/main/postgresql/APKBUILD b/main/postgresql/APKBUILD
index d6e74dacbc03f64db7eb62d2f0e9144251195b2d..adbc51e71b8316bc739e9a32e09d4a7e76404dfb 100644
--- a/main/postgresql/APKBUILD
+++ b/main/postgresql/APKBUILD
@@ -117,6 +117,11 @@ build() {
 	export CFLAGS="${CFLAGS/-Os/-O2}"
 	export CPPFLAGS="${CPPFLAGS/-Os/-O2}"
 
+	# when disable-spinlocks is no longer required - check postgresql-bdr package
+	case $CARCH in
+		riscv64) local _configure=--disable-spinlocks;;
+	esac
+
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
@@ -132,7 +137,8 @@ build() {
 		--with-perl \
 		--with-python \
 		--with-icu \
-		--with-tcl
+		--with-tcl \
+		$_configure
 	make world
 }