The Grep package contains programs for searching through the contents of files.
First, remove a warning about using egrep and fgrep that makes tests on some packages fail:
Create the PKGBUILD for the Grep package with the following commands:
mkdir /sources/grep
cd /sources/grep
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="grep"
pkgver="3.11"
pkgrel="1"
pkgdesc="The Grep package contains programs for searching through the contents of files."
arch=('x86'
'x86_64')
url="https://www.gnu.org/software/grep/"
license=('GPLv3')
groups=('core')
depends=('glibc'
'rootfs')
makedepends=('bash'
'binutils'
'coreutils'
'diffutils'
'gcc'
'gettext'
'grep'
'make'
'patch'
'sed'
'texinfo')
checkdepends=('gawk')
optdepends=('pcre'
'libsigsegv')
source=('https://ftp.gnu.org/gnu/grep/grep-3.11.tar.xz')
md5sums=('7c9bbd74492131245f7cdb291fa142c0')
prepare(){
cd ${pkgname}-${pkgver}
# First, remove a warning about using egrep and fgrep that makes tests on some packages fail
sed -i "s/echo/#echo/" src/egrep.sh
}
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 grep-3.11-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/grep-3.11-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Grep package:
pacman -Syu pacman -S grep --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/grep cp PKGBUILD /srv/pacman/source/LFS/grep cd /sources rm -rf grep