Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

159.7. geoclue-2.8.2

D-Bus geolocation service (what xdg-desktop-portal's Location portal asks)

Version 2.8.2, release 1
Shelf gis — GIS, maps, projections, GPS, navigation and location
Phase 41_system (System), 590 of 1047 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home
Build time 1.0 SBU
Installed size 1.2 MiB in 33 files
Recipe ports/core/gis/geoclue/kpkgbuild

About

GeoClue is the D-Bus geolocation service: a program asks it on the system bus for the machine’s position, and it answers from Wi-Fi networks, the cellular modem, a GPS feed, the IP address or a fixed location. KDOS carries it because it is what xdg-desktop-portal’s Location portal asks, and libgeoclue, the client convenience library, is what xdg-desktop-portal links for it. How the service runs on KDOS, with no consent agent, is in Access, and what it unlocks.

Sources

Dependencies

Depends on: meson, glib, gettext, json-glib, libsoup3, modemmanager, avahi, dbus.

Required by (3): qt6-qtpositioning, viking, xdg-desktop-portal.

Patches

build.sh applies these; kpkg applies nothing by itself.

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 geoclue'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gis/geoclue.

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/geoclue
echo 'd4d65933b704d4c8d4ca9747dc511b883e35099abe534c8560f2aab3017e4cd4  geoclue-2.8.2.tar.bz2' | 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/geoclue
SRC=$SRC_ROOT/geoclue-2.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf geoclue-2.8.2.tar.bz2 -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/no-agent.patch"
meson setup build \
	--prefix=/usr --sysconfdir=/etc --libdir=lib \
	--libexecdir=/usr/lib \
	--buildtype=release \
	-Dlibgeoclue=true \
	-Dintrospection=false \
	-Dvapi=false \
	-Dgtk-doc=false \
	-Dwifi-source=true \
	-D3g-source=true \
	-Dcdma-source=true \
	-Dmodem-gps-source=true \
	-Dnmea-source=true \
	-Dstatic-source=true \
	-Dip-source=true \
	-Dcompass=true \
	-Denable-backend=true \
	-Ddemo-agent=false \
	-Ddbus-srv-user=geoclue
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

rm -rf "$PKG/usr/lib/sysusers.d" "$PKG/usr/lib/systemd"

rm -f "$PKG/usr/share/applications/geoclue-where-am-i.desktop"
rmdir "$PKG/usr/share/applications" 2>/dev/null || true

install -Dm644 /dev/stdin "$PKG/etc/geoclue/conf.d/90-kdos.conf" <<'CONF'
[agent]
whitelist=

[xdg-desktop-portal]
allowed=true
system=true
users=
CONF

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

postinstall.sh runs on the installed system after the package is adopted:

# The account D-Bus activation starts geoclue as: its .service file says
# User=geoclue, and dbus-daemon-launch-helper refuses to start a service whose
# user does not exist. Created under PKG_ROOT, the root kpkgadd is installing
# into, and guarded by reading the files, as avahi's hook is.
root="${PKG_ROOT:-/}"
grep -q '^geoclue:' "$root/etc/group" 2>/dev/null || groupadd -R "$root" -r geoclue
grep -q '^geoclue:' "$root/etc/passwd" 2>/dev/null || \
	useradd -R "$root" -r -g geoclue -d /nonexistent -s /sbin/nologin geoclue

# The guard leaves an existing account as it is, so the home is set apart
# from it: a tree that already has the account takes /nonexistent too. usermod
# exits 0 without writing when the home is already /nonexistent.
usermod -R "$root" -d /nonexistent geoclue

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/geoclue, 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 geoclue-2.8.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/geoclue, and runs the triggers its paths call for.

Contents

Installed libraries: libgeoclue-2.so.

Installed directories: /etc/geoclue, /usr/include/libgeoclue-2.0, /usr/lib/geoclue-2.0, /usr/share/licenses/geoclue.

Short descriptions

geoclue-2.0.pc The Geoinformation Service
libgeoclue-2.0.pc A convenience library to interact with Geoclue service

Notes

build.sh writes /etc/geoclue/conf.d/90-kdos.conf, which the service reads after its main configuration. It empties the [agent] whitelist, the condition no-agent.patch tests, and gives the portal, [xdg-desktop-portal], allowed=true and system=true, so the Location portal is treated as a system component for every user. The result is that GeoClue answers any client on the system bus that is not refused by name; see known gaps.

The geoclue account is made by postinstall.sh, under PKG_ROOT, the root the package is being installed into. dbus-daemon-launch-helper refuses to start a service whose User= does not exist, so without the account the first client’s request fails. Its home is /nonexistent: geoclue writes no files. The hook creates the account only when etc/passwd lacks it, and then sets the home with usermod whether it created the account or not, so a tree that already had a geoclue account with another home is given /nonexistent as well. The sysusers.d file upstream installs for the same account is removed with the systemd directory: both are systemd’s.

where-am-i, the demo client, stays installed as a command under /usr/lib/geoclue-2.0/demos. Its desktop entry, which upstream marks NoDisplay=true, is removed.

D-Bus starts the service when the first client asks, and it exits after a minute with none, so there is no init script.