linuxdeploy / linuxdeploy-plugin-gtk

Gtk+2/3 plugin for linuxdeploy. Bundles Gtk+ resources, GLib schemas, and a lot more.
MIT License
23 stars 13 forks source link

Is this still necessary for modern Gtk4/Libadwaita programs? #60

Open Korne127 opened 1 week ago

Korne127 commented 1 week ago

I've recently spent a lot of time looking into AppImages and how to package them.

I noticed that since this plugin has first been developed, the excludelist has been changed. Especially glib and its dependencies are now always bundled in AppImages, see this comment by @probonopd:

Looks like we arrived at the conclusion that Glib/Gdk/Gtk/Pango/Cairo from the operating system usually can't be used and the whole stack of these and other closely related (e.g., libthai and possibly harfbuzz) libraries all need to be privately bundled.

Therefore I am not entirely sure whether this plugin is required anymore. When I tested packaging my Gtk4/Libadwaita project, I noticed that this plugin doesn't seem to be necessary: I created a new virtual machine and installed Arch on it (with X-Org, LXQt and Openbox) without any GTK dependencies. I then tested both version of my program (packaged with linuxdeploy) on it: One with the GTK plugin and one without. And both worked (without a different terminal output). So I'm not sure whether this plugin is necessary anymore. For the record, I should mention that I do not use any icon assets of any theme in my project, so I don't know whether the plugin changes anything related to that though.

I did notice one major difference though: While my GTK code uses Libadwaita, the AppImage without this plugin was displayed correctly (with the Libadwaita theme) while the version built with this plugin was displayed with the default theme (as if I hadn't used Libadwaita but just GTK-4). So this is certainly a bug of this plugin that should be fixed. I would have made this a separate issue, but as I'm unsure whether the plugin is needed at all, I'll just keep it here for now.

@TheAssassin Can you maybe explain what this plugin actually does and what it changes with the AppImage? Is there still something I'm missing this plugin is required for? Or is it actually not necessary anymore for Gtk4/Libadwaita?

TheTumultuousUnicornOfDarkness commented 6 hours ago

Well, I remember this plugin was required for GTK3 at least. It was a long time ago, but I faced a lot of compatibility issues without this plugin in the past, especially when the GTK version was not the same during the build (e.g. Ubuntu LTS) and the run (e.g. an up-to-date Arch Linux). The oldest supported version of Ubuntu for GitHub Runners is 20.04, meaning GTK 3.24 (AKA the latest GTK3 version).

[...] while the version built with this plugin was displayed with the default theme

Please refer to #39.

[...] is it actually not necessary anymore for Gtk4/Libadwaita?

The excludelist is from pkg2appimage, it is not related to linuxdeploy. I did not invest time in GTK 4.x, because I lost interest with GTK (GTK 3.x was a burden between each minor releases). But I fixed a lot of issues with this plugin, like #1, #6, #8, #9, #10, #13 and #18. I have no idea how you are building your AppImage, but the GTK4 libraries are somewhere. You can extract the AppImage to check the tree.

Korne127 commented 4 hours ago

Hey, thanks for your detailed answer, I appreciate it.

The excludelist is from pkg2appimage, it is not related to linuxdeploy.

That's actually wrong! That excludelist is hosted on pkg2appimage, but it's used by most AppImage creation tools including Linuxdeploy. Linuxdeploy uses the excludelist that was up-to-date at compile-time of the release, see https://github.com/linuxdeploy/linuxdeploy/issues/286. So I still think that this might be the reason for it working, as the GTK libraries used to be on the excludelist, but got removed.

especially when the GTK version was not the same during the build (e.g. Ubuntu LTS) and the run (e.g. an up-to-date Arch Linux)

Yeah, that supports my thought, as by now AppImages only use the GTK version that's used during the build and shipped in the AppImage itself.

Please refer to #39.

Thanks for the link, that's interesting. Although it contradicts my experience a bit. In there, it is stated that Adwaita is hardcoded as a theme, but I have the problem that I have a normal Libadwaita application with the Adwaita theme and it is not used (instead, the old default theme is used as a fallback). Maybe I misunderstood something?

TheTumultuousUnicornOfDarkness commented 4 hours ago

That's actually wrong! That excludelist is hosted on pkg2appimage, but it's used by most AppImage creation tools including Linuxdeploy. Linuxdeploy uses the excludelist that was up-to-date at compile-time of the release, see linuxdeploy/linuxdeploy#286. So I still think that this might be the reason for it working, as the GTK libraries used to be on the excludelist, but got removed.

Ah, my bad, I was not aware of the generate-excludelist.sh script in linuxdeploy that relies on pkg2appimage excludelist, sorry. Yes, it seems you are right because Glib and other stuff are no more part of the excludelist (AppImageCommunity/pkg2appimage@1e3ecde6b92ef198405463415b8090a4435d0cb0, AppImageCommunity/pkg2appimage@199fc9f768b35ad6166109299e5cf3832adeb5d5).

My knowledge about Libadwaita is very limited. I cannot say if this plugin is still necessary for GTK4, maybe it depends of application needs (like GDK PixBufs).

TheAssassin commented 3 hours ago

Just a side note: @probonopd and I are currently looking into truly bundling everything in the future. Right now, linuxdeploy still relies on the excludelist.