https://github.com/kdroidfilter/composedesktoplinuxdeps
Gradle plugin for Compose Desktop that injects Linux package dependencies into jpackage outputs (DEB): add Depends:/Requires: automatically.
https://github.com/kdroidfilter/composedesktoplinuxdeps
Last synced: 4 months ago
JSON representation
Gradle plugin for Compose Desktop that injects Linux package dependencies into jpackage outputs (DEB): add Depends:/Requires: automatically.
- Host: GitHub
- URL: https://github.com/kdroidfilter/composedesktoplinuxdeps
- Owner: kdroidFilter
- License: mit
- Created: 2025-08-14T22:03:38.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-10-22T07:15:37.000Z (8 months ago)
- Last Synced: 2025-10-22T09:16:36.381Z (8 months ago)
- Language: Kotlin
- Homepage: https://plugins.gradle.org/plugin/io.github.kdroidfilter.compose.linux.packagedeps
- Size: 64.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# π¦ 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](https://youtrack.jetbrains.com/issue/JBR-9114)).
## π Requirements
* π§ Debian/Ubuntu build env with `dpkg-deb` β `sudo apt-get install dpkg-dev`
* π» Using Compose Multiplatform packaging (`packageDeb` / `packageReleaseDeb`)
## π Quick start
```kotlin
// build.gradle.kts
plugins {
id("io.github.kdroidfilter.compose.linux.packagedeps") 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:
```bash
./gradlew packageDeb
# or
./gradlew packageReleaseDeb
```
## βοΈ What it does
* π Finds the jpackage-generated `.deb`
* β Adds/merges a `Depends:` line in `DEBIAN/control` (de-duplicates)
* π Writes `StartupWMClass=` into `.desktop` files if configured
* π¦ Rebuilds the `.deb`
## π Troubleshooting
* β **`dpkg-deb not found`** β `sudo apt-get install dpkg-dev`
* π **No `.deb` found** β run `./gradlew packageDeb` first
* πΌ **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`.