September 6, 2016 - Reynaldo Verdejo
Wayland Uninstalled, the Easy Way
I recently had to start looking at some GStreamer & Wayland integration issues and, as everyone would, commenced by trying to setup a Wayland development environment. Before getting my feet wet though, I decided to have a chat about this with Derek Foreman: our resident Wayland expert. This isn’t surprising because on our team, pretty much every task starts by having a conversation (virtual or not) with one of the field specialists in the group. The idea is to save time, as you might have guessed.
This time around I was looking for a fairly trivial piece of info:
Me – “Hey Derek, I have Wayland installed on my distro for some reason – I don’t really want to take a look at now – and I would like to setup an upstream (development) Wayland environment without messing it up. Do you have some script like GStreamer’s gst-uninstalled so I can perform this feat without messing with my local install at all?
Derek – “Hey Reynaldo, No.”
After that, and taking care of the usual I-forgot-to-ask-how-you-were-doings, I’m not sure who’s idea it was but we decided to try to upstream a wl_uninstalled script (the name had to match existing infrastructure, but this is a long and boring story you don’t want to know about) that, like gst-uninstalled, enables developers to quickly setup and use a build and run-time environment consisting of an uninstalled set of interdependent Wayland repositories. The idea is not new, but is still extremely useful. Sure, you can perform similar feats by littering your local disk (yes, I’m that old) with custom-prefix installs of pretty much anything and hope to hit the right buttons to build and exec stuff on your neat patchwork piece, but hey, it is bad taste OK? and you will waste a lot of time, especially the first time.
As if the foreword wasn’t boring enough and just to try your resilience, here are the instructions to use this beauty:
How Wayland Uninstalled Works
Essentially, wl_uninstalled is a helper script that automates the setup needed to build and work with an uninstalled Wayland/Weston environment comprised at least of the wayland, wayland-protocols, libinput, and weston repositories. The wl_uninstalled script provides a shell environment where all build and run-time dependencies are resolved in such a way that the uninstalled versions of these projects take precedence.
A Quick Guide to Using Wayland Uninstalled
I’ll use Weston as an example although other Wayland-based projects should work as well.
Edit a local copy of the script to make $WLD point to the base directory where the repositories are located, make sure to use the absolute path. Then, after executing the script, issue the following commands to get everything built and weston running from the uninstalled environment:
for i in wayland wayland-protocols libinput weston; do cd $i && ./autogen.sh && make && cd ..; done
Here’s a short console-cast that shows this same procedure live.
This work is now upstream, you can see the discussions by searching for ‘uninstalled’ in the Wayland mailing lists discussions for August. As an added bonus, it turned out that fiddling with this uninstalled environment mambo-jambo lead to the uncovering of a few additional broken pieces of buildsystem/pkg-config cruft that we fixed too. ‘Cause we are good as that see 😉
Back to my own use case – GStreamer / Wayland integration work -, now I can simply exec the wl_uninstalled script before gst-uninstalled and I’m all set. My uninstalled GStreamer environment will use my (in-turn) uninstalled Wayland/Weston environment. This makes debugging, fixing and integrating against the upstream version of both projects a breeze, and my filesystem more FHS-compliant. But then again, who cares about that; you probably just want all this to be quick and painless. I’m in the same boat.
While all patches for this are on Wayland’s public mailing list, not all have been merged yet.If you want to try the procedure described here you will need to manually apply the missing ones till they find their way into the official repository:
The official version of the script lives here.
Reynaldo, one of the founder members of our OSG Multimedia team, is a FOSS developer from Chile (Now living in sunny California). He has spent most of his adult life contributing to projects in the multimedia processing field and his work can be seen in major open source / free software projects like GStreamer and FFmpeg. When he is not in front of a computer, or giving a talk somewhere, he spends the time with his wife and their 3 daughters or trying to learn something new (preferably analog). Late hobbies include kayaking and motorcycling and he is proudly stating he can both float and ride now!
Image Credits: Kristian Høgsberg