Skip to content

Commit 1f8434e

Browse files
authored
m4ri: update to 20251206 (#26746)
* m4ri: update to 20251206 * m4ri: revert problematic code on CLANGARM64 environment
1 parent 01ba927 commit 1f8434e

File tree

2 files changed

+171
-13
lines changed

2 files changed

+171
-13
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
diff --git a/m4/ax_cache_size.m4 b/m4/ax_cache_size.m4
2+
index 72754bb..a11344a 100644
3+
--- a/m4/ax_cache_size.m4
4+
+++ b/m4/ax_cache_size.m4
5+
@@ -41,8 +41,9 @@ AC_DEFUN([AX_CACHE_SIZE],
6+
7+
ax_l1_size=
8+
ax_l2_size=
9+
+ ax_l3_size=
10+
11+
- #Check if the variable is present
12+
+ # Linux sysfs path
13+
if test -e /sys/devices/system/cpu/cpu0/cache/index0/size; then
14+
for idx in `seq 0 3`; do
15+
if test -e /sys/devices/system/cpu/cpu0/cache/index$idx/size ; then
16+
@@ -57,63 +58,78 @@ AC_DEFUN([AX_CACHE_SIZE],
17+
ax_l3_size=$CPU0_L3_CACHE
18+
19+
else
20+
- if test "x$ax_cv_cpu_vendor" != "xUnknown"; then
21+
- #Or use CPUID
22+
- AX_GCC_X86_CPUID(0x80000000)
23+
- cpu_exthigh=`echo $ax_cv_gcc_x86_cpuid_0x80000000 | cut -d ":" -f 1`
24+
- if test "x$cpu_exthi" \> "x80000004"; then
25+
- AX_GCC_X86_CPUID(0x80000005) # For L1 cache
26+
- l1_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000005 | cut -d ":" -f 4`
27+
- ax_l1_size=$((0x$l1_hexval >> 24))
28+
- fi
29+
+ # Try CPUID (mostly for Linux without sysfs or during cross-compilation)
30+
+ if test "x$ax_cv_cpu_vendor" != "xIntel"; then
31+
+ AX_GCC_X86_CPUID(0x80000000)
32+
+ cpu_exthigh=`echo $ax_cv_gcc_x86_cpuid_0x80000000 | cut -d ":" -f 1`
33+
+ if test "x$cpu_exthigh" \> "x80000004"; then
34+
+ AX_GCC_X86_CPUID(0x80000005)
35+
+ l1_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000005 | cut -d ":" -f 4`
36+
+ ax_l1_size=$((0x$l1_hexval >> 24))
37+
+ fi
38+
+
39+
+ if test "x$cpu_exthigh" \> "x80000005"; then
40+
+ AX_GCC_X86_CPUID(0x80000006)
41+
+ l2_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000006 | cut -d ":" -f 3`
42+
+ ax_l2_size=$((0x$l2_hexval >> 16))
43+
44+
- if test "x$cpu_exthi" \> "x80000005"; then
45+
- AX_GCC_X86_CPUID(0x80000006) # For L2 cache
46+
- l2_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000006 | cut -d ":" -f 3`
47+
- ax_l2_size=$((0x$l2_hexval >> 16))
48+
+ # L3 info in EDX (bits 31:18) → 512-byte blocks (AMD only)
49+
+ l3_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000006 | cut -d ":" -f 4`
50+
+ ax_l3_size=$(( (0x$l3_hexval >> 18) * 512 ))
51+
+ fi
52+
fi
53+
54+
- if test "x$cpu_exthi" \> "x80000005"; then
55+
- AX_GCC_X86_CPUID(0x80000006) # For L3 cache
56+
- l2_hexval=`echo $ax_cv_gcc_x86_cpuid_0x80000006 | cut -d ":" -f 4`
57+
- ax_l2_size=$((0x$l2_hexval >> 18))*512
58+
+ # sysctl fallback
59+
+ sysctl_exe=
60+
+ if test -x /usr/sbin/sysctl; then
61+
+ sysctl_exe=/usr/sbin/sysctl
62+
+ elif test -x /sbin/sysctl; then
63+
+ sysctl_exe=/sbin/sysctl
64+
fi
65+
66+
- fi
67+
-
68+
- #Or use sysctl
69+
- sysctl_exe=
70+
- if test -x /usr/sbin/sysctl ; then
71+
- sysctl_exe=/usr/sbin/sysctl
72+
- elif test -x /sbin/sysctl ; then
73+
- sysctl_exe=/sbin/sysctl
74+
- fi
75+
- if test -n "$sysctl_exe"; then
76+
- if test -z "$ax_l2_size" -o "$ax_l2_size" = "0"; then
77+
- sysctl_out=`$sysctl_exe -n hw.l2cachesize 2>/dev/null`;
78+
- if test ! -z "$sysctl_out"; then
79+
- ax_l2_size=$(($sysctl_out / 1024))
80+
- fi;
81+
-
82+
- fi
83+
- if test -z "$ax_l1_size" -o "$ax_l1_size" = "0" ; then
84+
- sysctl_out=`$sysctl_exe -n hw.l1dcachesize 2>/dev/null`;
85+
- if test ! -z "$sysctl_out"; then
86+
- ax_l1_size=$(($sysctl_out / 1024))
87+
- fi;
88+
- fi
89+
- if test -z "$ax_l1_size" -o "ax_l1_size" = "0" ; then
90+
- sysctl_out=`$sysctl_exe -n hw.l1cachesize 2>/dev/null`;
91+
- if test ! -z "$sysctl_out"; then
92+
- ax_l1_size=$(($sysctl_out / 1024))
93+
- fi;
94+
+ if test -n "$sysctl_exe"; then
95+
+ # L1
96+
+ if test -z "$ax_l1_size" -o "$ax_l1_size" = "0"; then
97+
+ sysctl_out=`$sysctl_exe -n hw.l1dcachesize 2>/dev/null`
98+
+ if test -n "$sysctl_out"; then
99+
+ ax_l1_size=$(($sysctl_out / 1024))
100+
+ fi
101+
+ fi
102+
+ if test -z "$ax_l1_size" -o "$ax_l1_size" = "0"; then
103+
+ sysctl_out=`$sysctl_exe -n hw.l1icachesize 2>/dev/null`
104+
+ if test -n "$sysctl_out"; then
105+
+ ax_l1_size=$(($sysctl_out / 1024))
106+
+ fi
107+
+ fi
108+
+ if test -z "$ax_l1_size" -o "$ax_l1_size" = "0"; then
109+
+ sysctl_out=`$sysctl_exe -n hw.l1cachesize 2>/dev/null`
110+
+ if test -n "$sysctl_out"; then
111+
+ ax_l1_size=$(($sysctl_out / 1024))
112+
+ fi
113+
+ fi
114+
+
115+
+ # L2
116+
+ if test -z "$ax_l2_size" -o "$ax_l2_size" = "0"; then
117+
+ sysctl_out=`$sysctl_exe -n hw.l2cachesize 2>/dev/null`
118+
+ if test -n "$sysctl_out"; then
119+
+ ax_l2_size=$(($sysctl_out / 1024))
120+
+ fi
121+
+ fi
122+
+
123+
+ # L3
124+
+ if test -z "$ax_l3_size" -o "$ax_l3_size" = "0"; then
125+
+ sysctl_out=`$sysctl_exe -n hw.l3cachesize 2>/dev/null`
126+
+ if test -n "$sysctl_out"; then
127+
+ ax_l3_size=$(($sysctl_out / 1024))
128+
+ fi
129+
+ fi
130+
fi
131+
- fi
132+
fi
133+
134+
+ # Final fallbacks
135+
test -z "$ax_l1_size" && ax_l1_size=0
136+
test -z "$ax_l2_size" && ax_l2_size=0
137+
- test -z "$ax_l3_size" && ax_l3_size=$ax_l2_size
138+
+ test -z "$ax_l3_size" && ax_l3_size=0
139+
140+
# Keep only digits if there is a unit (ie 1024K -> 1024) and convert in Bytes
141+
AC_MSG_CHECKING(the L1 cache size)
142+
diff --git a/m4ri/misc.h b/m4ri/misc.h
143+
index 99fd6bb..64c63bd 100644
144+
--- a/m4ri/misc.h
145+
+++ b/m4ri/misc.h
146+
@@ -138,7 +138,7 @@ typedef uint64_t word;
147+
* \brief The number of bits in a word.
148+
*/
149+
150+
-static int const m4ri_radix = 64;
151+
+#define m4ri_radix 64
152+
153+
/**
154+
* \brief The number one as a word.

mingw-w64-m4ri/PKGBUILD

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
_realname=m4ri
44
pkgbase=mingw-w64-${_realname}
55
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
6-
pkgver=20250128.r15.g3c25b8f
6+
pkgver=20251206
77
pkgrel=1
88
_commit=3c25b8fcdb27fd11c2a1e1c5bcd98793bd1b2030
99
pkgdesc="Algorithms for linear algebra over GF_2 (mingw-w64)"
@@ -19,26 +19,30 @@ license=('spdx:GPL-2.0-or-later')
1919
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
2020
"${MINGW_PACKAGE_PREFIX}-libpng")
2121
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
22-
"${MINGW_PACKAGE_PREFIX}-cc"
23-
'git')
24-
source=("git+https://github.com/malb/m4ri#commit=${_commit}")
25-
sha256sums=('9787d2580fe0a408dfa308c1d1eecf04f2c98d1d56e1944de7b5b4e8bf93544d')
26-
27-
pkgver() {
28-
cd "${srcdir}/${_realname}"
29-
git describe --long --tags ${_commit} | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
30-
}
22+
"${MINGW_PACKAGE_PREFIX}-cc")
23+
source=("https://github.com/malb/m4ri/releases/download/${pkgver}/m4ri-${pkgver}.tar.gz"
24+
"0001-upstream-pr-37.diff")
25+
sha256sums=('2b9c1ba4fae834725308ffd3b61862f511c17545009a56c3ba965e0c33c23821'
26+
'4a7afb75f45ee59a510f634fc6570a4cb24be9fa3bd03b33cd82559b637aece8')
3127

3228
prepare() {
33-
cd "${_realname}"
29+
cd "${_realname}-${pkgver}"
30+
31+
# The CPU detection code in version 20251206, added in upstream PR 37 (see
32+
# <https://github.com/malb/m4ri/pull/37>) does not work on ARM64. Therefore,
33+
# it gets reverted here, but only when in the CLANGARM64 environment.
34+
if [[ "${MSYSTEM}" == "CLANGARM64" ]]
35+
then
36+
patch --reverse -p1 -i "${srcdir}/0001-upstream-pr-37.diff"
37+
fi
3438

3539
autoreconf -fiv
3640
}
3741

3842
build() {
3943
mkdir -p "build-${MSYSTEM}" && cd "build-${MSYSTEM}"
4044

41-
../"${_realname}"/configure \
45+
../"${_realname}-${pkgver}"/configure \
4246
--prefix="${MINGW_PREFIX}" \
4347
--build="${MINGW_CHOST}" \
4448
--host="${MINGW_CHOST}" \
@@ -62,5 +66,5 @@ package() {
6266

6367
make install DESTDIR="${pkgdir}"
6468

65-
install -Dm644 "${srcdir}/${_realname}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
69+
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
6670
}

0 commit comments

Comments
 (0)