Post AXemfxSa7WLLsCF5do by netbsd@mastodon.sdf.org
 (DIR) More posts by netbsd@mastodon.sdf.org
 (DIR) Post #AXemfsQyo35iHmSEwy by alecui@qoto.org
       2023-07-13T01:37:30Z
       
       0 likes, 0 repeats
       
       I might get more responses over here:Invoking all #bsd people (or rather, some :P) (I guess some specific tags are useful, so #freebsd #netbsd #openbsd #dragonflybsd and a bunch more)I am, for the time being, a Linux user (cringe). I want to make a lightweight desktop environment (but it could be any non-trivial project). I had a talk with myself and realized that if I want to make my project cross-platform across all Unices, I have to care about BSD (and I want to reduce the burden on someone who wants to port my project, that might one day be myself so I might as well be smart about it).I’m well aware I can’t have dependencies on Linux-only things like systemd or PipeWire (I can make an abstraction layer over the different kinds of OSs I’m targetting). What else should I take into consideration? And no, no “make a VM with *BSD and try it there”, that’s obvious, I have {Free,Open,Net,DragonFly}BSD VMs already. I am interested in what to avoid and generally how to reduce the friction of porting. Might be an useful resource to other devs too, because I believe we should encourage BSD compatibility (too many Windows/macOS/Linux-only apps…)Bonus, as an interesting question: what do BSD developers have to take into consideration when porting to Linux? Thank you!
       
 (DIR) Post #AXemft8EDFgaRugmMS by netbsd@mastodon.sdf.org
       2023-07-13T05:57:47Z
       
       0 likes, 0 repeats
       
       @alecui There are some good general software engineering practies to follow!- Use a build system that supports feature detection, and use it frequently. Minimal use of #ifdef in code. Remember, there's more than just BSD and Linux too. #illumos - General good portability practices: you would be surprised how much software uses -Werror by default :(
       
 (DIR) Post #AXemftoPgPQiYkQT7A by alecui@qoto.org
       2023-07-13T08:28:30Z
       
       0 likes, 0 repeats
       
       @netbsd looks like OpenIndiana runs MATE by default, so it seems Solaris enjoys other desktop environments too, a good sign for me.If I really wanted to be strict with myself, I could do -Wall -Wpedantic too, now THAT would be a lot of “fun”.As for feature detection… At least OpenBSD will be difficult since I want pledge and unveil (if possible) support too (although an argument could be made that I can avoid those syscalls altogether, but you know :P). I think the slight difficulty I am facing (one among them, anyway) is that I can’t rely on porters (although they sure are more than welcome) to specialize my program. In my particular case I can rely on Xorg being a thing on all Unices (I hope), and standard Free Pascal units.On NetBSD specifically is there anything I should take into account? I’m sure there has to be more about it than “that BSD that runs on a toaster”, especially on a technical level.
       
 (DIR) Post #AXemfuc2ht832fe6TI by netbsd@mastodon.sdf.org
       2023-07-13T10:47:08Z
       
       0 likes, 0 repeats
       
       @alecui We have fairly strict hardening enabled by default. For example, a mmaped memory page's permissions cannot be changed without declaring beforehand that you are going to do so.Some locale related functions (uselocale is the main one) are not available because of thread safety concerns. Others can be used that don't change global state.Most programs that implement privilege separation on NetBSD do so with setrlimit.I don't understand your point about feature detection?
       
 (DIR) Post #AXemfvGoGJjr56if0y by alecui@qoto.org
       2023-07-13T10:51:15Z
       
       0 likes, 0 repeats
       
       @netbsd your hardening measures are different from OpenBSD or FreeBSD or Linux’s measures. Don’t I need to have #ifdef guards everywhere essentially for code that directly interfaces with the OS? Unless there’s something I’m misunderstanding
       
 (DIR) Post #AXemfw0BXc2DLpwtk0 by netbsd@mastodon.sdf.org
       2023-07-13T11:00:51Z
       
       0 likes, 0 repeats
       
       @alecui That's what feature detection is for. You modularize the code and test for features instead of specific operating systems.
       
 (DIR) Post #AXemfwdXBJVhJsMK4e by alecui@qoto.org
       2023-07-13T12:24:29Z
       
       0 likes, 0 repeats
       
       @netbsd and how does one do feature detection? I can’t find anything with the keywords I’ve used
       
 (DIR) Post #AXemfxSa7WLLsCF5do by netbsd@mastodon.sdf.org
       2023-07-13T16:15:06Z
       
       1 likes, 2 repeats
       
       @alecui It depends on your build system.CMake:https://cmake.org/cmake/help/latest/module/CheckFunctionExists.htmlMeson:https://mesonbuild.com/Reference-manual_returned_compiler.html#compilerhas_functionGNU: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Functions.html