8.70. Diffutils-3.11

The Diffutils package contains programs that show the differences between files or directories.

Approximate build time: 0.4 SBU
Required disk space: 50 MB

8.70.1. Installation of Diffutils

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

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

pkgname="diffutils"
pkgver="3.11"
pkgrel="1"
pkgdesc="The Diffutils package contains programs that show the differences between files or directories."
arch=('x86'
      'x86_64')
url="https://www.gnu.org/software/diffutils/"
license=('GPLv3')
groups=('core')
depends=('glibc'
         'rootfs')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gawk'
             'gcc'
             'gettext'
             'grep'
             'make'
             'sed'
             'texinfo')
checkdepends=('perl')
source=('https://ftp.gnu.org/gnu/diffutils/diffutils-3.11.tar.xz')
md5sums=('75ab2bb7b5ac0e3e10cece85bd1780c2')
    
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 diffutils-3.11-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/diffutils-3.11-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Diffutils package:

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

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

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

8.70.2. Contents of Diffutils

Installed programs: cmp, diff, diff3, and sdiff

Short Descriptions

cmp

Compares two files and reports any differences byte by byte

diff

Compares two files or directories and reports which lines in the files differ

diff3

Compares three files line by line

sdiff

Merges two files and interactively outputs the results