diff --git a/community/ossec-hids-agent/APKBUILD b/community/ossec-hids-agent/APKBUILD
index d973ac1d0d2eca5850661fa95da888b623ab17a6..4b148910988761e622782d1711b9757b54670dbb 100644
--- a/community/ossec-hids-agent/APKBUILD
+++ b/community/ossec-hids-agent/APKBUILD
@@ -26,12 +26,14 @@ builddir="$srcdir"/ossec-hids-$pkgver
 
 export CFLAGS="$CFLAGS -fcommon"
 
-prepare() {
-	default_prepare
-	export _make_args="V=1 USER_INSTALL_TYPE=$_target USER_NO_STOP=yes \
-		USER_DIR=/var/ossec USER_BINARYINSTALL=x USE_GEOIP=yes USE_ZEROMQ=yes \
-		LUA_ENABLE=yes USE_INOTIFY=yes PCRE2_SYSTEM=yes USE_SYSTEMD=no"
-}
+export _make_args="V=1 USER_INSTALL_TYPE=$_target USER_NO_STOP=yes \
+	USER_DIR=/var/ossec USER_BINARYINSTALL=x USE_GEOIP=yes USE_ZEROMQ=yes \
+	LUA_ENABLE=yes USE_INOTIFY=yes PCRE2_SYSTEM=yes USE_SYSTEMD=no"
+
+# loonarch64 does not support pcre2-jit
+case $CARCH in
+        loongarch64) _make_args="$_make_args USE_PCRE2_JIT=n"
+esac
 
 build() {
 	cd "$builddir"/src
@@ -78,6 +80,6 @@ sha512sums="
 ba76ae4e36158fda4359365733852ba43c71307dd42f957237b30680193f1a2d4f0704047f842075b2c720cd166550ea9531ded0fa5aceb1bc3fb9c227bae4aa  ossec-hids-agent-3.7.0.tar.gz
 6cdf4852feabfdd043405e2570bb9a3013eb11c1865e9178fb67a019717d44fb0fedba05ab74c4334a1bae0a0c45912213dd7d6c7e1eab31853d40beea7596a0  ossec-hids-agent.logrotate
 4e076581cc3977c527f30da6c43552db18bc35ea7b745c1504f4d15ebfbcef42c9604804af28fc90744a85f847a0f0c5bf991476cae71e3d860adb7cfa33a63b  musl_lack_of_a_out_h.patch
-27ccd8197541693c6cfa85e1598b40a5bd2dbd1dec2b7bd057211b45fd0c14c42c2ddd01d9ac57491eda93bb318961642d3adce55b395351d530609250ca003f  makefile.patch
+dc41b348f5f5467a8fc2018042b45824e98d393ae0c6632ac0c3022324dfd51f827c0a4ea4d6e201242e1a67769feae421070884a26c145d5a0e4cbde7dbcd47  makefile.patch
 5213936052ed3adf8d9bb36d044386e2decf85ad59e7d5a69b4b73c708ea779dc03049c3429e9b658efceb347b950b0192ca4f66bb56a3101c2016f106dcc287  config
 "
diff --git a/community/ossec-hids-agent/makefile.patch b/community/ossec-hids-agent/makefile.patch
index e3f15a6b9628b4cb03e0732c2fead513d05dbe8f..d57202c8517e7c119c7d651b16f2c6932a7757f6 100644
--- a/community/ossec-hids-agent/makefile.patch
+++ b/community/ossec-hids-agent/makefile.patch
@@ -2,7 +2,7 @@ diff --git a/src/Makefile b/src/Makefile
 index 1a3c9bd..b2ddfb1 100644
 --- a/src/Makefile
 +++ b/src/Makefile
-@@ -22,13 +22,13 @@ OSSEC_USER_MAIL?=ossecm
+@@ -22,14 +22,14 @@ OSSEC_USER_MAIL?=ossecm
  OSSEC_USER_REM?=ossecr
  
  INSTALL_CMD?=install -m $(1) -o $(2) -g $(3)
@@ -15,8 +15,10 @@ index 1a3c9bd..b2ddfb1 100644
  USE_ZEROMQ?=no
  USE_GEOIP?=no
 -USE_INOTIFY=no
+-USE_PCRE2_JIT=yes
 +USE_INOTIFY=yes
- USE_PCRE2_JIT=yes
++USE_PCRE2_JIT=?yes
+ USE_SYSTEMD?=yes
  
  ifneq (${TARGET},winagent)
 @@ -399,7 +399,6 @@ install-hybrid: install-server-generic
diff --git a/community/ossec-hids-server/APKBUILD b/community/ossec-hids-server/APKBUILD
index 2c7b76aa3ec09b7b590fe553446d363467a86185..3824a74ff38ed9d6ad22d3eca7aa0638ef29a529 100644
--- a/community/ossec-hids-server/APKBUILD
+++ b/community/ossec-hids-server/APKBUILD
@@ -23,6 +23,9 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/ossec/ossec-hids/archive/$pk
 	config"
 builddir="$srcdir"/ossec-hids-$pkgver
 
+case $CARCH in
+	loongarch64) _make_args="$_make_args USE_PCRE2_JIT=n"
+esac
 prepare() {
 	default_prepare
 	export V=1
@@ -39,6 +42,7 @@ prepare() {
 	export PCRE2_SYSTEM=yes
 	export USE_SYSTEMD=no
 	export CFLAGS="$CFLAGS -fcommon"
+
 }
 
 build() {
@@ -86,6 +90,6 @@ sha512sums="
 ba76ae4e36158fda4359365733852ba43c71307dd42f957237b30680193f1a2d4f0704047f842075b2c720cd166550ea9531ded0fa5aceb1bc3fb9c227bae4aa  ossec-hids-server-3.7.0.tar.gz
 6cdf4852feabfdd043405e2570bb9a3013eb11c1865e9178fb67a019717d44fb0fedba05ab74c4334a1bae0a0c45912213dd7d6c7e1eab31853d40beea7596a0  ossec-hids-server.logrotate
 4e076581cc3977c527f30da6c43552db18bc35ea7b745c1504f4d15ebfbcef42c9604804af28fc90744a85f847a0f0c5bf991476cae71e3d860adb7cfa33a63b  musl_lack_of_a_out_h.patch
-27ccd8197541693c6cfa85e1598b40a5bd2dbd1dec2b7bd057211b45fd0c14c42c2ddd01d9ac57491eda93bb318961642d3adce55b395351d530609250ca003f  makefile.patch
+dc41b348f5f5467a8fc2018042b45824e98d393ae0c6632ac0c3022324dfd51f827c0a4ea4d6e201242e1a67769feae421070884a26c145d5a0e4cbde7dbcd47  makefile.patch
 5213936052ed3adf8d9bb36d044386e2decf85ad59e7d5a69b4b73c708ea779dc03049c3429e9b658efceb347b950b0192ca4f66bb56a3101c2016f106dcc287  config
 "
diff --git a/community/ossec-hids-server/makefile.patch b/community/ossec-hids-server/makefile.patch
index e3f15a6b9628b4cb03e0732c2fead513d05dbe8f..d57202c8517e7c119c7d651b16f2c6932a7757f6 100644
--- a/community/ossec-hids-server/makefile.patch
+++ b/community/ossec-hids-server/makefile.patch
@@ -2,7 +2,7 @@ diff --git a/src/Makefile b/src/Makefile
 index 1a3c9bd..b2ddfb1 100644
 --- a/src/Makefile
 +++ b/src/Makefile
-@@ -22,13 +22,13 @@ OSSEC_USER_MAIL?=ossecm
+@@ -22,14 +22,14 @@ OSSEC_USER_MAIL?=ossecm
  OSSEC_USER_REM?=ossecr
  
  INSTALL_CMD?=install -m $(1) -o $(2) -g $(3)
@@ -15,8 +15,10 @@ index 1a3c9bd..b2ddfb1 100644
  USE_ZEROMQ?=no
  USE_GEOIP?=no
 -USE_INOTIFY=no
+-USE_PCRE2_JIT=yes
 +USE_INOTIFY=yes
- USE_PCRE2_JIT=yes
++USE_PCRE2_JIT=?yes
+ USE_SYSTEMD?=yes
  
  ifneq (${TARGET},winagent)
 @@ -399,7 +399,6 @@ install-hybrid: install-server-generic