8.48.2. Contents of Gperf
Installed program:
gperf
Installed directory:
/usr/share/doc/gperf-3.1
Gperf generates a perfect hash function from a key set.
Create the PKGBUILD for the Gperf package with the following commands:
mkdir /sources/gperf
cd /sources/gperf
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="gperf"
pkgver="3.1"
pkgrel="1"
pkgdesc="Gperf generates a perfect hash function from a key set."
arch=('x86'
'x86_64')
url="https://www.gnu.org/software/gperf/"
license=('GPLv3')
groups=('core')
depends=('gcc'
'glibc'
'rootfs')
makedepends=('bash'
'binutils'
'coreutils'
'make')
checkdepends=('diffutils'
'expect')
source=('https://ftp.gnu.org/gnu/gperf/gperf-3.1.tar.gz')
md5sums=('9e251c0a618ad0824b51117d5d9db87e')
build(){
cd ${pkgname}-${pkgver}
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-${pkgver}
make
}
check(){
cd ${pkgname}-${pkgver}
# The tests are known to fail if j>1
make -j1 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 gperf-3.1-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/gperf-3.1-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Gperf package:
pacman -Syu pacman -S gperf --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/gperf cp PKGBUILD /srv/pacman/source/LFS/gperf cd /sources rm -rf gperf