I did it!!!!

TL;DR: I have ported to and written my own Wayland compositor using Cocoa 😎


I have ported Wayland (that is libwayland-client, libwayland-server, libwayland-cursor, and wayland-scanner) from Linux to Darwin (Mac OS X 10.6 Snow Leopard to be exact).

Wayland relies on many little things that are specific to Linux (examples: epoll, timerfd, SO_PEERCRED, <linux/input-event-codes.h>), so I had to try and come up with ways to make it work without them.


Show thread

Plus, I couldn't really use autotools or Meson or CMake (nor clone anything over HTTPS) because of the OS being this old, so I had to hand-write and/or generate some Makefiles.

I have then ported some of the clients, including a few from . And to do that, I had to port the Weston toytoolkit.

I had to also port several libraries that Wayland and Weston depend on — among them, libffi, libxslt and libxkbcommon.


Show thread

To top it off, I've written my very own Wayland compositor on top of libwayland-server and Cocoa.

The name's Owl; "wl" stands for Wayland, and "O" for the language it's written in (hint: it's not Swift).

Owl is the server to its Wayland clients and a client to Quartz. You can kinda call it WaylandQuartz, like XWayland and XQuartz, but I like the name Owl way better.


Show thread

I've learned so much about writing a Wayland compositor without , and even some new things about Darwin. Like, who knew OS X < 10.9 doesn't support using pty-s in kqueue? (Oh, that pipe-fork-select-proxy workaround I've implemented for this in weston-terminal!)

So no @espectalll, you're not the last one to boot Snow Leopard in 2019 😉


Show thread


Answer A: I'm not a big fan of today's Apple nor of today's macOS, but I'm fascinated by the old versions. And Snow Leopard was the best classic OS X release.

Answer B: No particular reason; it's more fun this way because there's more of a challenge, perhaps?


Mind to share the Linux specific api you had to reimplement? Whenever I want to port something to Jehanne, I find such kind of surprises.

I just realised it would be nice to have such #portability issues listed somewhere so that #osdev people can do a better planning.

@Shamar I mostly had to workaround the lack of these rather than reimplement them, but here you go:
• clock_gettime() and related APIs
• epoll
• signalfd, timerfd
• strndup(), strncpy()
• pipe2()
• SO_PEERCRED, struct ucred
• mremap()
• prctl()
• <linux/input.h>
• <pty.h>
• (old versions of cairo and pixman)
• program_invocation_short_name

@bugaevc @Shamar • strndup(), strncpy()

a.k.a. the bad version of strldup(), strlcpy() 😬


It's a lot of Linux specific stuff to emulate for a new operating system. I'm rather surprised that it's so unportable for a "new" project, but I guess portability is not a huge issue to #Wayland developers: they focus on performance most.

I have to admit that I have no idea about #X11's portability but I guess it's not so coupled with Linux as over years it has been ported a lot.

Anyway, really @bugaevc, thank for sharing!

@bugaevc Weston seemed insanely responsive when I tried it. But I don't know if that's because it's not very featureful yet 😋

@kai Mutter is too going to be super smooth when they fix frame scheduling and stuff

@bugaevc omg
does it also run on mojave? would be quite useful for development

@cpsdqs perhaps

I haven't tried it (yet), but I see no reason why it wouldn't work.

@bugaevc That looks like quite an old macOS version. Is this 10.5 on PPC?

@js this is 10.6 (it's in the screenshot and mentioned further in the thread), on Intel.

I need to double-check, but IIRC Owl itself is 32-bit (since there was no 64-bit Cocoa), but the clients are 64-bit. The libraries are universal.

@benwaffle aha, finally somebody asked me that! :D

I have not yet decided what to do about this. I do want to eventually release it so that perhaps someone could even use it for something, and others could contribute if they're interested. But I need to fix many TODOs first, clean up the code in general, write build instructions, etc. etc., and I'm not sure when I'm going to get enough motivation to work on that.

That being said, if you're interested, PM me and I'll send you the sources.

@bugaevc what i would do is just toss the sources up regardless of the quality

@npyl how come this is your first toot, of all things?

Do I know you? You're the one that asked about Darling Foundation, right?

@bugaevc Yup, im the one that asked. I saw the mastodon link on your github profile and when i followed it first tout was this one! :)

@npyl ah, that explains it! :D

Well, welcome to :mastodon: then! Do you known your way around here or do you need some pointers?

And note that that toot is the beginning of a longer thread (that's why it's marked "0/5"); perhaps you've noticed but maybe you didn't.

@bugaevc Yup i noticed that too, and I kinda found them awesome aswell. xD

It's good to be a part of this community, though I'm totally new here, if you are so kind any pointers would be welcome! :)

• read these:
• follow some interesting people! Here are some recommendations from me to bootstrap your home feed: @jamey @JPEG @alcinnz @brunoph @brion @wezm @ikyle @uliwitness @schlink (don't forget to untag all these people if you reply to this toot!)
• there's always interesting stuff on the local timeline
• search for # introductions, post your own
• interact with people, make friends!

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!