8.10. Xz-5.6.4

The Xz package contains programs for compressing and decompressing files. It provides capabilities for the lzma and the newer xz compression formats. Compressing text files with xz yields a better compression percentage than with the traditional gzip or bzip2 commands.

Approximate build time: 0.1 SBU
Required disk space: 21 MB

8.10.1. Installation of Xz

Create the PKGBUILD for the Xz package with the following commands:

mkdir /sources/xz
cd /sources/xz
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="xz"
pkgver="5.6.4"
pkgrel="1"
pkgdesc="The Xz package contains programs for compressing and decompressing files. It provides capabilities for the lzma and the newer xz compression formats."
arch=('x86'
      'x86_64')
url="https://tukaani.org/xz"
license=('custom'
         'GPLv2'
         'GPLv3'
         'LGPLv2.1'
         'PD')
groups=('core')
depends=('glibc')
makedepends=('bash'
             'binutils'
             'coreutils'
             'diffutils'
             'gcc'
             'make')
source=('https://github.com//tukaani-project/xz/releases/download/v5.6.4/xz-5.6.4.tar.xz')
md5sums=('4b1cf07d45ec7eb90a01dd3c00311a3e')

build(){
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr    \
              --disable-static \
              --docdir="/usr/share/doc/${pkgname}-${pkgver}"
  make
}

check(){
  cd "${pkgname}-${pkgver}"
  make check
}

package(){
  cd "${pkgname}-${pkgver}"
  make 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 xz-5.6.4-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/xz-5.6.4-1-$(uname -m).pkg.tar.xz

Update the local cache and install the zlib package:

pacman -Syu
pacman -S xz --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/xz
cp PKGBUILD /srv/pacman/source/LFS/xz
cd /sources
rm -rf xz

8.10.2. Contents of Xz

Installed programs: lzcat (link to xz), lzcmp (link to xzdiff), lzdiff (link to xzdiff), lzegrep (link to xzgrep), lzfgrep (link to xzgrep), lzgrep (link to xzgrep), lzless (link to xzless), lzma (link to xz), lzmadec, lzmainfo, lzmore (link to xzmore), unlzma (link to xz), unxz (link to xz), xz, xzcat (link to xz), xzcmp (link to xzdiff), xzdec, xzdiff, xzegrep (link to xzgrep), xzfgrep (link to xzgrep), xzgrep, xzless, and xzmore
Installed libraries: liblzma.so
Installed directories: /usr/include/lzma and /usr/share/doc/xz-5.6.4

Short Descriptions

lzcat

Decompresses to standard output

lzcmp

Runs cmp on LZMA compressed files

lzdiff

Runs diff on LZMA compressed files

lzegrep

Runs egrep on LZMA compressed files

lzfgrep

Runs fgrep on LZMA compressed files

lzgrep

Runs grep on LZMA compressed files

lzless

Runs less on LZMA compressed files

lzma

Compresses or decompresses files using the LZMA format

lzmadec

A small and fast decoder for LZMA compressed files

lzmainfo

Shows information stored in the LZMA compressed file header

lzmore

Runs more on LZMA compressed files

unlzma

Decompresses files using the LZMA format

unxz

Decompresses files using the XZ format

xz

Compresses or decompresses files using the XZ format

xzcat

Decompresses to standard output

xzcmp

Runs cmp on XZ compressed files

xzdec

A small and fast decoder for XZ compressed files

xzdiff

Runs diff on XZ compressed files

xzegrep

Runs egrep on XZ compressed files

xzfgrep

Runs fgrep on XZ compressed files

xzgrep

Runs grep on XZ compressed files

xzless

Runs less on XZ compressed files

xzmore

Runs more on XZ compressed files

liblzma

The library implementing lossless, block-sorting data compression, using the Lempel-Ziv-Markov chain algorithm