8.106. Libarchive-3.7.8

The libarchive library provides a single interface for reading/writing various compression formats.

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

8.106.1. Installation of libarchive

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

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

pkgname="libarchive"
pkgver="3.7.8"
pkgrel="1"
pkgdesc="Provides a single interface for reading/writing various compression formats."
arch=('x86'
      'x86_64')
url="https://github.com/libarchive/"
groups=('core')
license=('BSD3C')
depends=('acl'
         'bzip2'
         'glibc'
         'libxml2'
         'lz4'
         'nettle'
         'openssl'
         'rootfs'
         'xz'
         'zlib'
         'zstd')
makedepends=('bash'
             'binutils'
             'coreutils'
             'diffutils'
             'gawk'
             'gcc'
             'grep'
             'make'
             'sed')
source=('https://github.com/libarchive/libarchive/releases/download/v3.7.8/libarchive-3.7.8.tar.xz')
md5sums=('ac32a73d5b7bf9556f6438b55927970f')

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

package(){
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  ln -sfv bsdunzip "${pkgdir}/usr/bin/unzip"
}
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 libarchive-3.7.8-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/libarchive-3.7.8-1-$(uname -m).pkg.tar.xz

Update the local cache and install the libarchive package:

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

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

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

8.106.2. Contents

Installed Programs: bsdcat, bsdcpio, and bsdtar
Installed Libraries: libarchive.so
Installed Directories: None

Short Descriptions

bsdcat

expands files to standard output.

bsdcpio

is a tool similar to cpio.

bsdtar

is a tool similar to GNU tar.

libarchive.so

is a library that can create and read several streaming archive formats.