101.8. libgcrypt-1.12.4
A general purpose crypto library based on the code used in GnuPG
| Version | 1.12.4, release 1 |
| Shelf | crypto — Cryptographic libraries, PKCS#11, smartcards and TPM |
| Phase | 41_system (System), 80 of 1047 in build order |
| Licence | LGPL-2.1-or-later AND GPL-2.0-or-later AND BSD-3-Clause |
| Homepage | https://www.gnupg.org/software/libgcrypt/ |
| Build time | 0.7 SBU |
| Installed size | 2.4 MiB in 17 files |
| Recipe | ports/core/crypto/libgcrypt/kpkgbuild |
About
Libgcrypt is the general-purpose cryptographic library that grew out of GnuPG: ciphers, hashes, MACs, public-key algorithms, a random number generator and the S-expression format GnuPG keys are kept in. gnupg is built on it, and so are many programs that need cryptography without TLS, among them libsecret, kwallet, wireshark’s decryption, weechat, vlc and both WebKitGTK builds. Errors are reported through libgpg-error. The port also installs dumpsexp, hmac256 and mpicalc, and libgcrypt-config.
Sources
libgcrypt-1.12.4.tar.bz2(4.3 MiB)
sha256d77f68f48879510e79a2f65977ccc68981781ea0923e5bdffac2a193ea3d660e
upstream: https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.12.4.tar.bz2
archive copy: sources-1/crypto--libgcrypt-1.12.4.tar.bz2
Dependencies
Depends on: libgpg-error.
Required by (20): aria2, dino, freeipmi, gnupg, gvfs, kwallet, kwallet-pam, libsecret, libspectrum, ntfs-3g, profanity, remmina, srecord, totem-pl-parser, vlc, webkitgtk, webkitgtk6, weechat, wireshark, wlvncc.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libgcrypt'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/crypto/libgcrypt.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/crypto/libgcrypt
echo 'd77f68f48879510e79a2f65977ccc68981781ea0923e5bdffac2a193ea3d660e libgcrypt-1.12.4.tar.bz2' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libgcrypt
SRC=$SRC_ROOT/libgcrypt-1.12.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libgcrypt-1.12.4.tar.bz2 -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure --prefix=/usr
make
make DESTDIR=$PKG install
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libgcrypt, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libgcrypt-1.12.4-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libgcrypt, and runs the triggers its paths call for.
Contents
Installed programs: dumpsexp, hmac256, libgcrypt-config, mpicalc.
Installed libraries: libgcrypt.so.
Installed directories: /usr/share/licenses/libgcrypt.
Short descriptions
hmac256 |
Compute an HMAC-SHA-256 MAC |
libgcrypt.pc |
General purpose cryptographic library |
Notes
The build is configure’s defaults with --prefix=/usr, and the library picks its accelerated code (AES-NI, SHA extensions, AVX2 and the rest) at run time from what the processor reports, so one build serves every x86-64 machine.