The Tar package provides the ability to create tar archives as well as perform various other kinds of archive manipulation. Tar can be used on previously created archives to extract files, to store additional files, or to update or list files which were already stored.
Create the PKGBUILD for the Tar package with the following commands:
mkdir /sources/tar
cd /sources/tar
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="tar"
pkgver="1.35"
pkgrel="1"
pkgdesc="The Tar package provides the ability to create and extract tar archives."
arch=('x86'
'x86_64')
url="https://www.gnu.org/software/tar/"
license=('GPLv3')
groups=('core')
depends=('acl'
'attr'
'bzip2'
'glibc'
'gzip'
'xz'
'rootfs')
makedepends=('bash'
'binutils'
'bison'
'coreutils'
'gcc'
'gettext'
'grep'
'inetutils'
'make'
'sed'
'texinfo')
checkdepends=('autoconf'
'diffutils'
'findutils'
'gawk'
'gzip')
source=('https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz')
md5sums=('a2d8042658cfd8ea939e6d911eaf4152')
build(){
cd "${pkgname}-${pkgver}"
# Since building as the pacman user, no need for the workaround in LFS
# proper for "FORCE_UNSAFE_CONFIGURE=1":
./configure --prefix=/usr
make
}
check(){
cd "${pkgname}-${pkgver}"
# One test, capabilities: binary store/restore, is known to fail if it is run
# because LFS lacks selinux, but will be skipped if the host kernel does not
# support extended attributes or security labels on the filesystem used for
# building LFS.
make -k check || true
}
package(){
cd "${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" -C doc install-html docdir="/usr/share/doc/tar-${pkgver}"
}
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 tar-1.35-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/tar-1.35-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Tar package:
pacman -Syu pacman -S tar --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/tar cp PKGBUILD /srv/pacman/source/LFS/tar cd /sources rm -rf tar