xdg-app lets us package applications and their dependencies together for Linux, so a user can just download the application and run it without either the developer or the user worrying about whether the correct versions of the dependencies are on the system. The various “runtimes”, such as the GNOME runtime, get you most of the way there, so you might not need to package many extra dependencies.
I put a lot of work into developing Glom, but I could never get it in front of enough non-technical users. Although it was eventually packaged for the main Linux distros, such as Ubuntu and Fedora, those packages were almost always broken or horribly outdated. I’d eagerly fix bugs reported by users, only to wait 2 years for the fix to get into a Linux distro package.
At this point, I probably couldn’t find the time to work more on Glom even if these problems went away. However, I really want something like xdg-app to succeed so the least I could do is try it out. It was pleasantly straightforward and worked very well for me. Alexander Larsson was patient and clear whenever I needed help.
I first tried creating an xdg-app package for PrefixSuffix, because it’s a very simple app, but one that still needs dependencies that are not in the regular xdg-app GNOME runtime, such as gtkmm, glibmm and libsigc++.
I used xdg-app-builder, which reads a JSON manifest file, which lists your application and its dependencies, telling xdg-app-builder where to get the source tarballs and how to build them. Wisely, it assumes that each dependency can be built with the standard configure/make steps, but it also has support for CMake and lets you add in dummy configure and Makefile files. xdg-app-builder’s documentation is here, though I really wish the built HTML was online so I could link to it instead.
Here is the the manifest.json file for PrefixSuffix. I can run xdg-app-builder with that manifest, like so:
xdg-app-builder --require-changes ../prefixsuffix-xdgapp manifest.json
xdg-app-builder then builds each dependency in the order of its appearance in the manifest file, installing the files in a prefix in that prefixsuffix-xdgapp folder.
You also need to specify contexts in the “finish-args” though they aren’t explicitly called contexts in the manifest file. For instance, you can give your app access to the network subsystem or the host filesystem subsystem.
Creating the manifest.json file feels a lot like creating a build.gradle file for Android apps, where we would also list the base SDK version needed, along with each version of each dependency, and what permissions the app needs (though permissions are partly requested at runtime now in Android).
Here is the far larger xdg-app-builder manifest file for Glom, which I worked on after I had PrefixSuffix working. I had to provide many more build options for the dependencies and cleanup many more installed files that I didn’t need for Glom. For instance, it builds both PostgreSQL and MySQL, as well as avahi, evince, libgda, gtksourceview, goocanvas, and various *mm C++ wrappers. I could have just installed everything but that would have made the package much larger and it doesn’t generally seem safe to install lots of unnecessary binaries and files that I wouldn’t be using. I do wish that JSON allowed comments so I could explain why I’ve used various options.
You can test the app out like so:
$ xdg-app build ../prefixsuffix-xdgapp prefixsuffix ... Use the app ... $ exit
Or you can start a shell in the xdg-app environment and then run the app, maybe via a debugger:
$ xdg-app build ../prefixsuffix-xdgapp bash $ prefixsuffix ... Use the app ... $ exit
Creating or updating an xdg-app repository
xdg-app can install files from online repositories. You can put your built app into a repository like so:
$ xdg-app build-export --gpg-sign="firstname.lastname@example.org" /repos/prefixsuffix ../prefixsuffix-xdgapp $ xdg-app repo-update /repos/prefixsuffix
You can then copy that directory to a website, so it is available via http(s). You’ll want to make your GPG public key available too, so that xdg-app can check that the packages were really signed by you.
Installing with xdg-app
I uploaded the resulting xdg-app repository for PrefixSuffix to the website, so you should be able to install it like so:
$ wget https://murraycu.github.io/prefixsuffix/keys/prefixsuffix.gpg $ xdg-app add-remote --user --gpg-import=prefixsuffix.gpg prefixsuffix https://murraycu.github.io/prefixsuffix/repo/ $ xdg-app install-app --user prefixsuffix io.github.murraycu.PrefixSuffix
I imagine that there will be a user interface for this in the future.
Then you can then run it like so, though it will also be available via your desktop menus like a regular application.
$ xdg-app run io.github.murraycu.PrefixSuffix
Here are similar instructions for installing my xdg-app Glom package.
I won’t promise to keep these packages updated, but I probably will if there is demand, and I’ll try to keep up to date on developments with xdg-app.