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.
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 #Weston. 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.
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.
I've learned so much about writing a Wayland compositor without #wlroots, 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!)
Any specific reason for using 10.6?
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?
@Shamar I mostly had to workaround the lack of these rather than reimplement them, but here you go:
• MSG_NOSIGNAL, MSG_DONTWAIT
• clock_gettime() and related APIs
• signalfd, timerfd
• strndup(), strncpy()
• O_CLOEXEC, SOCK_CLOEXEC, F_DUPFD_CLOEXEC, MSG_CMSG_CLOEXEC
• SO_PEERCRED, struct ucred
• (old versions of cairo and pixman)
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 that's awesome!
Quick! Version control and backup asap!
@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
does it also run on mojave? would be quite useful for development
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.
@bugaevc holy shit!!! 😱 Congratulations!!!
@bugaevc Nice, do you have plans to release it?
@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
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!
We adhere to an adapted version of the TootCat Code of Conduct and follow the Toot Café list of blocked instances. Ash is the admin and is supported by Fuzzface, Brian!, and Daniel Glus as moderators.
Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!