Changeset View
Changeset View
Standalone View
Standalone View
tools/build/Makefile
Show First 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ | ||||
wc which xz | wc which xz | ||||
# We also need a symlink to the absolute path to the make binary used for | # We also need a symlink to the absolute path to the make binary used for | ||||
# the toplevel makefile. This is not necessarily the same as `which make` | # the toplevel makefile. This is not necessarily the same as `which make` | ||||
# since e.g. on Linux and MacOS that will be GNU make. | # since e.g. on Linux and MacOS that will be GNU make. | ||||
_make_abs!= which "${MAKE}" | _make_abs!= which "${MAKE}" | ||||
_host_abs_tools_to_symlink= ${_make_abs}:make ${_make_abs}:bmake | _host_abs_tools_to_symlink= ${_make_abs}:make ${_make_abs}:bmake | ||||
.if ${.MAKE.OS} != "FreeBSD" | .if ${.MAKE.OS} == "FreeBSD" | ||||
# When building on FreeBSD we always copy the host tools instead of linking | |||||
# into WORLDTMP to avoid issues with incompatible libraries (see r364030). | |||||
# Note: we could create links if we don't intend to update the current machine. | |||||
_COPY_HOST_TOOL=cp -pf | |||||
.else | |||||
# However, this is not necessary on Linux/macOS (and may even be the root cause | |||||
# for the build problems on macOS since Big Sur). | |||||
_COPY_HOST_TOOL=ln -sfn | |||||
_make_abs!= which "${MAKE}" | _make_abs!= which "${MAKE}" | ||||
_host_abs_tools_to_symlink+= ${_make_abs}:make ${_make_abs}:bmake | _host_abs_tools_to_symlink+= ${_make_abs}:make ${_make_abs}:bmake | ||||
.if ${.MAKE.OS} == "Darwin" | .if ${.MAKE.OS} == "Darwin" | ||||
# /usr/bin/cpp may invoke xcrun: | # /usr/bin/cpp may invoke xcrun: | ||||
_host_tools_to_symlink+=xcrun | _host_tools_to_symlink+=xcrun | ||||
.endif # ${.MAKE.OS} == "Darwin" | .endif # ${.MAKE.OS} == "Darwin" | ||||
# On Ubuntu /bin/sh is dash which is totally useless. Let's just link bash | # On Ubuntu /bin/sh is dash which is totally useless. Let's just link bash | ||||
# as the build sh since that will work fine. | # as the build sh since that will work fine. | ||||
_host_abs_tools_to_symlink+= /bin/bash:sh | _host_abs_tools_to_symlink+= /bin/bash:sh | ||||
_host_tools_to_symlink:=${_host_tools_to_symlink:Nsh} | _host_tools_to_symlink:=${_host_tools_to_symlink:Nsh} | ||||
.endif | .endif | ||||
host-symlinks: | host-symlinks: | ||||
@echo "Linking host tools into ${DESTDIR}/bin" | @echo "Linking host tools into ${DESTDIR}/bin" | ||||
.for _tool in ${_host_tools_to_symlink} | .for _tool in ${_host_tools_to_symlink} | ||||
@export PATH=$${PATH}:/usr/local/bin; source_path=`which ${_tool}`; \ | @export PATH=$${PATH}:/usr/local/bin; source_path=`which ${_tool}`; \ | ||||
if [ ! -e "$${source_path}" ] ; then \ | if [ ! -e "$${source_path}" ] ; then \ | ||||
echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ | echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ | ||||
fi; \ | fi; \ | ||||
rm -f "${DESTDIR}/bin/${_tool}"; \ | rm -f "${DESTDIR}/bin/${_tool}"; \ | ||||
cp -pf "$${source_path}" "${DESTDIR}/bin/${_tool}" | ${_COPY_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}" | ||||
.endfor | .endfor | ||||
.for _tool in ${_host_abs_tools_to_symlink} | .for _tool in ${_host_abs_tools_to_symlink} | ||||
@source_path="${_tool:S/:/ /:[1]}"; \ | @source_path="${_tool:S/:/ /:[1]}"; \ | ||||
target_path="${DESTDIR}/bin/${_tool:S/:/ /:[2]}"; \ | target_path="${DESTDIR}/bin/${_tool:S/:/ /:[2]}"; \ | ||||
if [ ! -e "$${source_path}" ] ; then \ | if [ ! -e "$${source_path}" ] ; then \ | ||||
echo "Host tool '${src_path}' is missing"; false; \ | echo "Host tool '${src_path}' is missing"; false; \ | ||||
fi; \ | fi; \ | ||||
rm -f "$${target_path}"; \ | rm -f "$${target_path}"; \ | ||||
cp -pf "$${source_path}" "$${target_path}" | ${_COPY_HOST_TOOL} "$${source_path}" "$${target_path}" | ||||
.endfor | .endfor | ||||
.if exists(/usr/libexec/flua) | .if exists(/usr/libexec/flua) | ||||
rm -f ${DESTDIR}/usr/libexec/flua | rm -f ${DESTDIR}/usr/libexec/flua | ||||
cp -pf /usr/libexec/flua ${DESTDIR}/usr/libexec/flua | ${_COPY_HOST_TOOL} /usr/libexec/flua ${DESTDIR}/usr/libexec/flua | ||||
.endif | .endif | ||||
# Create all the directories that are needed during the legacy, bootstrap-tools | # Create all the directories that are needed during the legacy, bootstrap-tools | ||||
# and cross-tools stages. We do this here using mkdir since mtree may not exist | # and cross-tools stages. We do this here using mkdir since mtree may not exist | ||||
# yet (this happens if we are crossbuilding from Linux/Mac). | # yet (this happens if we are crossbuilding from Linux/Mac). | ||||
INSTALLDIR_LIST= \ | INSTALLDIR_LIST= \ | ||||
bin \ | bin \ | ||||
lib/casper \ | lib/casper \ | ||||
Show All 31 Lines |