Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Set up a development environment

This page lists what to install to build and test Tetheron on Ubuntu 24.04, Linux Mint 22 or a later release of either. Set up only the parts you work on: the desktop side builds without the Android toolchain, and the Android app builds without Rust. For a guided first run, follow the tutorial.

Set up the Linux toolchain

  1. Install the libraries and plug-ins that the desktop workspace builds and tests against. CI installs the same list (desktop.yml):

    sudo apt install \
      libgtk-4-dev libadwaita-1-dev libdbus-1-dev pkg-config build-essential \
      libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
      gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
      gstreamer1.0-libav gstreamer1.0-gl
    
    PackagesNeeded for
    libgtk-4-dev, libadwaita-1-dev (1.5 or newer)the GTK app
    libdbus-1-dev, pkg-config, build-essentialevery crate
    libgstreamer1.0-dev, libgstreamer-plugins-base1.0-devthe mirror window of the app (feature mirror) and phone audio and webcam in the daemon (features audio, webcam)
    gstreamer1.0-plugins-base, -good, -bad, -libav, -glrunning the mirror window and phone audio. The decoder tests skip a decoder that is not installed

    On Fedora, the same libraries are in gtk4-devel libadwaita-devel dbus-devel gcc pkgconf-pkg-config gstreamer1-devel gstreamer1-plugins-base-devel. On Arch Linux they are in base-devel gtk4 libadwaita dbus gstreamer gst-plugins-base. The run-time plug-ins are the ones in Install Tetheron on Linux. CI builds on Ubuntu only.

    You do not need protoc. The Rust build compiles the .proto files with protox.

  2. Install Rust with rustup. The minimum supported version is the rust-version in desktop/Cargo.toml, currently 1.85. CI builds with the latest stable release, so a lint that is new there can fail CI although your older toolchain accepts the code. Nightly features are not used.

  3. Add the two components that CI runs:

    rustup component add rustfmt clippy
    
  4. Build and test the workspace:

    cd desktop
    cargo build --workspace
    cargo test --workspace
    

Programs the daemon uses at run time

The daemon builds without these, and reports the features that need them as unavailable. The Debian package depends on or recommends them.

Program or packageUsed for
avahi-daemonmDNS discovery. Without it the daemon falls back to UDP beacons and manual addresses
adb, version 34.0.0 or newerthe enhanced tier
pw-dump, pw-link, pw-metadata, pipewire (package pipewire-bin), wpctl (package wireplumber), libspa-0.2-bluetooth, bluezcall audio on the PC
xclip (X11) or wl-copy (Wayland)setting the desktop clipboard while the GTK app is not running
wmctrlkeeping the call banner and “stay on top” windows above others on X11
v4l2loopback-dkms, v4l2loopback-utilsphone as webcam

Optional tools

To build the Debian package, install cargo-deb. Add lintian (sudo apt install lintian) to lint the package as CI does.

cargo install cargo-deb --locked

To preview this documentation, install the mdBook version that CI uses (see Write documentation):

cargo install mdbook --locked --version 0.5.4

Set up the Android toolchain

You need this only to build the Android app or to run its unit tests.

  1. Install a JDK. CI builds with JDK 21 (Eclipse Temurin). JDK 17 also works, because the app is compiled for Java 17. Check with java -version.

  2. Install the Android SDK packages that the build uses: platform 35, build tools 35.0.0 and the platform tools (which contain adb). With the SDK’s sdkmanager:

    sdkmanager --sdk_root=$HOME/Android/Sdk \
      "platforms;android-35" "build-tools;35.0.0" platform-tools
    
  3. Tell Gradle where the SDK is. Either set ANDROID_HOME to the SDK directory, or create android/local.properties (git ignores the file), with your user name in place of <you>:

    sdk.dir=/home/<you>/Android/Sdk
    
  4. Run the unit tests and build the debug APK:

    cd android
    ./gradlew :app:testDebugUnitTest :app:assembleDebug
    

    The wrapper downloads the Gradle version the project uses (8.11.1) on the first run.

Android Studio is optional. CI runs the command-line build above (android.yml). The Wire Gradle plug-in generates the Kotlin classes for the protocol from proto/ at build time.

Prepare a phone for testing

The app needs Android 14 or newer (minSdk = 34).

  1. On the phone, turn on Developer options: open Settings, then About phone, then Software information, tap Build number seven times and enter your PIN. These are the names on Samsung phones. Other phones name them slightly differently.

  2. In Settings, open Developer options and turn on USB debugging.

  3. Connect the phone with a USB cable. The phone asks whether to allow USB debugging from this computer. Tick Always allow from this computer and accept. The authorisation can be lost after the cable is replugged or debugging is toggled. Accept the prompt again when that happens.

  4. Check that adb lists the phone as device (unauthorized means the prompt was not accepted):

    adb devices
    
  5. Install the app as described in Build, run and install from source.

Some features need permissions that can only be given over adb. The enhanced tier set-up applies them for you. The list is in Android permissions and grants.

Warning

A test phone is often the phone you use every day. Before you run any test that captures the screen, audio, the clipboard or the camera, read “Test against a real phone” in Test your changes.

Without a spare phone you can still work on most of the desktop side: the GTK app has a fake daemon and the daemon has a fake phone, both described in Test your changes.

Editors

The repository ships no editor or IDE configuration, and git ignores .idea/ and .vscode/. The tools define the formatting: cargo fmt for Rust and the official Kotlin style (kotlin.code.style=official) for Kotlin. See Code style.