8.40.2. Contents of Sed
Installed program:
sed
Installed directory:
/usr/share/doc/sed-4.9
The Sed package contains a stream editor.
Create the PKGBUILD for the Sed package with the following commands:
mkdir /sources/sed
cd /sources/sed
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="sed"
pkgver="4.9"
pkgrel="1"
pkgdesc="The Sed package contains a stream editor."
arch=('x86'
'x86_64')
url="https://www.gnu.org/software/sed/"
license=('GPLv3')
groups=('core')
depends=('acl'
'attr'
'glibc'
'rootfs)
makedepends=('bash'
'binutils'
'coreutils'
'gcc'
'gettext'
'grep'
'make'
'sed'
'texinfo')
checkdepends=('diffutils'
'gawk')
source=('https://ftp.gnu.org/gnu/sed/sed-4.9.tar.xz')
md5sums=('6aac9b2dbafcd5b7a67a8a9bcb8036c3')
build(){
cd "${pkgname}-${pkgver}"
./configure --prefix=/usr --bindir=/bin
make
make html
}
check(){
cd "${pkgname}-${pkgver}"
make check
}
package(){
cd "${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
install -d -m755 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
install -m644 doc/sed.html "${pkgdir}/usr/share/doc/${pkgname}-${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 sed-4.9-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/sed-4.9-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Sed package:
pacman -Syu pacman -S sed --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/sed cp PKGBUILD /srv/pacman/source/LFS/sed cd /sources rm -rf sed