Lz4 is a lossless compression algorithm, providing compression
speed greater than 500 MB/s per core. It features an extremely fast
decoder, with speed in multiple GB/s per core. Lz4 can work with
Zstandard to allow both algorithms to compress data faster.
Approximate build time:
0.1 SBU
Required disk space:
4.2 MB
8.11.1. Installation of Lz4
Create the PKGBUILD for the Lz4 package with the following
commands:
mkdir /sources/lz4
cd /sources/lz4
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="lz4"
pkgver="1.10.0"
pkgrel="1"
pkgdesc="Lz4 is a lossless compression algorithm, providing compression speed greater than 500 MB/s per core."
arch=('x86'
'x86_64')
url="https://lz4.org/"
groups=('core')
license=('BSD3C'
'custom')
groups=('core')
depends=('glibc')
makedepends=('bash'
'binutils'
'coreutils'
'gcc'
'make')
checkdepends=('python')
source=('https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz')
md5sums=('dead9f5f1966d9ae56e1e32761e4e675')
build() {
cd "${pkgname}-${pkgver}"
make BUILD_STATIC=no PREFIX=/usr
}
check() {
cd "${pkgname}-${pkgver}"
make -j1 check
}
package() {
cd "${pkgname}-${pkgver}"
make BUILD_STATIC=no PREFIX=/usr DESTDIR="${pkgdir}" install
}
REALEOF
Prepare the build directory for the pacman user and build the
package:
chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'
Add the newly created package to the central package repository:
cp lz4-1.10.0-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/lz4-1.10.0-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Lz4 package:
pacman -Syu
pacman -S lz4 --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/lz4
cp PKGBUILD /srv/pacman/source/LFS/lz4
cd /sources
rm -rf lz4