Create the PKGBUILD for the libxml2 package with the following
commands:
mkdir /sources/libxml2
cd /sources/libxml2
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="libxml2"
pkgver="2.13.6"
pkgrel="1"
pkgdesc="The libxml2 package contains libraries and utilities used for parsing XML files."
arch=('x86'
'x86_64')
url="http://xmlsof.org/"
license=('GPL3')
groups=('core')
depends=('glibc')
makedepends=('bash'
'binutils'
'coreutils'
'gcc'
'make')
source=('https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.6.tar.xz')
md5sums=('85dffa2387ff756bdf8b3b247594914a')
build(){
cd "${pkgname}-${pkgver}"
./configure --prefix=/usr \
--disable-static \
--with-history \
--with-python=/usr/bin/python3
make
}
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 libxml2-2.13.6-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/libxml2-2.13.6-1-$(uname -m).pkg.tar.xz
Update the local cache and install the libxml2 package:
pacman -Syu
pacman -S libxml2 --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/libxml2
cp PKGBUILD /srv/pacman/source/LFS/libxml2
cd /sources
rm -rf libxml2
8.117.3. Command Explanations
--with-history: This switch
enables Readline support when
running xmlcatalog or
xmllint in shell
mode.
--with-python=/usr/bin/python3:
Allows building the libxml2 module with Python3 instead of Python2.
--with-threads: Add this switch to
enable multithread support.