Build Dependencies HOWTO

Before making a local build, build dependencies needs to be installed. This document tries to describe the procedures.

When the dependencies are installed the build is done as described in INSTALL.md which distributed in every plugin. A (possibly outdated) copy is available in the Usage page.

Windows

Before build, run the buildwin\win_deps.bat file. The file requires a working choco installation, see https://docs.chocolatey.org/en-us/choco/setup

The first run will install various software using choco, and should be invoked with administrative privileges.

Subsequent builds should still invoke the file, but it can be done with regular permissions.

A batch file has been found useful for modifying source code with Visual Studio 2017.

Debian/Ubuntu

If not already done, first clone the git sources. Then, in the plugin directory, install build dependencies using something like

 $ sudo apt install devscripts equivs
 $ sudo mk-build-deps -ir build-deps/control
 $ sudo apt-get -q --allow-unauthenticated install -f

Flatpak

Building Flatpak requires a Linux host. The first step is to install flatpak as described in https://flatpak.org/setup/

Proceed by installing flatpak-builder. Most distributions including Ubuntu and Fedora have this packaged, making it possible to install using tools like apt(8) or dnf(8).

Then install the build dependencies using something like

$ flatpak remote-add --user --if-not-exists \
      flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak install --user flathub org.freedesktop.Platform//20.08
$ flatpak install --user flathub org.freedesktop.Sdk//20.08
$ flatpak install --user flathub org.opencpn.OpenCPN

20.08 is the runtime version which indeed is 20.08 at the time of writing. Review the flatpak/org.opencpn.*yaml file to check this, look for runtime-version.

Android

The templates supports creating tarballs for 32-bit armhf and 64-bit arm64 targets. Building these requires a local installation of the Android Native Development Kid (NDK) which can be found at https://developer.android.com/ndk/downloads.

The build needs to locate the installed NDK. By default, it uses the path /opt/android/ndk. This can be utilized by creating a symlink, something like sudo ln -s /opt/android/android-ndk-* /opt/android/ndk. As an alternative, the NDK_HOME environment variable can be used. It should contain the complete path to the NDK directory.

Android builds also needs an updated cmake version. In general, the NDK and cmake needs to be synchronized — an old cmake version is not likely to work with an updated NDK. This is an issue on some platforms, notably all Debian-based which includes Ubuntu. The work-around is to use python to install the python wheel distributed by Kitware using somehting like pip install --user cmake. This requires a working, updated python3 installation.

MacOS

Use the ci script, which just installs the build deps and configures when used in a non-CI environment:

$ ci/circleci-build-macos

After the initial run the build dependencies are in place and configured. Make for example the tarball using cd build-osx; make tarball