src.libnames.mk: Include dependencies when bootstrapping from non-FreeBSD

When bootstrapping on FreeBSD we use -DNO_SHARED so this case is already
handled correctly, but on non-FreeBSD we set NO_SHARED to no in
Makefile.boot.pre as not all OSes have static libraries available. As a
result, users of libdwarf fail to link during the cross tools stage due
to the newly-introduced dependency of libdwarf on libz.

This should perhaps be reworked to instead leave NO_SHARED as yes but
have an override (either implicit in bsd.prog.mk, or explicit via a new
variable) to turn off just the use of -static.

MFC after:	1 week
This commit is contained in:
Jessica Clarke 2021-12-06 18:53:48 +00:00
parent ed4050750c
commit f0a6ab51e6

View File

@ -462,8 +462,12 @@ LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l:S/${PIE_SUFFIX}//}${PIE_SUFFIX}
LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l}
.endif
# Add in all dependencies for static linkage.
# Bootstrapping from non-FreeBSD needs special handling, since it overrides
# NO_SHARED back to yes despite only building static versions of bootstrap
# libraries (see tools/build/mk/Makefile.boot.pre).
.if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \
(defined(NO_SHARED) && ${NO_SHARED:tl} != "no"))
(defined(NO_SHARED) && ${NO_SHARED:tl} != "no") || \
(defined(BOOTSTRAPPING) && ${.MAKE.OS} != "FreeBSD"))
.for _d in ${_DP_${_l}}
DPADD_${_l}+= ${DPADD_${_d}}
LDADD_${_l}+= ${LDADD_${_d}}