8.78. Gzip-1.13

The Gzip package contains programs for compressing and decompressing files.

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

8.78.1. Installation of Gzip

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

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

pkgname="gzip"
pkgver="1.13"
pkgrel="1"
pkgdesc="The Gzip package contains programs for compressing and decompressing files."
arch=('x86'
      'x86_64')
url="https://www.gnu.org/software/gzip/"
license=('GPLv3')
groups=('core')
depends=('bash'
         'glibc'
         'rootfs')
makedepends=('binutils'
             'coreutils'
             'gcc'
             'grep'
             'make'
             'sed'
             'texinfo')
checkdepends=('diffutils'
              'less')
source=('https://ftp.gnu.org/gnu/gzip/gzip-1.13.tar.xz')
md5sums=('d5c9fc9441288817a4a0be2da0249e29')
 
build(){
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  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 gzip-1.13-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/gzip-1.13-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Gzip package:

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

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

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

8.78.2. Contents of Gzip

Installed programs: gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew

Short Descriptions

gunzip

Decompresses gzipped files

gzexe

Creates self-decompressing executable files

gzip

Compresses the given files using Lempel-Ziv (LZ77) coding

uncompress

Decompresses compressed files

zcat

Decompresses the given gzipped files to standard output

zcmp

Runs cmp on gzipped files

zdiff

Runs diff on gzipped files

zegrep

Runs egrep on gzipped files

zfgrep

Runs fgrep on gzipped files

zforce

Forces a .gz extension on all given files that are gzipped files, so that gzip will not compress them again; this can be useful when file names were truncated during a file transfer

zgrep

Runs grep on gzipped files

zless

Runs less on gzipped files

zmore

Runs more on gzipped files

znew

Re-compresses files from compress format to gzip format—.Z to .gz