Add FreeBSD compatibility

Merged Val Packett requested to merge github/fork/unrelentingtech/freebsd-compat into master

Hi, it's me, again :)

(Do not merge this just yet!)

So, it works on X11, can't test on DRM/KMS for now because kernel panic. (well, I could install a couple month old kernel where wlc/sway worked, but I'll look into fixing the problem instead)

  • -Wno-error=deprecated-declarations because warning: 'wl_buffer' is deprecated. This comes from EGL/eglmesaext.h. I have Mesa 17.2.2 and Wayland 1.13.0, but seems like it was deprecated a long long time ago. You didn't encounter this on Linux? o_0
  • the libinput ifdefs are for compatibility with version 1.6.0 (damn we have to catch up…)
  • There's the environ linking issue (undefined symbol). Maybe because of some linker flag that meson uses…
  • I'm not sure about the raw terminal thing (from — @johalun why did wlc both save/restore termios state and set the raw flag?
  • The elephant in the room. The ugly part of the patch. The _POSIX_C_SOURCE / _XOPEN_SOURCE stuff. What does it do on Linux? On FreeBSD, it actually makes all the headers compliant with old POSIX specifications and nothing more (__BSD_VISIBLE gets disabled) — so we lose CLOCK_MONOTONIC, minor/major, snprintf and a bunch of other stuff I already forgot. Currently I have ifdef'd these defines to Linux where they caused problems, but that's really bad. What do you think about them? Are they actually necessary anywhere at all?

Merge request reports