diff --git a/community/ocaml/APKBUILD b/community/ocaml/APKBUILD
index a5f925e74ede9bdf73cc3fb696293c7578b1f181..fd8932ca7eee038188becba51762425530293165 100644
--- a/community/ocaml/APKBUILD
+++ b/community/ocaml/APKBUILD
@@ -2,13 +2,12 @@
 # Contributor: Jakub Jirutka <jakub@jirutka.cz>
 # Maintainer: omni <omni+alpine@hack.org>
 pkgname=ocaml
-pkgver=4.12.0
+pkgver=4.13.0
 pkgrel=0
 pkgdesc="Main implementation of the Caml programming language"
 url="https://ocaml.org/"
-# riscv64: make[4]: *** [Makefile:181: dynlink_compilerlibs/binutils.cmo] Segmentation fault
 # mips64: "native-code compiler is not supported"
-arch="all !mips64 !riscv64"
+arch="all !mips64"
 license="LGPL-2.1-or-later-WITH-linking-exception"
 depends="$pkgname-runtime=$pkgver-r$pkgrel gcc"
 makedepends="gdbm-dev libc-dev ncurses-dev zlib-dev binutils-dev"
@@ -20,8 +19,7 @@ subpackages="
 	$pkgname-runtime
 	"
 source="https://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/ocaml-$pkgver.tar.gz
-	fix-configure-musl.patch
-	"
+	fix-configure-musl.patch"
 
 # 32bit archs
 case "$CARCH" in
@@ -113,5 +111,5 @@ _submv() {
 	rmdir -p "$pkgdir"/${path%/*} 2>/dev/null || true
 }
 
-sha512sums="7c9e4ebe9c6e3f04eca9b837b70f3dcfda7d81d033f4fb6d0c507cd40c82115c0dde0907444f60c406a301fafe1a48d0bca01ee6af192fd08458d3b1bee7f717  ocaml-4.12.0.tar.gz
-444092ae137e290d459656dc56b36397572508e2dc59684446fb65ef37e467fc8ccb06e9d1f344cdb595854ffed0b8060dc969bfa477a26c297fee4a67727dda  fix-configure-musl.patch"
+sha512sums="82d9b460377eece356f541cb1ae98d02ced77801ce3a7fdb10360449d95d6a32e54977784a5b7f0786234115b52e0fe5f75396055a941b27c3ca31a3a204b989  ocaml-4.13.0.tar.gz
+4d24bedee7f85df0b04a0d60f7a1d2d76763eeaccfa87c31eb03903d14261f5423c513643b5b7c200e221e9fd2a4ba635c3c117fea17732d07e941376b5bf44e  fix-configure-musl.patch"
diff --git a/community/ocaml/fix-configure-musl.patch b/community/ocaml/fix-configure-musl.patch
index f1f0cc942883551a709b198d0771fe920773b227..44f56401527193de9952f6f62ec557727b09c179 100644
--- a/community/ocaml/fix-configure-musl.patch
+++ b/community/ocaml/fix-configure-musl.patch
@@ -1,51 +1,6 @@
 --- a/configure	2021-02-24 13:49:29.000000000 +0000
-+++ b/configure	2021-02-25 17:08:37.549751090 +0000
-@@ -13878,19 +13878,19 @@ else
- fi; system=elf ;; #(
-   s390x*-*-linux*) :
-     arch=s390x; model=z10; system=elf ;; #(
--  armv6*-*-linux-gnueabihf) :
-+  armv6*-*-linux-*eabihf) :
-     arch=arm; model=armv6; system=linux_eabihf ;; #(
--  armv7*-*-linux-gnueabihf) :
-+  armv7*-*-linux-*eabihf) :
-     arch=arm; model=armv7; system=linux_eabihf ;; #(
--  armv8*-*-linux-gnueabihf) :
-+  armv8*-*-linux-*eabihf) :
-     arch=arm; model=armv8; system=linux_eabihf ;; #(
--  armv8*-*-linux-gnueabi) :
-+  armv8*-*-linux-*eabi) :
-     arch=arm; model=armv8; system=linux_eabi ;; #(
--  armv7*-*-linux-gnueabi) :
-+  armv7*-*-linux-*eabi) :
-     arch=arm; model=armv7; system=linux_eabi ;; #(
--  armv6t2*-*-linux-gnueabi) :
-+  armv6t2*-*-linux-*eabi) :
-     arch=arm; model=armv6t2; system=linux_eabi ;; #(
--  armv6*-*-linux-gnueabi) :
-+  armv6*-*-linux-*eabi) :
-     arch=arm; model=armv6; system=linux_eabi ;; #(
-   armv6*-*-freebsd*) :
-     arch=arm; model=armv6; system=freebsd ;; #(
-@@ -13898,13 +13898,13 @@ fi; system=elf ;; #(
-     arch=arm; model=armv6; system=netbsd ;; #(
-   earmv7*-*-netbsd*) :
-     arch=arm; model=armv7; system=netbsd ;; #(
--  armv5te*-*-linux-gnueabi) :
-+  armv5te*-*-linux-*eabi) :
-     arch=arm; model=armv5te; system=linux_eabi ;; #(
--  armv5*-*-linux-gnueabi) :
-+  armv5*-*-linux-*eabi) :
-     arch=arm; model=armv5; system=linux_eabi ;; #(
--  arm*-*-linux-gnueabihf) :
-+  arm*-*-linux-*eabihf) :
-     arch=arm; system=linux_eabihf ;; #(
--  arm*-*-linux-gnueabi) :
-+  arm*-*-linux-*eabi) :
-     arch=arm; system=linux_eabi ;; #(
-   arm*-*-openbsd*) :
-     arch=arm; system=bsd ;; #(
-@@ -14100,16 +14100,22 @@ fi
++++ b/configure	2021-09-25 17:08:37.549751090 +0000
+@@ -14487,17 +14487,23 @@ fi
  # e.g. Ubuntu >= 17.10 for i386, which uses the glibc dynamic loader.
  
  case $arch in #(
@@ -55,23 +10,24 @@
 -     ;; #(
 +    ;; #(
    *) :
--    case $host in #(
--  *-linux-musl) :
+     case $host in #(
+-  # expected to match "*-linux-musl" as well as "*-linux-musleabi*"
+-    *-linux-musl*) :
 -    # Alpine and other musl-based Linux distributions
 -       common_cflags="-no-pie $common_cflags" ;; #(
 -  *) :
 -     ;;
-+  case $host in #(
-+    i?86-*-linux-musl*) :
-+      # Alpine and other musl-based Linux distributions, 32bit x86,
-+      # disable DT_TEXTREL, see https://github.com/ocaml/ocaml/issues/9800
-+      common_cflags="-Wl,-z,notext -no-pie $common_cflags"
-+      mksharedlib="$mksharedlib -Wl,-z,notext"
-+      mkmaindll="$mkmaindll -Wl,-z,notext";; #(
-+    *-linux-musl*) :
-+      # Alpine and other musl-based Linux distributions
-+      common_cflags="-no-pie $common_cflags" ;; #(
-+    *) :
++      i?86-*-linux-musl*) :
++        # Alpine and other musl-based Linux distributions, 32bit x86,
++        # disable DT_TEXTREL, see https://github.com/ocaml/ocaml/issues/9800
++        common_cflags="-Wl,-z,notext -no-pie $common_cflags"
++        mksharedlib="$mksharedlib -Wl,-z,notext"
++        mkmaindll="$mkmaindll -Wl,-z,notext";; #(
++      # expected to match "*-linux-musl" as well as "*-linux-musleabi*"
++      *-linux-musl*) :
++        # Alpine and other musl-based Linux distributions
++        common_cflags="-no-pie $common_cflags" ;; #(
++      *) :
 +      ;;
  esac ;;
  esac