Skip to content

Commit

Permalink
[Zstd] Use meson to configure the build
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed May 1, 2020
1 parent a68d009 commit 2715862
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions Z/Zstd/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@ name = "Zstd"
version = v"1.4.4"

sources = [
"https://github.com/facebook/zstd/releases/download/v$version/zstd-$version.tar.gz" =>
"59ef70ebb757ffe74a7b3fe9c305e2ba3350021a918d168a046c6300aeea9315",
"./bundled"
ArchiveSource("https://github.com/facebook/zstd/releases/download/v$version/zstd-$version.tar.gz",
"59ef70ebb757ffe74a7b3fe9c305e2ba3350021a918d168a046c6300aeea9315"),
DirectorySource("./bundled"),
]

script = raw"""
cd ${WORKSPACE}/srcdir/zstd-*/
atomic_patch -p1 ../patches/timefn_h_windows.patch
mkdir build-zstd && cd build-zstd
if [[ "${target}" == aarch64-linux-gnu ]]; then
if [[ "${target}" == i686-linux-musl ]]; then
# We can't run executables for i686-linux-musl in the BB environment
sed -i "s/needs_exe_wrapper = false/needs_exe_wrapper = true/" "${MESON_TARGET_TOOLCHAIN}"
elif [[ "${target}" == aarch64-linux-gnu ]]; then
# Work around https://github.com/facebook/zstd/issues/1872
export CFLAGS=-D_POSIX_C_SOURCE
#
# ../programs/util.c:76:29: error: ‘stat_t’ has no member named ‘st_mtim’
# timebuf[1] = statbuf->st_mtim;
# ^
sed -i "s/c_args = \[\]/c_args = ['-D_POSIX_C_SOURCE']/" "${MESON_TARGET_TOOLCHAIN}"
fi
cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release ../build/cmake/
make -j${nproc}
make install
meson --cross-file="${MESON_TARGET_TOOLCHAIN}" ../build/meson/
ninja -j${nproc}
ninja install
"""

platforms = supported_platforms()
Expand All @@ -30,6 +37,6 @@ products = [
ExecutableProduct("zstdmt", :zstdmt),
]

dependencies = []
dependencies = Dependency[]

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

0 comments on commit 2715862

Please sign in to comment.