105.16. miniupnpc-2.3.3
A UPnP IGD client, for opening a port on the home router
| Version | 2.3.3, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 41_system (System), 794 of 1047 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://miniupnp.tuxfamily.org/ |
| Build time | 0.1 SBU |
| Installed size | 139.7 KiB in 19 files |
| Recipe | ports/core/net-libs/miniupnpc/kpkgbuild |
About
miniupnpc is a UPnP Internet Gateway Device client library: it finds the home router on the local network and asks it to forward a port or report the external address. The games and peer-to-peer programs that can open their own port on a router link it, among them transmission, ddnet, ppsspp and warzone2100.
Sources
miniupnpc-2.3.3.tar.gz(138.0 KiB)
sha256d52a0afa614ad6c088cc9ddff1ae7d29c8c595ac5fdd321170a05f41e634bd1a
upstream: https://miniupnp.tuxfamily.org/files/miniupnpc-2.3.3.tar.gz
archive copy: sources-3/net-libs--miniupnpc-2.3.3.tar.gz
Dependencies
Required by (5): ddnet, ppsspp, srb2, transmission, warzone2100.
Patches
build.sh applies these; kpkg applies nothing by itself.
includes.patch— Include<stddef.h>ininclude/upnpcommands.h, whose prototypes usesize_twhile neither it nor the two headers it includes declare it, so a source that includes it before any standard header fails to compile.
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 miniupnpc'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/miniupnpc.
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/miniupnpc
echo 'd52a0afa614ad6c088cc9ddff1ae7d29c8c595ac5fdd321170a05f41e634bd1a miniupnpc-2.3.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/miniupnpc
SRC=$SRC_ROOT/miniupnpc-2.3.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf miniupnpc-2.3.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:
patch -p1 -i "$PORT_SRC/includes.patch"
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DUPNPC_BUILD_SHARED=ON \
-DUPNPC_BUILD_STATIC=OFF \
-DUPNPC_BUILD_TESTS=OFF \
-DUPNPC_BUILD_SAMPLE=OFF
ninja
DESTDIR=$PKG ninja install
rm -f "$PKG/usr/bin/external-ip.sh"
The switches, and why each is set:
-DUPNPC_BUILD_SHARED=ON— Buildlibminiupnpc.so; with-DUPNPC_BUILD_STATIC=OFFno static archive is built beside it. Upstream builds both by default.-DUPNPC_BUILD_SAMPLE=OFF— Build none of the sample programs, theupnpcclient andupnp-listdevices, which a shared build would install asupnpc-sharedandupnp-listdevices-shared, so the package is the library alone.-DUPNPC_BUILD_TESTS=OFFlikewise builds no tests.
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/miniupnpc, 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 miniupnpc-2.3.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/miniupnpc, and runs the triggers its paths call for.
Contents
Installed libraries: libminiupnpc.so.
Installed directories: /usr/include/miniupnpc, /usr/lib/cmake/miniupnpc, /usr/share/licenses/miniupnpc.
Short descriptions
miniupnpc.pc |
UPnP IGD client lightweight library |
Notes
Upstream installs external-ip.sh whatever the options. It is a one-line wrapper that runs upnpc -s, and no build of this port installs a command by that name, since the sample installs as upnpc-shared or upnpc-static; build.sh therefore removes the script.