path: root/tools
diff options
authorAlexander Richardson <Alexander.Richardson@cl.cam.ac.uk>2021-01-25 14:18:16 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-01-25 15:09:43 +0000
commita8b20f4fabbca9bef377009429848d4f9cea18ae (patch)
tree7ef85f7ec5273e87f7939b9bd5715a7e977bef5b /tools
parent8d55837dc1331a5cdacad539b1788ab1070159b4 (diff)
Create symlinks to host tools on non-FreeBSD hosts
This is unnecessary when cross-building from Linux/macOS. Additionally, cp -p appears to be broken on macOS Big Sur (https://openradar.appspot.com/8957219). For some unknown reason this commit appears to fix freezes when building on macOS Big Sur. This also fixes building in docker with volume mounts with ACLs, since setting the ACL with cp -p fails otherwise. Obtained From: CheriBSD Tested By: gnn (macOS Big Sur), Nathaniel Wesley Filardo (docker) Reviewed By: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D28267
Diffstat (limited to 'tools')
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/build/Makefile b/tools/build/Makefile
index c0c1786d4bfa..48e62e6561b7 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -272,7 +272,17 @@ _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \
_make_abs!= which "${MAKE}"
_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.
+# However, this is not necessary on Linux/macOS. Additionally, copying the host
+# tools to another directory with cp -p results in freezes on macOS Big Sur for
+# some unknown reason. It can also break building inside docker containers if
+# there are ACLs on shared volumes.
+_COPY_HOST_TOOL=ln -sfn
_make_abs!= which "${MAKE}"
_host_abs_tools_to_symlink+= ${_make_abs}:make ${_make_abs}:bmake
.if ${.MAKE.OS} == "Darwin"
@@ -293,7 +303,7 @@ host-symlinks:
echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \
fi; \
rm -f "${DESTDIR}/bin/${_tool}"; \
- cp -pf "$${source_path}" "${DESTDIR}/bin/${_tool}"
+ ${_COPY_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}"
.for _tool in ${_host_abs_tools_to_symlink}
@source_path="${_tool:S/:/ /:[1]}"; \
@@ -302,11 +312,11 @@ host-symlinks:
echo "Host tool '${src_path}' is missing"; false; \
fi; \
rm -f "$${target_path}"; \
- cp -pf "$${source_path}" "$${target_path}"
+ ${_COPY_HOST_TOOL} "$${source_path}" "$${target_path}"
.if exists(/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
# Create all the directories that are needed during the legacy, bootstrap-tools