Skip to content

Commit e8fd7b1

Browse files
committed
ci msys2: Add mruby patch for Windows ARM64 support
Add a patch to fix mruby build issues on Windows ARM64 environments. The patch modifies mruby's `throw.h` to avoid using `__builtin_setjmp` and `__builtin_longjmp` on ARM64, which are not supported. This is a temporary workaround as the issue has already been resolved upstream: mruby/mruby#6637. The patch can be removed once mruby is updated to a version that includes the upstream fix.
1 parent f0a9d6c commit e8fd7b1

2 files changed

Lines changed: 46 additions & 3 deletions

File tree

‎ci/msys2/001-aarch64.patch‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff -bur groonga-15.0.4-o/vendor/mruby-include/mruby/throw.h groonga-15.0.4/vendor/mruby-include/mruby/throw.h
2+
--- groonga-15.0.4-o/vendor/mruby-include/mruby/throw.h 2025-04-18 02:46:03.161275800 -0600
3+
+++ groonga-15.0.4/vendor/mruby-include/mruby/throw.h 2025-04-18 02:46:12.701092800 -0600
4+
@@ -33,7 +33,7 @@
5+
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
6+
#define MRB_SETJMP _setjmp
7+
#define MRB_LONGJMP _longjmp
8+
-#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4
9+
+#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4 && !defined(_M_ARM64)
10+
#define MRB_SETJMP __builtin_setjmp
11+
#define MRB_LONGJMP __builtin_longjmp
12+
#else
13+
diff -bur groonga-15.0.4-o/vendor/mruby-source/include/mruby/throw.h groonga-15.0.4/vendor/mruby-source/include/mruby/throw.h
14+
--- groonga-15.0.4-o/vendor/mruby-source/include/mruby/throw.h 2025-04-18 02:46:03.161275800 -0600
15+
+++ groonga-15.0.4/vendor/mruby-source/include/mruby/throw.h 2025-04-18 02:46:12.701092800 -0600
16+
@@ -33,7 +33,7 @@
17+
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
18+
#define MRB_SETJMP _setjmp
19+
#define MRB_LONGJMP _longjmp
20+
-#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4
21+
+#elif defined(__MINGW64__) && defined(__GNUC__) && __GNUC__ >= 4 && !defined(_M_ARM64)
22+
#define MRB_SETJMP __builtin_setjmp
23+
#define MRB_LONGJMP __builtin_longjmp
24+
#else

‎ci/msys2/PKGBUILD‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ pkgver=
77
pkgrel=1
88
pkgdesc="An opensource fulltext search engine (mingw-w64)"
99
arch=('any')
10-
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
10+
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
1111
url="https://groonga.org/"
1212
license=('LGPL2')
1313
options=('strip' 'staticlibs')
14-
source=(${_realname}-${pkgver}.tar.gz)
14+
source=(${_realname}-${pkgver}.tar.gz
15+
001-aarch64.patch)
1516
depends=("${MINGW_PACKAGE_PREFIX}-arrow"
1617
"${MINGW_PACKAGE_PREFIX}-blosc2"
1718
"${MINGW_PACKAGE_PREFIX}-lz4"
@@ -29,9 +30,27 @@ makedepends=("git"
2930
"${MINGW_PACKAGE_PREFIX}-rapidjson"
3031
"${MINGW_PACKAGE_PREFIX}-ruby"
3132
"${MINGW_PACKAGE_PREFIX}-xsimd")
32-
sha256sums=('SKIP')
33+
sha256sums=('SKIP'
34+
'SKIP')
3335
validpgpkeys=('2701F317CFCCCB975CADE9C2624CF77434839225') # Groonga Key <[email protected]>
3436

37+
apply_patch_with_msg() {
38+
for _patch in "$@"
39+
do
40+
msg2 "Applying ${_patch}"
41+
patch -Nbp1 -i "${srcdir}/${_patch}"
42+
done
43+
}
44+
45+
prepare() {
46+
cd "${_realname}-${pkgver}"
47+
48+
# TODO: Remove this patch after updating mruby to a version that supports Windows ARM64
49+
# This issue has already been resolved upstream: https://github.com/mruby/mruby/issues/6637
50+
apply_patch_with_msg \
51+
001-aarch64.patch
52+
}
53+
3554
build() {
3655
[[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH}
3756
mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}

0 commit comments

Comments
 (0)