53.1. nghttp2-1.70.0
Hypertext Transfer Protocol version 2 implementation
| Version | 1.70.0, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 30_foundation (Build Foundation), 24 of 127 in build order |
| Licence | MIT |
| Homepage | https://nghttp2.org/ |
| Build time | 0.3 SBU |
| Installed size | 824.0 KiB in 9 files |
| Recipe | ports/core/net-libs/nghttp2/kpkgbuild |
About
nghttp2 implements HTTP/2 in C: the framing layer and the HPACK header compression, as the shared library libnghttp2. The upstream project also ships programs built on it, the nghttp client, the nghttpd server, the nghttpx proxy and the h2load benchmark. KDOS builds the library alone.
curl links it for HTTP/2. cmake, nodejs (through --shared-nghttp2, in place of the copy in its own source tree), libsoup3 and wireshark depend on it too.
Sources
nghttp2-1.70.0.tar.xz(1.9 MiB)
sha256e05cb1388eaca3830aded4ccf20044b6e1ac1a61411dcca11b0437c4285c8bc2
upstream: https://github.com/nghttp2/nghttp2/releases/download/v1.70.0/nghttp2-1.70.0.tar.xz
archive copy: sources-3/net-libs--nghttp2-1.70.0.tar.xz
Dependencies
Depends on: nothing a recipe names.
Required by (5): cmake, curl, libsoup3, nodejs, wireshark.
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/30_foundation/phase.env && kpkg install nghttp2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/nghttp2.
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/net-libs/nghttp2
echo 'e05cb1388eaca3830aded4ccf20044b6e1ac1a61411dcca11b0437c4285c8bc2 nghttp2-1.70.0.tar.xz' | 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/nghttp2
SRC=$SRC_ROOT/nghttp2-1.70.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nghttp2-1.70.0.tar.xz -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 --sysconfdir=/etc --enable-lib-only
make
make DESTDIR=$PKG install
rm -rf "$PKG/usr/share/man"
The switches, and why each is set:
--enable-lib-only— upstream’s shorthand for--disable-app --disable-examples --disable-hpack-tools: buildlibnghttp2and nothing else, and look for none of the libraries the programs need. Without it, configure builds each group of programs when it finds that group’s libraries:nghttp,nghttpd,nghttpxandh2loadneed zlib, OpenSSL, libev and c-ares together, the HPACK toolsinflatehdanddeflatehdneed jansson, and the examples, which are never installed, need OpenSSL and libevent. libev is not a port, so the four programs would be skipped anyway; jansson and libevent are ports of41_system, a later phase, so a rebuild on a finished tree would install the two HPACK tools. With the switch the package is the same whatever configure would find.
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/nghttp2, 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 nghttp2-1.70.0-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/nghttp2, and runs the triggers its paths call for.
Contents
Installed libraries: libnghttp2.a, libnghttp2.so.
Installed directories: /usr/include/nghttp2, /usr/share/doc/nghttp2, /usr/share/licenses/nghttp2.
Short descriptions
libnghttp2.pc |
HTTP/2 C library |
Notes
make install writes the manual pages of the four programs whether or not they were built: the pages are listed in doc/Makefile.am’s man_MANS unconditionally and ship pre-generated in the release tarball. build.sh therefore deletes usr/share/man after the install, so the package does not carry pages for commands it does not install. The library itself has no manual pages.