Pure-maps on Mobian/PureOS

I wanted to run Pure Maps on my Pinephone and the Librem 5, but did not want to install the flatpak version. So I learned more about Debian packaging, build systems, Qt, GLES than I ever wanted to know. First, I talk about the packaging nags and open issues and below I will detail how to just *use* pure-maps.

For Packagers:

My packaging is currently all in https://salsa.debian.org/Mobian-team/puremaps-packaging comprising 5 source packages. It is kind of straightforward debian packaging, with a few snags:

  • s2geometry is packed as library libs2-0 and libs2-dev. UPDATE: it is already in the Debian repositories. the -dev package is a build-dependency for pure-maps. I simply named the package 0.10.0 using current master. The last release was 2 years ago and development has actively continued. Current master annouces itself as 0.10.0 (I am using that commit). Ideally upstream would put out a real release so we have a reference point we can publish. I have an open ticket to formally release a new version.
  • pure-maps contains 2 git submodules in the thirdparty repository:
    gpxpy @ b9219a9f and geomag @ 8eb9a730. Building this requires the submodules checked out and geomag will be installed as poor.geomag, I think. Debian has a python3-gpxpy package (UPDATE) which can be used, so we should be fine patching that out. geomag does not seem to be packaged. build.opensuse.org and salsa.debion.org’s CI build the package fine. autopkgtest and piuparts tests fail, I have not looked into this.
    The last release was buggy and failed to work, so I had to use a more current commit (2.6.0+bab4f3cc-1). puremaps releases pretty frequently, so hopefully we can use a *real* release soon.
    Update: pure-maps has released a proper version now, so that is fine. They have also redone their packaging, so that it can make use of a system gpxpy module, which is good.
  • nemo-qml-plugin-dbus-qt5 has been packaged as libnemodbus1 and libnemodbus1-dev. I am not sure if the package naming is ok, it would also seem reasonable to give them a name that is more according to the upstream source package name. It builds fine and all salsa CI tests pass.
  • mapbox-gl-native is tricky. a) it contains a whole bunch of 3rd party submodules. And while the build on my local machine and on build.opensuse.org work fine. Salsa CI complains about modified source files and unrepresentable changes, failing to build. I am not sure now whether those 3rd party modules are part of the .orig source code or something (I believe not), but that needs solving and I don’t know how (that is the build failure on Salsa). The second issue, is that this is a library and the content should be split into a -dev package. Right now it is all bundled in one big package. The patches on top to make QMapboxGL findable by CMake, place those files in /usr/include/qt5/[QMapbox|QMapboxGL|qmapboxgl.hpp|qmapbox.hpp]. Unfortunately the -qml variant searches in /usr/include/<ARCH>/qt, e.g. /usr/include/aarch64-linux-gnu/ (where all the other similar files are placed, so this needs fixing as it requires the ugly hack mentioned below.
  • mapbox-gl-qml just works out of the box. has a bad hack on top (see above). In order to find mapbox-gl-native, I had to hardcode a search path of “/usr/include/qt/” on top. If the issue in mapbox-gl-native were fixed, this hack would hopefully not be needed anymore.
  • We will have to think about how we achieve that mobian prefers the -gles variants in case of:
    libqt5gui5 | libqt5gui5-gles
    libqt5quick5 | libqt5quick5-gles

    some pinephone meta package needs to conflice the former variants or so…
    I did not want to hardcode a requirement on the *gles versions into puremaps as e.g. the amd64 laptop works just fine with the regular DesktopGL ones. Would appreciate creative solutions by experienced packagers.

For Users:

UPDATE: after a period of inactivity, opensuse deleted the repository. A Debian testing repository (so it will work with Mobian and PureOS byzantium too) is available at http://download.opensuse.org/repositories/home:/spaetz/Debian_Testing/. That page also contains instructions on how to integrate the repository.

You can either download all required .deb files directly from here and install them with or integrate the repository directly (which I do not promise to keep up permanently).

A) Installing the .deb files directly

You will be needing the latest .deb files from:

Download and install with sudo apt ./FILE1.deb ./FILE2.deb ...

It will run using software emulation now (prepending LIBGL_ALWAYS_SOFTWARE=1 to pure-maps), but crash when trying to use hardware acceleration. To fix this, you need to install the -gles variant of Qt (instead of the OpenGL variant), these are the alternatives:
libqt5gui5 | libqt5gui5-gles
libqt5quick5 | libqt5quick5-gles

and by default it will have installed the first variant. Just do:

sudo apt install libqt5gui5-gles libqt5quick5-gles

this will uninstall the non-*gles variant and install the *-gles ones.

Now, just using “pure-maps” will work. It will complain about a missing MAPBOX API key (they call it token), to get started switch to the HERE maps (they are no vector tiles, but at least it displays something), and get a Mapbox API key from them (TODO: write Howto).

B) TL;DR: integrating the repository

as user purism (or mobian):

echo 'deb http://download.opensuse.org/repositories/home:/spaetz/Debian_Testing/ /' | sudo tee /etc/apt/sources.list.d/home:spaetz.list
wget -qO- https://download.opensuse.org/repositories/home:spaetz/Debian_Testing/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_spaetz.gpg > /dev/null
sudo apt update
sudo apt install libqt5gui5-gles libqt5quick5-gles pure-maps

Getting maps

Now, just using “pure-maps” will work. However upon start, it will complain about a missing MAPBOX API key (they call it token), to get started switch to the HERE maps (they are no vector tiles, but at least it displays something), and get a Mapbox API key from them (TODO: write Howto).

Notes: Getting location to work

Starting /usr/libexec/geoclue-2.0/demos/agent as user purism before pure-maps makes location work. (perhaps not needed on Mobian?) When the geoclue agent is implemented in phosh this should not be needed anymore.


Credits to rinigus, Bhushan Shah (@bshah:kde.org), @xalius:matrix.org, @PureTryOut:matrix.org, the helpful sur5r@#debian-mentors and everybody who patiently endured my quest for 2 days.