8.6. zstd stage 2 1.5.7

Build and install zstd in the final target environment so zstd compression libraries and tools are available to later packages.

Input assumption: zstd-1.5.7.tar.gz is already present in /sources from the chapter 4 source staging step.

Source URL: https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz

Upstream build note: upstream documents GNU make as the maintained build system and supports staged install variables such as PREFIX, BINDIR, LIBDIR, INCLUDEDIR, and PKGCONFIGDIR.

Licenses:

Dependencies:

zstd is a lossless compression library and command-line tool. we need it to provide libzstd and the zstd utilities used by LLVM and other target packages.

Extract and Enter the Source Tree

cd /sources
rm -rf zstd-1.5.7
tar -xf zstd-1.5.7.tar.gz
cd zstd-1.5.7

Build zstd

CC=clang \
CFLAGS="$LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS" \
make $LWI_MAKE_FLAGS

Install zstd

CC=clang \
CFLAGS="$LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS" \
make install \
    PREFIX=/system \
    BINDIR=/system/binaries \
    LIBDIR=/system/libraries \
    INCLUDEDIR=/system/headers \
    MANDIR=/system/documentation/man-pages \
    PKGCONFIGDIR=/system/libraries/pkgconfig

Verify zstd

zstd --version
ls /system/binaries/zstd

Command Explanations