hdrhistogram_c: apply patch (conditionally) to fix build on i686

This commit is contained in:
K900
2026-07-17 15:52:19 +03:00
parent 74f42ce3d8
commit 824fee2a9a
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
diff --git a/src/hdr_histogram.c b/src/hdr_histogram.c
index b2041f8..a5dd8d7 100644
--- a/src/hdr_histogram.c
+++ b/src/hdr_histogram.c
@@ -36,7 +36,7 @@
/* Runtime-dispatched AVX2 path: keep the rest of this TU at the project's
baseline ISA so the shipped binary does not silently require AVX2. */
-#if (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)) \
+#if (defined(__x86_64__) || defined(_M_X64)) \
&& (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
# define HDR_HAS_AVX2_DISPATCH 1
# include <immintrin.h>

View File

@@ -20,6 +20,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-LMZj7vuxOA1bgU/J10IKnyNe3R0dk2AA1ydLTHun4vg=";
};
# Fix build on i686 by not trying to build AVX2 code
# Submitted upstream: https://github.com/HdrHistogram/HdrHistogram_c/pull/143
${if stdenv.hostPlatform.isi686 then "patches" else null} = [
./no-avx2-i386.patch
];
buildInputs = [ zlib ];
nativeBuildInputs = [
cmake