Changeset View
Changeset View
Standalone View
Standalone View
head/tools/build/Makefile
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | |||||
# output. On those platforms we only symlink the tools known to be compatible | # output. On those platforms we only symlink the tools known to be compatible | ||||
# (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others | # (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others | ||||
# from the FreeBSD sources during the bootstrap-tools stage. | # from the FreeBSD sources during the bootstrap-tools stage. | ||||
# basic commands: It is fine to use the host version for all of these even on | # basic commands: It is fine to use the host version for all of these even on | ||||
# Linux/MacOS since we only use flags that are supported by all of them. | # Linux/MacOS since we only use flags that are supported by all of them. | ||||
_host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ | _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ | ||||
dirname echo env false find fmt gzip gunzip head hostname id ln ls \ | dirname echo env false find fmt gzip gunzip head hostname id ln ls \ | ||||
mkdir mv nice patch rm realpath sh sleep stat tee touch tr true \ | mkdir mv nice patch rm sh sleep stat tee touch tr true uname uniq unxz \ | ||||
uname uniq wc which | 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" | ||||
_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} | ||||
@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}'"; 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}" | cp -pf "$${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 \ | ||||
Show All 26 Lines | |||||
# Link usr/bin, sbin, and usr/sbin to bin so that it doesn't matter whether a | # Link usr/bin, sbin, and usr/sbin to bin so that it doesn't matter whether a | ||||
# bootstrap tool was added to WORLTMP with a symlink or by building it in the | # bootstrap tool was added to WORLTMP with a symlink or by building it in the | ||||
# bootstrap-tools phase. We could also overrride BINDIR when building bootstrap | # bootstrap-tools phase. We could also overrride BINDIR when building bootstrap | ||||
# tools but adding the symlinks is easier and means all tools are also | # tools but adding the symlinks is easier and means all tools are also | ||||
# in the directory that they are installed to normally. | # in the directory that they are installed to normally. | ||||
.for _dir in sbin usr/sbin usr/bin | .for _dir in sbin usr/sbin usr/bin | ||||
# delete existing directories from before r340157 | # delete existing directories from before r340157 | ||||
@if [ ! -L ${DESTDIR}/${_dir} ]; then \ | @if [ -e ${DESTDIR}/${_dir} ] && [ ! -L ${DESTDIR}/${_dir} ]; then \ | ||||
echo "removing old non-symlink ${DESTDIR}/${_dir}"; \ | echo "removing old non-symlink ${DESTDIR}/${_dir}"; \ | ||||
rm -rf "${DESTDIR}/${_dir}"; \ | rm -rf "${DESTDIR}/${_dir}"; \ | ||||
fi | fi | ||||
.endfor | .endfor | ||||
ln -sfn bin ${DESTDIR}/sbin | ln -sfn bin ${DESTDIR}/sbin | ||||
ln -sfn ../bin ${DESTDIR}/usr/bin | ln -sfn ../bin ${DESTDIR}/usr/bin | ||||
ln -sfn ../bin ${DESTDIR}/usr/sbin | ln -sfn ../bin ${DESTDIR}/usr/sbin | ||||
.for _group in ${INCSGROUPS:NINCS} | .for _group in ${INCSGROUPS:NINCS} | ||||
mkdir -p "${DESTDIR}/${${_group}DIR}" | mkdir -p "${DESTDIR}/${${_group}DIR}" | ||||
.endfor | .endfor | ||||
.include <bsd.lib.mk> | .include <bsd.lib.mk> |