8.105.2. Installation of Nettle
Create the PKGBUILD for the Nettle package with the following
commands:
mkdir /sources/nettle
cd /sources/nettle
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="nettle"
pkgver="3.10.1"
pkgrel="1"
pkgdesc="The Nettle package contains a low-level cryptographic library."
arch=('x86'
'x86_64')
url="https://www.gnu.org/nettle/"
groups=('core')
license=('LGPLv3')
depends=('glibc'
'gmp'
'rootfs'))
makedepends=('bash'
'binutils'
'coreutils'
'gawk'
'gcc'
'grep'
'make'
'sed')
source=('https://ftp.gnu.org/gnu/nettle/nettle-3.10.1.tar.gz')
md5sums=('c3dc1729cfa65fcabe2023dfbff60beb')
build(){
cd "${pkgname}-${pkgver}"
./configure --prefix=/usr --disable-static
make
}
package(){
make DESTDIR="${pkgdir}" install
chmod -v 755 "${pkgdir}"/usr/lib/lib{hogweed,nettle}.so
install -vdm755 -d "${pkgdir}/usr/share/doc/nettle-${pkgver}"
install -vm644 nettle.{html,pdf} "${pkgdir}/usr/share/doc/nettle-${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 nettle-3.10.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/nettle-3.10.1-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Nettle package:
pacman -Syu
pacman -S nettle --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean
up the build directory:
mkdir /srv/pacman/source/LFS/nettle
cp PKGBUILD /srv/pacman/source/LFS/nettle
cd /sources
rm -rf nettle