@@ -15,16 +15,20 @@ tar -xf zstd-${ZSTD_VERSION}.tar.gz
1515pushd cpython-source-deps-zstd-${ZSTD_VERSION} /lib
1616
1717if [ " ${CC} " = " musl-clang" ]; then
18- # In order to build the library with SSE2, BMI, and AVX2 intrinstics , we need musl-clang to find
18+ # In order to build the library with intrinsics , we need musl-clang to find
1919 # headers that provide access to the intrinsics, as they are not provided by musl. These are
2020 # part of the include files that are part of clang. But musl-clang eliminates them from the
2121 # default include path. So copy them into place.
22- for h in ${TOOLS_PATH} /${TOOLCHAIN} /lib/clang/* /include/* intrin.h ${TOOLS_PATH} /${TOOLCHAIN} /lib/clang/* /include/{__wmmintrin_aes.h,__wmmintrin_pclmul.h,emmintrin.h,immintrin.h,mm_malloc.h}; do
22+ for h in ${TOOLS_PATH} /${TOOLCHAIN} /lib/clang/* /include/* intrin.h ${TOOLS_PATH} /${TOOLCHAIN} /lib/clang/* /include/{__wmmintrin_aes.h,__wmmintrin_pclmul.h,emmintrin.h,immintrin.h,mm_malloc.h,arm_neon.h,arm_neon_sve_bridge.h,arm_bf16.h,arm_fp16.h,arm_acle.h,arm_vector_types.h }; do
2323 filename=$( basename " $h " )
24- if [ -e " ${TOOLS_PATH} /host/include/${filename} " ]; then
25- echo " warning: ${filename} already exists"
24+ if [ -f " $h " ]; then
25+ if [ -e " ${TOOLS_PATH} /host/include/${filename} " ]; then
26+ echo " warning: ${filename} already exists"
27+ fi
28+ cp " $h " ${TOOLS_PATH} /host/include/
29+ else
30+ echo " warning: ${filename} not found (skipping)"
2631 fi
27- cp " $h " ${TOOLS_PATH} /host/include/
2832 done
2933 EXTRA_TARGET_CFLAGS=" ${EXTRA_TARGET_CFLAGS} -I${TOOLS_PATH} /host/include/"
3034
@@ -33,7 +37,7 @@ if [ "${CC}" = "musl-clang" ]; then
3337 # `qsort_r` is actually available so we patch it to include a check for glibc.
3438 patch -p1 << EOF
3539diff --git a/dictBuilder/cover.c b/dictBuilder/cover.c
36- index 5e6e8bc..6ca72a1 100644
40+ index 2ef33c7..078e2ee 100644
3741--- a/dictBuilder/cover.c
3842+++ b/dictBuilder/cover.c
3943@@ -241,7 +241,7 @@ typedef struct {
@@ -45,6 +49,24 @@ index 5e6e8bc..6ca72a1 100644
4549 /* C90 only offers qsort() that needs a global context. */
4650 static COVER_ctx_t *g_coverCtx = NULL;
4751 #endif
52+ @@ -290,7 +290,7 @@ static int COVER_cmp8(COVER_ctx_t *ctx, const void *lp, const void *rp) {
53+ */
54+ #if (defined(_WIN32) && defined(_MSC_VER)) || defined(__APPLE__)
55+ static int WIN_CDECL COVER_strict_cmp(void* g_coverCtx, const void* lp, const void* rp) {
56+ -#elif defined(_GNU_SOURCE)
57+ +#elif defined(_GNU_SOURCE) && defined(__GLIBC__)
58+ static int COVER_strict_cmp(const void *lp, const void *rp, void *g_coverCtx) {
59+ #else /* C90 fallback.*/
60+ static int COVER_strict_cmp(const void *lp, const void *rp) {
61+ @@ -306,7 +306,7 @@ static int COVER_strict_cmp(const void *lp, const void *rp) {
62+ */
63+ #if (defined(_WIN32) && defined(_MSC_VER)) || defined(__APPLE__)
64+ static int WIN_CDECL COVER_strict_cmp8(void* g_coverCtx, const void* lp, const void* rp) {
65+ -#elif defined(_GNU_SOURCE)
66+ +#elif defined(_GNU_SOURCE) && defined(__GLIBC__)
67+ static int COVER_strict_cmp8(const void *lp, const void *rp, void *g_coverCtx) {
68+ #else /* C90 fallback.*/
69+ static int COVER_strict_cmp8(const void *lp, const void *rp) {
4870@@ -328,7 +328,7 @@ static void stableSort(COVER_ctx_t *ctx) {
4971 qsort_r(ctx->suffix, ctx->suffixSize, sizeof(U32),
5072 ctx,
0 commit comments