337.6. opencpn-5.14.0
Chart plotter and navigation for S-57/S-63 ENC and raster charts, AIS and GPS (wxWidgets)
| Version | 5.14.0, release 2 |
| Shelf | gis — GIS, maps, projections, GPS, navigation and location |
| Phase | 44_apps (Applications), 216 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://opencpn.org/ |
| Build time | 25.6 SBU |
| Installed size | 77.5 MiB in 631 files |
| Recipe | ports/core/gis/opencpn/kpkgbuild |
About
OpenCPN is a chart plotter and navigation program for boats: it draws S-57 and S-63 vector charts and raster charts, takes positions from a GPS and targets from AIS over serial, USB or the network, and plans and follows routes. The port builds it on wxwidgets with its GTK 3 backend and OpenGL, and ships the minimal GSHHS world coastline, the tide and current harmonics and the manual in the package, so it opens a usable chart of the world with no download.
Sources
opencpn-5.14.0.tar.gz(71.5 MiB)
sha256581d5d1ca80ccb654e3995f0031fdc10ad32d43197ddb250106260e134e4a924
upstream: https://github.com/OpenCPN/OpenCPN/archive/refs/tags/Release_5.14.0.tar.gz
archive copy: sources-2/gis--opencpn-5.14.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, gettext, git, wxwidgets, gtk3, glib, mesa, libglvnd, glu, glew, libX11, libXrandr, curl, libarchive, libexif, libusb, lz4, openssl, xz, bzip2, zlib, portaudio, libsndfile, rapidjson, shapelib, sqlite, tinyxml, elfutils, eudev, gpsd.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
mdns.patch— Adds#include <sys/select.h>tomodel/src/mdns_service.cpp, which callsselect(); musl declares it only there.openssl4.patch— Builds the name of the self-signed certificate OpenCPN makes for its network server as a newX509_NAME, then sets it as both subject and issuer. Upstream adds its entries to the nameX509_get_subject_name()returns, and OpenSSL 4 returns that nameconst, so the unpatched code does not compile.system-shapelib.patch— Removes the#define USE_CPLthatgui/include/gui/dychart.hmakes for every source. With it, the system shapelib’sshapefil.hincludes GDAL’scpl_conv.hon top of the CPL headers OpenCPN carries inlibs/gdal, and the two sets do not compile together.udev-rule-destdir.patch— Replaces the install step that copies98-sglock-ocpn.rulesstraight into the running system’s/usr/lib/udev/rules.d, whenever/lib/udev/rules.dis writable, with an ordinary install into/usr/lib/udev/rules.dunder the package. The rule makes the SGLock USB licence dongle, vendor1547product1000, readable and writable by every user. Thetestat the end ofbuild.shfails the build if the rule is not in the package.
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/44_apps/phase.env && kpkg install opencpn'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gis/opencpn.
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/gis/opencpn
echo '581d5d1ca80ccb654e3995f0031fdc10ad32d43197ddb250106260e134e4a924 opencpn-5.14.0.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/opencpn
SRC=$SRC_ROOT/opencpn-5.14.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf opencpn-5.14.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:
patch -p1 -i "$PORT_SRC/mdns.patch"
patch -p1 -i "$PORT_SRC/system-shapelib.patch"
patch -p1 -i "$PORT_SRC/openssl4.patch"
patch -p1 -i "$PORT_SRC/udev-rule-destdir.patch"
export LDFLAGS="$LDFLAGS -Wl,--strip-debug"
cmake -S . -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DOCPN_USE_BUNDLED_LIBS=OFF \
-DOCPN_BUNDLE_GSHHS=ON \
-DOCPN_BUNDLE_TCDATA=ON \
-DOCPN_BUNDLE_DOCS=ON \
-DOCPN_USE_GL=ON \
-DOCPN_USE_CURL=ON \
-DOCPN_USE_WEBVIEW=OFF \
-DOCPN_ENABLE_PORTAUDIO=ON \
-DOCPN_ENABLE_SNDFILE=ON \
-DOCPN_USE_UDEV_PORTS=ON \
-DOCPN_BUILD_TEST=OFF \
-DOCPN_CI_BUILD=OFF \
-DCMAKE_IGNORE_PATH='/usr/lib/cmake/glew;/usr/lib64/cmake/glew;/lib/cmake/glew;/lib64/cmake/glew' \
"-DOCPN_TARGET_TUPLE=kdos;1;$(uname -m)"
cmake --build build
DESTDIR=$PKG cmake --install build
cat > "$PKG/usr/share/applications/opencpn.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=OpenCPN
GenericName=Chart Plotter
Comment=Navigate with electronic charts, GPS and AIS
Exec=opencpn
Icon=opencpn
Terminal=false
StartupWMClass=opencpn
Categories=Education;Science;Geography;Maps;
Keywords=gps;navigation;chart;nautical;marine;boat;ais;enc;
DESKTOP
chmod 644 "$PKG/usr/share/applications/opencpn.desktop"
test -f "$PKG/usr/lib/udev/rules.d/98-sglock-ocpn.rules"
The switches, and why each is set:
-DOCPN_USE_BUNDLED_LIBS=OFF— Links the system copy of every library OpenCPN can take from either place, its default on Linux, named. The libraries with no system form, among them wxcurl and the parsers underlibs/, are compiled from the tree.-DOCPN_BUNDLE_GSHHS=ON,-DOCPN_BUNDLE_TCDATA=ON— Install the minimal GSHHS coastline data and the tide and current harmonics; upstream’s defaults, named.-DOCPN_BUNDLE_DOCS=ON— Installs the manual, which upstream leaves out by default on Linux.-DOCPN_USE_GL=ON,-DOCPN_USE_CURL=ON,-DOCPN_ENABLE_PORTAUDIO=ON,-DOCPN_ENABLE_SNDFILE=ON,-DOCPN_USE_UDEV_PORTS=ON— Upstream’s defaults on Linux, named: OpenGL chart drawing, libcurl for downloads, alarm sounds through portaudio and libsndfile, and serial ports listed through eudev.-DOCPN_USE_WEBVIEW=OFF— Builds without wxWidgets’ WebView. The About and help window then shows its pages in wxWidgets’ own HTML widget instead of an embedded WebKitGTK view; nothing else in OpenCPN uses WebView.-DOCPN_BUILD_TEST=OFF— Leaves out the test subproject, which is on by default.-DOCPN_CI_BUILD=OFF— Upstream’s default, named: the version is the release’s own, not one made by the project’s CI numbering rules.-DCMAKE_IGNORE_PATH='/usr/lib/cmake/glew;/usr/lib64/cmake/glew;/lib/cmake/glew;/lib64/cmake/glew'— Hides GLEW’s own CMake package so that CMake’sFindGLEWfinds the library itself; taken from the package, a shared GLEW’s path is left NOTFOUND (see A graphical application)."-DOCPN_TARGET_TUPLE=kdos;1;$(uname -m)"— Names the platform askdos, version1, on this machine’s architecture. The plugin manager matches downloadable plugins against this name. Left empty,cmake/TargetSetup.cmakerunslsb_releasefor it, and stops configure when the program is missing, as it is here.-Wl,--strip-debug— Drops debug information at the link. The bundled plugins’ own CMake files (chartdldr_pi’s andwmm_pi’sPluginConfigure.cmake) add-gto their compile options, whichCMAKE_BUILD_TYPE=Releasedoes not remove (see What kpkg does around build.sh).
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/opencpn, 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 opencpn-5.14.0-2.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/opencpn, and runs the triggers its paths call for.
Contents
Installed programs: opencpn, opencpn-cmd.
Installed directories: /usr/lib/opencpn, /usr/share/doc/opencpn, /usr/share/licenses/opencpn, /usr/share/opencpn.
Short descriptions
opencpn |
Chartplotter and GPS Navigation Software |
opencpn-cmd |
Chartplotter and GPS Navigation Software CLI interface |
Notes
At start OpenCPN sets GDK_BACKEND=x11 for itself whenever WAYLAND_DISPLAY is set, unless OCPN_DISABLE_X11_GDK_BACKEND is, so on the session it is an X11 window under Xwayland, whose class is the program’s name. The desktop entry is written in build.sh with StartupWMClass=opencpn to match it.