Skip to content

Commit dbd764b

Browse files
authored
Zstd: New version 1.5.7 (#10577)
* Zstd: New version 1.5.7 * Zstd: Add musl work-around
1 parent a1de761 commit dbd764b

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

Z/Zstd/build_tarballs.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
using BinaryBuilder
22

33
name = "Zstd"
4-
upstream_version = v"1.5.6"
5-
version = v"1.5.7" # need to change version to change compat bounds, but in the future we can go back to follow upstream
4+
version = v"1.5.7"
65

76
sources = [
8-
ArchiveSource("https://github.com/facebook/zstd/releases/download/v$(upstream_version)/zstd-$(upstream_version).tar.gz",
9-
"8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1"),
7+
ArchiveSource("https://github.com/facebook/zstd/releases/download/v$(version)/zstd-$(version).tar.gz",
8+
"eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3"),
9+
DirectorySource("bundled"),
1010
]
1111

1212
script = raw"""
1313
cd ${WORKSPACE}/srcdir/zstd-*
14+
15+
# zstd uses `qsort_r` which is not available from musl <https://github.com/facebook/zstd/issues/4311>.
16+
atomic_patch -p1 $WORKSPACE/srcdir/patches/qsort_r.patch
17+
1418
mkdir build-zstd && cd build-zstd
1519
1620
if [[ "${target}" == *86*-linux-gnu ]]; then
1721
# Using `clock_gettime` on old Glibc requires linking to `librt`.
1822
sed -ri "s/^c_link_args = \[(.*)\]/c_link_args = [\1, '-lrt']/" ${MESON_TARGET_TOOLCHAIN}
23+
elif [[ "${target}" == *musl* ]]; then
24+
# Define `__MUSL__` for the patch `qsort_r.patch`
25+
sed -ri "s/^c_args = \[(.*)\]/c_args = [\1, '-D__MUSL__']/" ${MESON_TARGET_TOOLCHAIN}
1926
elif [[ "${target}" == i686-*-mingw* ]]; then
2027
# Using `WakeConditionVariable`/`InitializeConditionVariable`/`SleepConditionVariableCS`
2128
# require Windows Vista:
@@ -46,5 +53,3 @@ dependencies = Dependency[]
4653

4754
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
4855
clang_use_lld=false, julia_compat="1.6")
49-
50-
# Build Trigger: 2
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/lib/common/zstd_deps.h b/lib/common/zstd_deps.h
2+
index 8a9c7cc5..c6cb2aea 100644
3+
--- a/lib/common/zstd_deps.h
4+
+++ b/lib/common/zstd_deps.h
5+
@@ -31,7 +31,7 @@
6+
*/
7+
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
8+
defined(__CYGWIN__) || defined(__MSYS__)
9+
-#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
10+
+#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) && !defined(__MUSL__) /* NDK and musl don't ship qsort_r(). */
11+
#define _GNU_SOURCE
12+
#endif
13+
#endif
14+
diff --git a/lib/dictBuilder/cover.c b/lib/dictBuilder/cover.c
15+
index 2ef33c73..39e3a972 100644
16+
--- a/lib/dictBuilder/cover.c
17+
+++ b/lib/dictBuilder/cover.c
18+
@@ -24,7 +24,7 @@
19+
/* qsort_r is an extension. */
20+
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
21+
defined(__CYGWIN__) || defined(__MSYS__)
22+
-#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
23+
+#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) && !defined(__MUSL__) /* NDK and musl don't ship qsort_r(). */
24+
#define _GNU_SOURCE
25+
#endif
26+
#endif

0 commit comments

Comments
 (0)