This changes the buildlink3.mk files to use an include guard for the
recursive include. The use of BUILDLINK_DEPTH, BUILDLINK_DEPENDS,
BUILDLINK_PACKAGES and BUILDLINK_ORDER is handled by a single new
variable BUILDLINK_TREE. Each buildlink3.mk file adds a pair of
enter/exit marker, which can be used to reconstruct the tree and
to determine first level includes. Avoiding := for large variables
(BUILDLINK_ORDER) speeds up parse time as += has linear complexity.
The include guard reduces system time by avoiding reading files over and
over again. For complex packages this reduces both %user and %sys time to
half of the former time.
Instead of just looking at the libraries, we check for the headers as
well, and if multiple implementations exist (usually because of symlinks
to shared libraries), then we order the search as:
tinfo, curses, termcap, termlib, c
code was moved to the builtin.mk file. The buildlink3.mk file should
contain the bits that always apply to all packages that include it.
The builtin.mk file should include the bits that only apply if
"termcap" is listed in ${BUILDLINK_PACKAGES} (this isn't the case
if we use curses to replace termcap). As such, redistribute the
code as follows:
+ Move the parts that remove -l options for terminal libraries we
don't support, as well as for transforming "-ltermcap" into the
appropriate libraries, from the builtin.mk back into the
buildlink3.mk.
+ Leave the parts the remove -lcurses and -lncurses in the
builtin.mk. We can remove the ${TERMCAP_TYPE} == "curses" check
since that part of the file is protected by CHECK_BUILTIN.termcap,
so it should only be triggered if "termcap" is in BUILDLINK_PACKAGES,
which only happens if ${TERMCAP_TYPE} isn't "curses".
package does not use either curses or ncurses. We determine this
by inspecting BUILDLINK_PACKAGES and looking for "curses" and
"ncurses".
+ Because the above logic uses BUILDLINK_PACKAGES, the code must be
moved from termcap.buildlink3.mk into termcap.builtin.mk where it
is safe to inspect BUILDLINK_PACKAGES.
terminal library other than the one we specify.
+ Also look for "termlib" as some systems have that. Note that we need to
make the library search more sophisticated to work correctly on more
exotic platforms.