-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build system rewrite #23
base: master
Are you sure you want to change the base?
Conversation
prot.c provides two functions: prot_gid and prot_uid. prot_gid is fully unused, and depends on {chk,try}shsgr, both of which must be run at build-time and require that the user has additional groups. They are not needed by anything else and their removal gets rid of cross-compilation jank. prot_uid is used (once) by chpst, but since it is a no-op wrapper around setuid(), its use can be replaced by a normal call to setuid(). Solves the big questions from void-linux#11
The "systype" machanism is merely a system info gatherer, and the info it collects is (mostly) not used anywhere. The only seemingly important info is the kernel and kernel version (or the lack thereof), and has been moved to where it is used (print-ar.sh) This gets rid of two cross-incompatible buildtime programs. One tried to find if the build was happening on NeXT, but that's not an operating system that print-ar.sh cares about. The other tried to do cpuid on x86, which is useless to the build. This seems to implement what void-linux#11 started.
Hum yeah, the mechanism is clunky and most of these don't seem very useful at all |
Are the feature macros an ok solution? Should they be defined everywhere? Is there a flag that does it better? y understanding is that |
unless there's something you're gaining by selectively defining them (you would know; generally it's to selectively expose a different standard of a function in some places intentionally), yes, just -D global cflags. |
This gets rid of tryulong64.c, a buildtime configure binary which interferes with cross-compilation, at the cost of bumping the minimum C version to C99.
Since poll() is available on all platforms we care about, we don't need to check if it is. This gets rid of trypoll.c, the last configure-time check that required to be run on the host (messing with cross). We also get rid of trysysel.c, since select() was only used as a fallback when poll() isn't avaialble.
This has dramatic effects on the build system complexity, and in the process exposing lots of dead weight. Split header files (.h1 .h2) are merged, and header files that only contained a single define have been fully replaced with -D. The makefile is no longer geneating scripts, and their files that hardcoded cc/ld/ar calls are gone. The build system is now fully compatible with standard variables like CC, PREFIX, DESTDIR, and such. The compiler is autodetected when unspecified, build flags are checked for compatibility, and installation directories can now be specified with configure flags. The configure script was heavily inspired by XBPS's. The "compile" script is gone along with the original top-level Makefile, both replaced with straightforward and more conventional makefiles. The "man" and "completions" subdirs are now integrated into the build system and use configure-time variables for the paths. No sed calls or patches should be required to set any paths or toolchain settings. Usage of .gitattributes and "$Id$" strings is now replaced with a VERSION define in the configure script, which optionally uses git to append the 8-digit commit hash to the version string. This also makes '-V' more meaningful.
They were all deprecated in runit 1.3.2 (Dec 2005), replaced with sv and removed from the default targets of the makefile by 1.4.0 (Mar 2006), and fully undocumented by 1.5.1 (May 2006). This makes for a ~17 years deprecation notice, pretty good.
Many of the tests were broken from expecting a specific ~~version~~ commit hash string in the command output (the $Id$ stuff). Another was broken by a new argument added by void.
The unixes where the special case mattered are so niche nowadays that it seems reasonable to change the value of $AR only if it is provided to configure.
~~~ runit 0.13.1 Mon, 19 Jan 2004 18:32:58 +0000 * trysocketlib.c: new; check for libraries needed for socket() on some systems (fixes link failure on solaris, thx Uffe Jakobsen). ~~~ 19 years later, we don't really need to care about solaris oddities anymore.
This has dramatic effects on the build system complexity, and in the process exposing lots of dead weight.
Split header files (
.h1 .h2
) are merged, and header files that only contained a single define have been fully replaced with -D. The makefile is no longer generating scripts, and their files that hardcoded cc/ld/ar calls are gone.The build system is now fully compatible with standard variables like
CC
,PREFIX
,DESTDIR
, and such. The compiler is autodetected when unspecified, build flags are checked for compatibility, and installation directories can now be specified with configure flags.The configure script was heavily inspired by XBPS's.
The "compile" script is gone along with the original top-level Makefile, both replaced with straightforward and more conventional makefiles. The "man" and "completions" subdirs are now integrated into the build system and use configure-time variables for the paths.
No sed calls or patches should be required to set any paths or toolchain settings.
Usage of
.gitattributes
and$Id$
strings is now replaced with aVERSION
define in the configure script, which optionally uses git to append the 8-digit commit hash to the version string. This also makes-V
more meaningful.Multiple configure checks were removed, some were unused, while others required to be run on the host at build time and were not compatible with cross. This means we are now assuming C99 compiler and availability of
poll()
; both seem reasonable.After ~17 years of being deprecated, excluded from builds, and de-documented,
svwait{up,down}
andrunsv{ctrl,stat}
were removed from the codebase.Closes #11
Closes #12
Things left to do
make check
is broken has to be fixed. Long term there's probably room to improve/modernise the tests.Going further
Should the docs be integrated in the build system now or as a later time (or not at all)?
The selection of default CFLAGS, warning flags, and LDFLAGS is mostly taken from XBPS's configure script. Are they adequate here, and are there any to add?
While trying to identify those, I found that there's too much variance with even the mainstream BSDs for that to be done in this PR. Anyways, the important part is that they're no longer tangled with the rest of the build system, and should be much easier to tackle individually later.
Decided to drop the check, details in commit
Decided to drop the special-casing, details in commit
Turned into an xbps "bug?" report
Most of this was a learning experience, so I may have missed obvious things; feedback welcome.
About that complexity...
The makefile in
src/
before... and after.
.dot
s here.I recommend opening
original.dot
in an interactive dot viewer to better see the node relationships.