277.1. gpsman-6.4.4.2
GPS Manager — waypoints, routes and tracks to and from Garmin, Lowrance and Magellan receivers, with the gpsmanshp Shapefile layer
| Version | 6.4.4.2, release 1 |
| Shelf | hamradio — Amateur-radio operation: rig control, digital modes, logging, packet and APRS, propagation, and mesh radio |
| Phase | 43_toolkits (Toolkits), 172 of 344 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://sourceforge.net/projects/gpsman/ |
| Build time | 0.1 SBU |
| Installed size | 2.3 MiB in 340 files |
| Recipe | ports/core/hamradio/gpsman/kpkgbuild |
About
GPS Manager is a Tcl/Tk program that transfers waypoints, routes and tracks to and from Garmin, Lowrance and Magellan receivers, and edits, converts and displays them. The second source, gpsmanshp, is its loadable Tcl extension for reading and writing ESRI Shapefiles through shapelib. xastir also uses GPSMan to download from a GPS.
Why it is in KDOS
The comment above it in script/phases/43_toolkits/packages.d/hamradio.txt:
xastir downloads from a GPS through GPSMan.
Sources
gpsman-6.4.4.2.tar.gz(1.4 MiB)
sha2567a82215bd9550eb7fe88cc7e81f518687adb60ac9a2193b790278d0c469d3b93
upstream: https://downloads.sourceforge.net/project/gpsman/distrib/gpsman-6.4.4.2.tgz
archive copy: sources-3/hamradio--gpsman-6.4.4.2.tar.gzgpsmanshp_1.2.3.tgz(146.6 KiB)
sha2562803524aa8f87db6ff1eaec93cef9619c944c9aa00149e554be11f6e2f1cafd2
upstream: https://downloads.sourceforge.net/project/gpsmanshp/distr/gpsmanshp_1.2.3.tgz
archive copy: sources-3/hamradio--gpsmanshp_1.2.3.tgz
Dependencies
Depends on: tcl, tk, shapelib, imagemagick.
Required by (1): xastir.
Patches
build.sh applies these; kpkg applies nothing by itself.
gpsman-system-paths.patch— Ingpsman.tcl, setSRCDIRto/usr/share/gpsman/gmsrc, wherebuild.shinstalls the program’s Tcl sources, instead of the relativegmsrc, a path resolved against the directory GPSMan is started from; and set the default manual address to empty, because the HTML manual is not installed.gpsmanshp-tcl9.patch— Port gpsmanshp to the Tcl 9 API: every command’sTcl_Obj *CONST objv[]becomesTcl_Obj *const objv[](Tcl 9 drops theCONSTmacro), andGSHPCreateTRreads the list length fromTcl_ListObjGetElementsinto aTcl_Size, then converts it to theintit uses.
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/43_toolkits/phase.env && kpkg install gpsman'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/hamradio/gpsman.
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/gpsman
echo '7a82215bd9550eb7fe88cc7e81f518687adb60ac9a2193b790278d0c469d3b93 gpsman-6.4.4.2.tar.gz' | sha256sum -c -
echo '2803524aa8f87db6ff1eaec93cef9619c944c9aa00149e554be11f6e2f1cafd2 gpsmanshp_1.2.3.tgz' | 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/gpsman
SRC=$SRC_ROOT/gpsman-6.4.4.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gpsman-6.4.4.2.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf gpsmanshp_1.2.3.tgz -C "$SRC_ROOT"
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 recipe’s helpers _shpver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/gpsman-system-paths.patch"
install -Dm755 gpsman.tcl "$PKG/usr/bin/gpsman"
install -d "$PKG/usr/share/gpsman"
cp -r gmsrc "$PKG/usr/share/gpsman/"
find "$PKG/usr/share/gpsman" -type d -exec chmod 755 {} +
find "$PKG/usr/share/gpsman" -type f -exec chmod 644 {} +
install -Dm644 man/man1/gpsman.1 "$PKG/usr/share/man/man1/gpsman.1"
_shp="$SRC_ROOT/gpsmanshp_$_shpver"
_shpdir="$PKG/usr/lib/gpsmanshp$_shpver"
patch -d "$_shp" -p1 -i "$PORT_SRC/gpsmanshp-tcl9.patch"
install -d "$_shpdir"
$CC $CFLAGS -c "$_shp/gpsmanshp.c" -o "$_shp/gpsmanshp.o"
$CC -shared $LDFLAGS -o "$_shpdir/gpsmanshp.so" "$_shp/gpsmanshp.o" -lshp -ltcl9.0
printf 'package ifneeded gpsmanshp %s [list load [file join $dir gpsmanshp.so] Gpsmanshp]\n' \
"$_shpver" > "$_shpdir/pkgIndex.tcl"
chmod 644 "$_shpdir/pkgIndex.tcl"
printf 'set auto_path [linsert $auto_path 0 %s]\nputs [package require gpsmanshp]\n' \
"$PKG/usr/lib" | tclsh9.0 | grep -qx "$_shpver"
for s in 48 64 128; do
install -d "$PKG/usr/share/icons/hicolor/${s}x${s}/apps"
magick manual/html/gpsman-logo.gif -background none -gravity center \
-extent 375x375 -resize ${s}x${s} \
"$PKG/usr/share/icons/hicolor/${s}x${s}/apps/gpsman.png"
done
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/gpsman.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=GPSMan
GenericName=GPS Manager
Comment=Transfer waypoints, routes and tracks to and from a GPS receiver
Exec=gpsman
Icon=gpsman
Terminal=false
StartupWMClass=Gpsman
Categories=Utility;Geography;HamRadio;
Keywords=gps;garmin;lowrance;magellan;waypoint;route;track;shapefile;
DESKTOP
chmod 644 "$PKG/usr/share/applications/gpsman.desktop"
test -x "$PKG/usr/bin/gpsman"
test -f "$PKG/usr/share/gpsman/gmsrc/main.tcl"
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/gpsman, 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 gpsman-6.4.4.2-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/gpsman, and runs the triggers its paths call for.
Contents
Installed programs: gpsman.
Installed directories: /usr/lib/gpsmanshp1.2.3, /usr/share/gpsman, /usr/share/licenses/gpsman.
Short descriptions
gpsman |
a (graphical) manager of GPS data |
Notes
Neither source has a build system that fits a package. GPSMan is a script, so build.sh installs gpsman.tcl as /usr/bin/gpsman and copies its Tcl sources, gmsrc/, to /usr/share/gpsman/gmsrc. gpsmanshp is compiled by hand: gpsmanshp.c alone (the other C file, gpstr2shp.c, is a standalone GPStrans-to-Shapefile converter and is not built), linked as a shared object against -lshp and -ltcl9.0, installed as /usr/lib/gpsmanshp<version>/gpsmanshp.so with a pkgIndex.tcl that build.sh writes. The tclsh9.0 line then runs package require gpsmanshp against the package directory and fails the build unless the extension loads and reports its own version.
The menu icon is made from the GIF logo in the HTML manual: upstream’s logo exists only as GIF, which the panel does not read, so ImageMagick pads it square and scales it to hicolor PNGs. StartupWMClass=Gpsman is the Tk class, the script’s name with its first letter capitalised.