53.6. libpsl-0.23.3
Library for accessing and resolving information from the Public Suffix List
| Version | 0.23.3, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 30_foundation (Build Foundation), 113 of 127 in build order |
| Licence | MIT |
| Homepage | https://github.com/rockdaboot/libpsl |
| Build time | 0.1 SBU |
| Installed size | 244.6 KiB in 13 files |
| Recipe | ports/core/net-libs/libpsl/kpkgbuild |
About
libpsl answers questions about the Public Suffix List, Mozilla’s list of the domains under which anyone may register a name (com, co.uk, github.io). A program asks it whether a domain is a public suffix, or what the registrable domain of a host is. HTTP clients use it to refuse a cookie set for a whole suffix, such as one a server at a.co.uk tries to set for all of co.uk.
curl links it for exactly that cookie check, as do libsoup3, networkmanager and transmission. The package also installs the psl command and psl-make-dafsa, the Python script that compiles a list into the form the library reads. Configure needs Python only when a compiled form of the list is missing from the source; the release tarball carries all three, src/suffixes_dafsa.h and the test suite’s tests/psl.dafsa and tests/psl_ascii.dafsa, so the build itself runs no Python. The recipe’s depends names python3, which the installed script runs on.
Sources
libpsl-0.23.3.tar.gz(7.5 MiB)
sha25693941f85a1e7bd593fa94f299233cb5dfc91cd144fd9a78a6ceb75001c5b03be
upstream: https://github.com/rockdaboot/libpsl/releases/download/0.23.3/libpsl-0.23.3.tar.gz
archive copy: sources-3/net-libs--libpsl-0.23.3.tar.gz
Dependencies
Depends on: libidn2, libunistring, python3.
Required by (4): curl, libsoup3, networkmanager, transmission.
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 libpsl'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/libpsl.
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/libpsl
echo '93941f85a1e7bd593fa94f299233cb5dfc91cd144fd9a78a6ceb75001c5b03be libpsl-0.23.3.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/libpsl
SRC=$SRC_ROOT/libpsl-0.23.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libpsl-0.23.3.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:
./configure --prefix=/usr --enable-runtime=libidn2 --enable-builtin --disable-nls
make
make DESTDIR=$PKG install
install -Dm644 docs/libpsl/libpsl.3 -t "$PKG/usr/share/man/man3"
The switches, and why each is set:
--enable-runtime=libidn2— the IDNA library libpsl uses at run time. It converts the Unicode entries of a list file the library loads, and a Unicode name looked up in such a list, to their ASCII form;psl_str_to_utf8lowerlowercases through it as well. The built-in list needs no conversion. Left to choose, configure tries libidn2, then ICU, and builds with no run-time library when it finds neither; the older libidn is used only when named. Naming libidn2 makes a missing libidn2 an error,You requested libidn2 but it is not installed or usable., instead of a library that quietly converts with ICU or not at all.--enable-builtin— upstream’s default, named: compile a copy of the list into the library itself, so it answers with no list file installed. The copy is the one in the release tarball (list/public_suffix_list.dat, already converted assrc/suffixes_dafsa.h), so the built-in list is as old as the release. No port in the tree installs a list file for the library to load instead.
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/libpsl, 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 libpsl-0.23.3-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/libpsl, and runs the triggers its paths call for.
Contents
Installed programs: psl, psl-make-dafsa.
Installed libraries: libpsl.a, libpsl.so.
Installed directories: /usr/share/licenses/libpsl.
Short descriptions
psl |
Explore the Public Suffix List |
psl-make-dafsa |
generate a compact and optimized DAFSA from a Public Suffix List |
libpsl.pc |
Public Suffix List C library. |
Notes
The library’s manual page, libpsl.3, is installed by make install only when both gtk-doc and manual pages are enabled, and building it then needs xsltproc and the DocBook stylesheets. The release tarball carries the finished page in docs/libpsl/, so build.sh installs that file itself, as Manual pages asks for a page upstream ships but does not install.