8.15.1. Installation of M4
Create the PKGBUILD for the M4 package with the following commands:
mkdir /sources/m4
cd /sources/m4
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="m4"
pkgver="1.4.19"
pkgrel="1"
pkgdesc="The M4 package contains a macro processor."
arch=('x86'
'x86_64')
url="http://www.gnu.org/software/m4/"
license=('GPLv3')
groups=('core')
depends=('bash'
'glibc')
makedepends=('binutils'
'coreutils'
'gcc'
'grep'
'make'
'sed'
'texinfo')
checkdepends=('diffutils')
optdepends=('libsigsegv')
source=('https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz')
md5sums=('0d90823e1426f1da2fd872df0311298d')
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 m4-1.4.19-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/m4-1.4.19-1-$(uname -m).pkg.tar.xz
Update the local cache and install the zlib package:
pacman -Syu
pacman -S m4 --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/m4
cp PKGBUILD /srv/pacman/source/LFS/m4
cd /sources
rm -rf m4