164.9. pat-1.0.0
Winlink email client for amateur radio, over ARDOP, AX.25 packet and telnet
| Version | 1.0.0, release 1 |
| Shelf | hamradio — Amateur-radio operation: rig control, digital modes, logging, packet and APRS, propagation, and mesh radio |
| Phase | 41_system (System), 639 of 1047 in build order |
| Licence | MIT |
| Homepage | https://getpat.io/ |
| Build time | 0.3 SBU |
| Installed size | 16.8 MiB in 5 files |
| Recipe | ports/core/hamradio/pat/kpkgbuild |
About
Pat is a Winlink email client for amateur radio, written in Go: it sends and receives Winlink messages over a radio link (ARDOP through ardopcf, AX.25 packet, VARA) or over telnet to a Winlink server, and serves its own web interface for reading and writing them. The recipe’s desktop entry runs pat http --addr localhost:8083 in a terminal, and the interface is then at that address in a browser.
Sources
pat-1.0.0.tar.gz(1.6 MiB)
sha2562b46189991f81a64d033c200f6877b92748def374e20fa6f65b70574857ef845
upstream: https://github.com/la5nta/pat/archive/refs/tags/v1.0.0.tar.gz
archive copy: sources-3/hamradio--pat-1.0.0.tar.gzpat-vendor-1.0.0.tar.xz(1.3 MiB)
sha256aac7f7d33f245a6c3a8bdb2db37d1989119173206c117ea34444da2b29875ecc
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-3/hamradio--pat-vendor-1.0.0.tar.xz
Dependencies
Required by: no port names it.
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 pat'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/hamradio/pat.
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/hamradio/pat
echo '2b46189991f81a64d033c200f6877b92748def374e20fa6f65b70574857ef845 pat-1.0.0.tar.gz' | sha256sum -c -
echo 'aac7f7d33f245a6c3a8bdb2db37d1989119173206c117ea34444da2b29875ecc pat-vendor-1.0.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/pat
SRC=$SRC_ROOT/pat-1.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf pat-1.0.0.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:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
go build -mod=vendor -trimpath -ldflags "-s -w" -o pat-bin .
install -Dm755 pat-bin "$PKG/usr/bin/pat"
install -Dm644 -t "$PKG/usr/share/man/man1" man/pat.1 man/pat-configure.1
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/pat.desktop" <<'ENTRY'
[Desktop Entry]
Type=Application
Name=Pat
GenericName=Winlink Email Client
Comment=Winlink email over radio through ARDOP, AX.25 or VARA; serves its web interface on localhost:8083
Exec=pat http --addr localhost:8083
Icon=network-wireless
Terminal=true
Categories=Network;HamRadio;Email;
Keywords=ham;radio;winlink;email;ardop;ax25;packet;emcomm;
ENTRY
chmod 644 "$PKG/usr/share/applications/pat.desktop"
The switches, and why each is set:
-trimpath— Strip the build machine’s file-system paths from the binary. The exportedGOFLAGSalready carries it (see go), so on the command line it repeats that setting.--addr localhost:8083— In the desktop entry, not the build: serve the web interface on port 8083 of the local machine only. Pat’s default port is 8080, and 8080 to 8082 are taken by the init scripts of kiwix-serve, kolibri and llama-server (fs/etc/init.d), so on a machine running them the default port is in use andpat httpexits at once.
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/pat, 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 pat-1.0.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/pat, and runs the triggers its paths call for.
Contents
Installed programs: pat.
Installed directories: /usr/share/licenses/pat.
Short descriptions
pat |
a cross platform Winlink client with basic messaging capabilities |
Notes
The build sets no libax25 tag. That transport speaks the kernel’s AX.25 sockets, and the linux source KDOS builds carries no AX.25 protocol, so packet radio goes through the ax25+agwpe transport to the AGW port of a soundcard modem such as direwolf instead. The web interface is compiled in from web/dist as upstream publishes it, which is built JavaScript (see What is built from source).
The Go modules are not downloaded at build time. ports/fetch runs go mod vendor against the release and packs the module vendor/ tree into pat-vendor-<version>.tar.xz, whose sha256 = line in the recipe holds it like any other source; build.sh unpacks it and builds with -mod=vendor (see Vendoring).