8.49.1. Installation of Expat
Create the PKGBUILD for the Expat package with the following
commands:
mkdir /sources/expat
cd /sources/expat
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="expat"
pkgver="2.7.0"
pkgrel="1"
pkgdesc="The Expat package contains a stream oriented C library for parsing XML."
arch=('x86'
'x86_64')
url="https://libexpat.github.io/"
license=('custom'
'MIT')
groups=('core')
depends=('glibc'
'rootfs')
makedepends=('bash'
'binutils'
'coreutils'
'gawk'
'gcc'
'grep'
'make'
'sed')
source=('https://prdownloads.sourceforge.net/expat/expat-2.7.0.tar.xz')
md5sums=('974e9de880e731c00112ca069062343a')
build(){
cd ${pkgname}-${pkgver}
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/expat-${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 expat-2.7.0-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/expat-2.7.0-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Expat package:
pacman -Syu
pacman -S expat --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/expat
cp PKGBUILD /srv/pacman/source/LFS/expat
cd /sources
rm -rf expat