Skip to content

Linux packaging docs - #12670

Open
eira-fransham wants to merge 14 commits into
slint-ui:masterfrom
eira-fransham:linux-packaging-docs
Open

Linux packaging docs#12670
eira-fransham wants to merge 14 commits into
slint-ui:masterfrom
eira-fransham:linux-packaging-docs

Conversation

@eira-fransham

Copy link
Copy Markdown
Member

No description provided.

@eira-fransham
eira-fransham requested a review from tronical July 28, 2026 10:17

@tronical tronical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. This is fairly brief and not too much boilerplate. A few comments within. The biggest pain point that I can see is the skia side. See comments within for three options.

import { Aside } from '@astrojs/starlight/components';
import { Tabs, TabItem } from '@astrojs/starlight/components';

Linux, unlike other platforms, has countless ways to distribute applications. Each of these has its own pros and cons, different supported distros, etc. For this article, we will focus on [Flatpak](https://flatpak.org/). Here is an incomplete list of the alternatives, with the reason that we think they are less well-suited to our purposes here than Flatpak:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're in the guide section, I don't think it's really necessary to justify our choice of Flatpak. A short reference to the alternatives is fine IMO. We're not competing with anyone here :)

- [AppImage](https://appimage.org/)
- Less well-supported than Snap and Flatpak, the runtime is not shared between applications so the package size is larger compared to Flatpak and Snap. Additionally, AppImage does not provide sandboxing. Since Slint applications can run seamlessly inside Flatpak/Snap's sandbox, so the increased security of a sandbox doesn't require any tradeoff

Flatpaks are sandboxed, cross-platform, and they are relatively straightforward to create.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a positive key phrase :)

Flatpaks are sandboxed, cross-platform, and they are relatively straightforward to create.

<Aside type="note">
Your application may come with different trade-offs, and so you may want to make another choice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be the box where you could very briefly mention alternatives IMO.

Comment thread docs/astro/src/content/docs/guide/platforms/packaging/linux-packaging.mdx Outdated
Comment thread docs/astro/src/content/docs/guide/platforms/packaging/linux-packaging.mdx Outdated
Comment on lines +54 to +55
# The "runtime" to use. For desktop applications, this will almost always be
# `org.freedesktop.Platform`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's doubt, then I think there's value in explaining it. Otherwise, I think it's better to just state the fact to avoid leaving the reader hanging. Here, I'd just stick to org.freedesktop.Platform and that's it.

A comment on the version might be more relevant, perhaps with a link where readers can find out what versions exists and if it's worth upgrading.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This remains an open point.

CARGO_NET_OFFLINE: "true"
# This is required for Slint's Skia backend, and should match the source below.
# With the FemtoVG backend, you can remove this line and the relevant source.
SKIA_BINARIES_URL: file:///run/build/slint-visual-editor/deps/vendor/skia/skia-binaries-a25a0fdb7d90429aa2d1-x86_64-unknown-linux-gnu-gl-jpegd-jpege-pdf-textlayout-vulkan.tar.gz

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refers to the visual editor. Subsequent for all the skia related bits, I strongly suggest to leave those out of these instructions for now. There's value in supporting Skia here, but I think that could almost go into a separate section.

That said, it's in our interest to support Skia (for our own needs), and for Linux then alternative that I think is easier to support, without the need to hard-code URLs like the above), is to build skia from sources. I think automating that will be easier because instead of the user having to figure out skia-binaries-a25a0fdb7d90429... type of URLs, we can use the existing meta-data in skia-bindings to determine the correct url for the source sources and prepare that.

I tried a local build with skia sources (by setting SKIA_SOURCE_DIR) and that works within the sandbox.

So I see three paths forward:

  1. We keep the above as it is. I'd prefer not, because it'll be outdated by the time we release Slint 1.18.
  2. We omit skia from the instructions for now and I'll try to create a separate PR to add a section and a helper script for apps that would like to include it and then the build will build it from source.
  3. I'll try to finish my experiment with from-source build and we incorporate it in this PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preferred path would be 3, although personally I think this is fine. I give instructions on how to figure out which URL to include.

Not that you're suggesting this, but I definitely don't think that leaving it out is an option since Skia is the best-supported renderer. All of those options are viable though, I wouldn't be unhappy with any of them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included my instructions, so you get to choose :)

Comment thread docs/astro/src/content/docs/guide/platforms/packaging/linux-packaging.mdx Outdated
Comment thread docs/astro/src/content/docs/guide/platforms/packaging/linux-packaging.mdx Outdated
eira-fransham and others added 2 commits July 28, 2026 13:41
…ckaging.mdx

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
…ckaging.mdx

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
@tronical

Copy link
Copy Markdown
Member

One idea I've had is that perhaps it would make sense to integrate this into https://github.com/slint-ui/slint-rust-template . Our tutorial, the vs code extension's quick pick, etc. all use the templates and it would be most convenience to have them in there (maybe in a packaging sub-directory). That's not an acceptance criteria for this PR, but if you feel that this makes sense, please feel free to connect it :)

command: slint-test-package

# The "sdk" to use. Again, this will almost always be `org.freedesktop.Sdk`
sdk: org.freedesktop.Sdk

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also needed this:

sdk-extensions:
  - org.freedesktop.Sdk.Extension.rust-stable

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I meant to mention that below in the Rust section. Good catch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, don't we always need this? For C++ we surely do. For Python and Node.js what's in this template is incomplete.

@tronical

Copy link
Copy Markdown
Member

Here's what I ended up with in terms of Skia support that's perhaps a bit easier to maintain:

  • Added - org.freedesktop.Sdk.Extension.llvm20 to sdk-extensions.
  • In the build-options an append-path with /usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm20/bin
  • Claude wrote this little generator python script: https://gist.github.com/tronical/b31e4542b99b0de1a6b1f7ddcb4636c2 . Running it generates skia-sources.json and prints the gn revision needed for the source build.
  • gn becomes a module to build:
 - name: gn
    buildsystem: simple
    build-commands:
      - python3 build/gen.py --out-path=out --allow-warnings
      - ninja -C out gn
      - install -Dm0755 out/gn ${FLATPAK_DEST}/bin/gn
    sources:
      - type: git
        url: https://gn.googlesource.com/gn.git
        commit: b2afae122eeb6ce09c52d63f67dc53fc517dbdc8 # sha1 taken from flatpak-skia-generator.py output
        disable-shallow-clone: true   # gn's build derives its version from tags
  • The env is extended with
        SKIA_SOURCE_DIR: /run/build/my-app/deps/skia-src
        SKIA_GN_COMMAND: /app/bin/gn
        LIBCLANG_PATH: /usr/lib/sdk/llvm20/lib
  • The cleanup section is extended to also remove /bin/gn

So if the application uses Skia, the dependency is in the lock file, the python script extracts the correct sources and writes them into the sources json file, and gn may or may not be updated (it's not updated frequently IIRC). Overall I think that's not too bad, we could have the python script in our repo and link to it (like we do for the iOS build script), and we could use this ourselves for the visual editor.

Suggested options remain, I just wanted to present my findings that IMO make the from-source build easier to maintain.

…ckaging.mdx

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
@eira-fransham

Copy link
Copy Markdown
Member Author

One idea I've had is that perhaps it would make sense to integrate this into https://github.com/slint-ui/slint-rust-template . Our tutorial, the vs code extension's quick pick, etc. all use the templates and it would be most convenience to have them in there (maybe in a packaging sub-directory). That's not an acceptance criteria for this PR, but if you feel that this makes sense, please feel free to connect it :)

In my opinion, I think we should make a separate project. Putting the .yaml file in the project root is an ok solution, but imperfect. It's one thing to have that be the method in the docs, where we can explain that it's imperfect, it's quite another to have it in the template.

Here's what I ended up with in terms of Skia support that's perhaps a bit easier to maintain:

Funnily enough, I originally wrote out something extremely similar in the docs as a small bash script, but then decided it was overcomplicating things. Just checking the version with cargo metadata, looking at the git tag, then finding the correct binary using the hash tied to that tag. I dropped it because I thought it was overcomplicating things, though.

@tronical

Copy link
Copy Markdown
Member

One idea I've had is that perhaps it would make sense to integrate this into https://github.com/slint-ui/slint-rust-template . Our tutorial, the vs code extension's quick pick, etc. all use the templates and it would be most convenience to have them in there (maybe in a packaging sub-directory). That's not an acceptance criteria for this PR, but if you feel that this makes sense, please feel free to connect it :)

In my opinion, I think we should make a separate project. Putting the .yaml file in the project root is an ok solution, but imperfect. It's one thing to have that be the method in the docs, where we can explain that it's imperfect, it's quite another to have it in the template.

That's fine with me :)

@eira-fransham

Copy link
Copy Markdown
Member Author

gn becomes a module to build:

Using FLATPAK_DEST installs gn into the final output package, it should be installed into /run/build/... or something like that. I honestly think that even if my method is complex, we should avoid recommending that users use some unofficial Python script and add more complexity to their yaml to build gn etc. Your method is better in some ways, but it adds more friction to the very common usecase of just wanting to use Skia inside of a Flatpak-distributed Slint application. I mention ways to figure out if the version of skia-binaries is out of date and how to figure out the correct one, we can try to keep the URL correct when we update to the next version of Slint but even if we don't the user has the tools necessary to fix it.

@eira-fransham
eira-fransham marked this pull request as ready for review July 29, 2026 09:03
@eira-fransham
eira-fransham requested a review from tronical July 29, 2026 09:03
Comment on lines +54 to +55
# The "runtime" to use. For desktop applications, this will almost always be
# `org.freedesktop.Platform`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This remains an open point.

command: slint-test-package

# The "sdk" to use. Again, this will almost always be `org.freedesktop.Sdk`
sdk: org.freedesktop.Sdk

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, don't we always need this? For C++ we surely do. For Python and Node.js what's in this template is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants