Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider a Gtk+ plugin #2

Closed
probonopd opened this issue Jun 10, 2018 · 18 comments
Closed

Consider a Gtk+ plugin #2

probonopd opened this issue Jun 10, 2018 · 18 comments
Labels
help wanted Extra attention is needed plugin request Plugin requested by the community

Comments

@probonopd
Copy link

(Low priority, mainly a placeholder for the link below I just stumbled across)

Consider a Gtk+ plugin that would bundle the subset of Gtk+ that is needed.
Maybe some code (or inspiration) from https://github.com/jralls/gtk-mac-bundler could be adopted.

@TheAssassin
Copy link
Member

I'd love to see someone maintain such a plugin externally. Do you know anybody who might be interested in that?

@probonopd
Copy link
Author

Maybe @aferrero2707?

@TheAssassin
Copy link
Member

Such a plugin might use https://github.com/TheAssassin/linuxdeploy-plugin-qt for inspiration. This plugin re-uses facilities maintained by the linuxdeploy authors to deploy files into the AppDir.

@TheAssassin
Copy link
Member

@probonopd is there any code that showcases what needs to be done to bundle Gtk+?

@probonopd
Copy link
Author

Not that I am aware of

@TheAssassin TheAssassin added enhancement New feature or request help wanted Extra attention is needed labels Jun 29, 2018
@aferrero2707
Copy link

@TheAssassin @probonopd I think that my GIMP AppImage script can be taken as a good example of bundled GTK+ app, which is also fully relocatable.

Is there a specific reason for using C/C++ for [the Qt plug-in[(https://github.com/TheAssassin/linuxdeploy-plugin-qt), instead of simple bash?

@TheAssassin
Copy link
Member

The Qt plugin makes use of the linuxdeploy_core library which provides an AppDir class that allows for easy deployment of libraries and their dependencies. This is useful for deploying Qt plugin libraries. Also, it copies copyright files for the files it bundles.

Because I wanted to experiment a bit, I wrote the AppImage plugin https://github.com/TheAssassin/linuxdeploy-plugin-appimage in C++ as well. It could be a shell script though, too.

I am working on a bash plugin at the moment, see https://github.com/TheAssassin/linuxdeploy-plugin-checkrt.

@TheAssassin TheAssassin added plugin request Plugin requested by the community and removed enhancement New feature or request labels Jul 15, 2018
@aferrero2707
Copy link

aferrero2707 commented Sep 12, 2018

@TheAssassin @probonopd I have recently done some more work that attempts to generalise the bundling of GTK applications, partly also inspired by your linuxdeploy-plugin-checkrt code.

The current scripts can be found here: https://github.com/aferrero2707/appimage-helper-scripts, and an example of bundling script here: https://github.com/aferrero2707/pf-build-appimage/blob/master/package-appimage.sh

In particular, I took your environment hacking code, but changed a couple of details:

  • the initial environment is saved with an explicit redirection of env | tr '\n' '\0' into a temporary file, which is then read back by read_env_from_process() (see here)
  • the APPDIR environment variable is replaced by a colon-separated list of paths in APPDIRS

The custom functions.sh and bundle-gtk2.sh scripts provide a set of standard functions that help automating the bundling process, while apprun-helper.sh provides some helper functions for the main AppRun script, as shown for example here.

I can explain all the details if you are interested.

@TheAssassin
Copy link
Member

It would be great if you could convert your code into a linuxdeploy plugin to make deploying GTK software as easy as never before. It would be great if you as a sort-of-GTK-expert could maintain that. Also, we'd have a consistent user experience.
If you implemented it in C++, you could even save yourself quite some code as linuxdeploy provides a lot of it already in its core library.

Not sure what you mean with $APPDIRS.

@probonopd
Copy link
Author

Would help the cause if you could closely work together on this, @aferrero2707 and @TheAssassin. From what I observed, the Gtk+ developer community does not really embrace C++ but uses C with glib. Hence it might be worthwhile to implement the Gtk+ plugin using that stack, so that it comes naturally to Gtk+ developers.

@aferrero2707
Copy link

I'm maybe too pessimistic, but I don't expect much help from the GTK devs on this, so I would go for whatever language is more appropriate.

No problem to collaborate with @TheAssassin.

One technical question: does the code support hooks for custom scripts to be run during the bundling process, or should one always implement a plugin?

@TheAssassin
Copy link
Member

does the code support hooks for custom scripts to be run during the bundling process, or should one always implement a plugin?

I'm not sure if I understand. In terms of linuxdeploy, the only way to add functionality is to write plugins. The plugins can do whatever they want. liblinuxdeploy_core is quite flexible, though, you can implement any workflow you can imagine.

@aferrero2707
Copy link

@TheAssassin
Let me give you a practical example. In the GIMP case, on top of the "standard" GTK libraries/configuration files I need to bundle some folders that are specific to GIMP.
Moreover, since GIMP is compiled from sources they are in a different prefix.

Here is an example: https://github.com/aferrero2707/gimp-appimage/blob/master/package-appimage.sh#L285

Such cases cannot be handled by a "generic" GTK linuxdeploy plug-in, hence the need of some "hooks" that allow to run some application-specific commands/actions on top of the generic ones.

I hope it is more clear now.

Anyway, I am planning to start coding some GTK plugin during next week, following the Qt example.

@TheAssassin
Copy link
Member

TheAssassin commented Sep 15, 2018

@aferrero2707 at the moment it's possible to have plugins create an AppRun file, which linuxdeploy will not replace (unlike linuxdeploy, that's a feature for users who ship their own AppRun anyway). See e.g., https://github.com/TheAssassin/linuxdeploy-plugin-checkrt.

The problem is that if multiple plugins try to create an AppRun file, they either have to replace them (losing the functionality other plugins might have installed) or not place their file. We have been discussing some strategies, but didn't like any of them really. If you have a suggestion how we could implement some "install your own startup hooks" feature thingy, please post them.
The best I could come up is to add a directory in the AppDir (e.g., AppDir/startup/myhook.sh), and if that directory is found, instead of a symlink, a shell script (bourne shell syntax for maximum compatibility) is put into the AppDir as AppRun. That script sources all files in that directory, and then parses the root desktop file and executes the application in there.

Edit: if we come up with a solution, we should include it into the plugin specification.

@aferrero2707
Copy link

The best I could come up is to add a directory in the AppDir

This si also what I was thinking about: a folder populated by hook scripts, that can be prioritised with a numerical prefix.

By the way, as I was trying to explain, a similar problem exists when populating the AppDir, because there can be some application-specific things that need to be bundled and that cannot be handled by a generic infrastructure. For example, GIMP has its own configuration files that need to be copied into the AppDir.

My idea would be to solve this problem in the same way, i.e. a folder where to put hook scripts prior to running linuxdeploy.

I will try to come up with a working example during the next days.

@TheAssassin
Copy link
Member

that can be prioritised with a numerical prefix.

I think we should standardize that hooks must not expect to be run in a specific order. If we combine that with a rule that scripts must allow for multiple execution, scripts could check for other scripts, and run them before they make their own changes. Then, you can have a guaranteed, script-specified order of execution.

@TheTumultuousUnicornOfDarkness
Copy link
Contributor

I think this issue can be closed: https://github.com/linuxdeploy/linuxdeploy-plugin-gtk

@TheAssassin
Copy link
Member

Indeed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed plugin request Plugin requested by the community
Projects
None yet
Development

No branches or pull requests

4 participants