michaelforney / samurai

ninja-compatible build tool written in C
Other
832 stars 47 forks source link

Solaris: getloadavg() requires sys/loadavg.h #91

Closed vtorri closed 1 year ago

vtorri commented 2 years ago

See its man page

so something like this in build.c

#ifdef __sun
#include <sys/loadavg.h>
#endif
vtorri commented 2 years ago

@michaelforney If you agree, I can make a PR for this

capezotte commented 2 years ago

This can be made into an elif in #87, which also adds the guards for macOS.

vtorri commented 2 years ago

@capezotte I don't know. Maybe @michaelforney has an opinion about this

michaelforney commented 1 year ago

I don't want to add a bunch of platform-specific ifdefs to samurai. Now it is disabled by default, which should fix the build issue on Solaris (and other platforms).

If you want to enable it, add -D HAVE_GETLOADAVG to your CFLAGS and patch build.c to include sys/loadavg.h.

wdlkmpx commented 1 year ago

Would michaelforney accept a meson project that tries to automate detection of stuff? No need to maintain it

Other than that, most of these special ifdefs can go to a file the maintainer doesn't need to see or edit (and can ignore issues that reference that file)

vtorri commented 1 year ago

like compat.h or something like that

wdlkmpx commented 1 year ago

@vtorri how about system.h

https://github.com/wdlkmpx/samurai/commit/debf6309f5b6c696e5700278f324e6131689a464

Something like that. that fork can be used to add stuff that has been rejected (or that would be rejected), and rebase on top of upstream when it gets updated. Some some sort of samurai+

Sounds like a good idea doesn't it?

wdlkmpx commented 1 year ago

The problem with ifdefs is that there are several ways to group them to achieve the same results, of course the most readable approach should prevail. That means additional commits or force-push the amended commit. But it can be done

michaelforney commented 1 year ago

I'm not interested in meson. make works everywhere and is a POSIX standard tool. meson isn't and only supports a hardcoded set of compilers. I'm also not interested in ifdefs, even if they are contained in a single file.

It is simple enough for the packager to add CFLAGS='-D HAVE_GETLOADAVG -include sys/loadavg.h' to their make invocation.