Vaxry's blog

01000100010011

Hyprland and the bundled wlroots

17 XI 2022

3.6k

As you may have noticed, if you are a Hyprland user, Hyprland does not depend on wlroots. However, it still is a wlroots-based compositor. How is that?

Well, in short, Hyprland bundles wlroots. What that means, is that there is a git submodule in the Hyprland tree, and that wlroots is locally built, then Hyprland uses that instead of the system wlroots.

Rightfully, this might seem like a weird choice. This is not Windows, and wlroots is available in every repository on the planet. So, what is going on?

In the beginning, Hyprland did not bundle wlroots. We just would depend on wlroots-git. This, however, introduced a lot of problems. Since wlroots devs are not me, I don't get a warning when wlroots' upstream commits a breaking change. This has led to many incidents over time where one day Hyprland just stopped compiling, and I had to step in at 2AM and fix the compile. Not a super terrible thing if it was a 5 minute fix, worse if it was a 5 hour one. At any rate, both scenarios are pretty bad.

That's where bundling entered the scene. By locking the commit, I am able to update the wlroots dep every 1-2 weeks, keeping it still very up to date, while also being able to ensure everything is alright beforehand.

Long live bundling then! What's all the fuss about?

Well, bundling has its fair share of issues too, some purely philosophical, and some, more tangible.

Firstly, there is the problem of packaging. Although bundling in itself is not an issue here, (if anyone thinks bundling is the root of problems they are either stupid or basing this purely on their "philosophy") the wlroots-git is. Bundling such a bleeding-edge version leads to package issues. It's often seen on Fedora, and sometimes on NixOS as well. Wlroots-git can depend on a wayland-protocols update from an hour before, for example. What then? Well, let's say Arch updated their repos, but Fedora didn't. That means, that Fedora users got f-d and can't compile Hyprland now without recompiling Wayland-protocols as well. One funny example of that was the recent hwdata dep bump, that caused Nix users to have to recompile (as far as I can tell) up to over 10 THOUSAND packages. (that is the amount of packages that depend on hwdata) Fun.

The pros of bundling include the aforementioned stability, but also the newest features from wlroots upstream.

Why not just use tagged wlroots??

Because Hyprland is aiming to be bleeding edge, offering users the newest features from wlroots. Maybe if Wayland finally merges the protocols people are complaining about the lack of all the time I will consider switching to tags.

Can't you just build against a tag and -git separately, like e.g. Sway?

Short answer: No. Long answer: Noooooooooooo.

The difference between Sway and Hyprland is that Sway is an almost dead project by now. It's pretty feature-complete (for what the devs are willing to add) and rarely gets feature updates. If you think that is not true, Sway has received 161 commits (as of writing) since 1.7, which released on 22 Jan 2022. Hyprland started in March 2022 and has already gotten over 2200 commits. It's unthinkable to release a Hyprland tag every 8 months at this stage of development. Unfortunately, keeping two separate versions of Hyprland is also not a great option. The amount of breaking changes in wlroots between tags is not small. That would mean a very dirty patchset to keep Hyprland compiling on both the tagged and master wlroots. I already have to keep track of NO_XWAYLAND. This would make it from 2 to 4, and add EVEN MORE variability to the codebase. Considering I am just one 19-year-old dude, this would be hellish to maintain.

As you can see, bundling has its pros and cons. However, considering the current circumstances, it seems like the best way of keeping up to date while also being maintainable for me.

I understand that many distros will choose not to package Hyprland because of the -git dependencies, but that's fine. I am always open to people contributing instructions to get Hyprland to run on other distros manually, and if your favorite distro is missing, feel free to make a PR to the wiki.

It's even possible to compile Hyprland on Ubuntu with relatively little effort ;)

Have a nice day everyone. I hope this blogpost has cleared at least some of the reasons as to why things are the way they are.


Questions, comments, mistakes? Ping me a mail at vaxry [at] vaxry.net and I'll get back to ya.