ComposeDesktopLinuxDeps
Gradle plugin for Compose Desktop that injects Linux package dependencies into jpackage outputs (DEB): add Depends:/Requires: automatically.
Install / Use
/learn @kdroidFilter/ComposeDesktopLinuxDepsREADME
📦 Compose Desktop Linux Package Deps (DEB)
Small Gradle plugin for Compose Desktop that automatically adds Debian Depends: to the .deb generated by jpackage.
Can write StartupWMClass into .desktop files to fix dock/taskbar icons (fixes JBR-9114).
🛠 Requirements
- 🐧 Debian/Ubuntu build env with
dpkg-deb→sudo apt-get install dpkg-dev - 💻 Using Compose Multiplatform packaging (
packageDeb/packageReleaseDeb)
🚀 Quick start
// build.gradle.kts
plugins {
id("io.github.kdroidfilter.compose.linux.packagedeps") version "<version>"
}
linuxDebConfig {
// add dependencies to DEBIAN/control
debDepends.set(listOf("libqt5widgets5t64", "libx11-6"))
// if you want to add dependencies with alternatives for compatibility with older OSes, add them like this:
debDepends.set(
listOf(
"libqt5core5t64 | libqt5core5a",
"libqt5gui5t64 | libqt5gui5",
"libqt5widgets5t64 | libqt5widgets5",
)
)
// set StartupWMClass to fix dock/taskbar icon
startupWMClass.set("MainClassKt")
//for Ubuntu 24 t64 dependencies compatibility with older OSes, see below Under Known jpackage issue: Ubuntu t64 transition
enableT64AlternativeDeps.set(true)
}
Build as usual:
./gradlew packageDeb
# or
./gradlew packageReleaseDeb
⚙️ What it does
- 🔍 Finds the jpackage-generated
.deb - ➕ Adds/merges a
Depends:line inDEBIAN/control(de-duplicates) - 🖊 Writes
StartupWMClass=into.desktopfiles if configured - 📦 Rebuilds the
.deb
🐞 Troubleshooting
- ❌
dpkg-deb not found→sudo apt-get install dpkg-dev - 📂 No
.debfound → run./gradlew packageDebfirst - 🖼 Dock icon not matching → set
startupWMClass(e.g.,"MainClassKt")
❗ Known jpackage issue: Ubuntu t64 transition
There is an upstream jpackage quirk related to the Ubuntu/Debian time_t (t64) transition:
- When you build on Ubuntu 24.04 (or newer), jpackage resolves and injects dependencies as they exist on the build host. It writes t64 package names (for example: libasound2t64, libpng16-16t64) into the Depends field. Those packages don’t exist on Ubuntu 22.04, so the .deb won’t install there.
- Conversely, if you build on Ubuntu 22.04, the produced .deb depends on non‑t64 packages (libasound2, libpng16-16). On Ubuntu 24.04, the system prefers the t64 variants, which can cause incompatibility.
How this plugin helps
- Set linuxDebConfig.enableT64AlternativeDeps = true to make the plugin rewrite the existing Depends line generated by jpackage into alternatives that work on both sides:
- libasound2t64 (and optional version) → libasound2t64 (same version) | libasound2
- libpng16-16t64 (and optional version) → libpng16-16t64 (same version) | libpng16-16
- libasound2 (and optional version) → libasound2t64 (same version) | libasound2
- libpng16-16 (and optional version) → libpng16-16t64 (same version) | libpng16-16
- Only the dependencies already present in DEBIAN/control (added by jpackage) are rewritten. Entries you add via debDepends are not modified.
Examples
- Before (built on Ubuntu 24.04): Depends: libasound2t64, libpng16-16t64, …
- After (with enableT64AlternativeDeps=true): Depends: libasound2t64 | libasound2, libpng16-16t64 | libpng16-16, …
📜 License
MIT — see LICENSE.
