53.2. libuv-1.52.1
Multi-platform support library with a focus on asynchronous I/O
| Version | 1.52.1, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 30_foundation (Build Foundation), 28 of 127 in build order |
| Licence | MIT |
| Homepage | https://libuv.org/ |
| Build time | 0.2 SBU |
| Installed size | 816.0 KiB in 14 files |
| Recipe | ports/core/net-libs/libuv/kpkgbuild |
About
libuv is the cross-platform asynchronous I/O library written for Node.js: an event loop over epoll, with timers, TCP and UDP sockets, pipes, child processes, signal handling, and file system operations and getaddrinfo lookups run on a thread pool.
In the tree it is linked by cmake, nodejs (--shared-libuv, in place of the copy in Node’s own source tree), neovim, libwebsockets and fcitx5. It is built in 30_foundation, the phase cmake is built in; cmake depends on it, so every CMake recipe of a later phase needs it installed.
The release tarball from dist.libuv.org carries configure.ac and Makefile.am but no generated configure, so build.sh first runs upstream’s autogen.sh, which runs libtoolize, aclocal, autoconf and automake. That is why the recipe depends on autoconf, automake and libtool.
Sources
libuv-1.52.1.tar.gz(1.3 MiB)
sha25666d511b9e6e334c0e62279eb234fbfb2b3110b1479c09b95b44c7afca8cff9e7
upstream: https://dist.libuv.org/dist/v1.52.1/libuv-v1.52.1.tar.gz
archive copy: sources-3/net-libs--libuv-1.52.1.tar.gz
Dependencies
Depends on: autoconf, automake, libtool.
Required by (5): cmake, fcitx5, libwebsockets, neovim, nodejs.
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 libuv'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/libuv.
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/libuv
echo '66d511b9e6e334c0e62279eb234fbfb2b3110b1479c09b95b44c7afca8cff9e7 libuv-1.52.1.tar.gz' | 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/libuv
SRC=$SRC_ROOT/libuv-1.52.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libuv-1.52.1.tar.gz -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:
sh autogen.sh
export CFLAGS="$CFLAGS -g0"
./configure --prefix=/usr
make
make DESTDIR=$PKG install
The switches, and why each is set:
-g0— added to the exportedCFLAGS. libuv’sconfigure.acappends-gto its ownAM_CFLAGS, which automake puts before the user’sCFLAGSon every compile line of the library;-g0comes later on the line and cancels it, so the library is compiled without debugging information. The tree’s ownCFLAGScarry no-g.
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/libuv, 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 libuv-1.52.1-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/libuv, and runs the triggers its paths call for.
Contents
Installed libraries: libuv.a, libuv.so.
Installed directories: /usr/include/uv, /usr/share/licenses/libuv.
Short descriptions
libuv.pc |
multi-platform support library with a focus on asynchronous I/O. |