Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jan 2023 01:47:11 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6879fc89425f - stable/13 - Makefile: Avoid sanitizing PATH on non-FreeBSD systems
Message-ID:  <202301310147.30V1lBcX058640@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=6879fc89425f57880fa327a1c528f657f80cf68e

commit 6879fc89425f57880fa327a1c528f657f80cf68e
Author:     Jake Freeland <jfree@FreeBSD.org>
AuthorDate: 2023-01-19 22:24:44 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-01-31 01:46:18 +0000

    Makefile: Avoid sanitizing PATH on non-FreeBSD systems
    
    Allow the build process to find host binaries during the host-symlinks target when
    cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
    the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
    path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
    /opt/homebrew/bin, other more niche systems may also deviate and users may
    expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
    want to ensure everything comes from base. In particular, (un)xz are needed
    from Homebrew on macOS, and thus cannot be found on Arm without this.
    
    Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
    actual main build steps will still use a sanitised PATH.
    
    Reviewed by:    jrtc27, arichardson
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D37991
    
    (cherry picked from commit 16fbf0191243e7c9dff6615b1424b5d39186b36c)
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index e16557f83371..5dac4a3e9ee3 100644
--- a/Makefile
+++ b/Makefile
@@ -216,7 +216,12 @@ META_TGT_WHITELIST+= \
 .ORDER: buildkernel reinstallkernel
 .ORDER: buildkernel reinstallkernel.debug
 
+# Only sanitize PATH on FreeBSD.
+# PATH may include tools that are required to cross-build
+# on non-FreeBSD systems.
+.if ${.MAKE.OS} == "FreeBSD"
 PATH=	/sbin:/bin:/usr/sbin:/usr/bin
+.endif
 MAKEOBJDIRPREFIX?=	/usr/obj
 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \
     ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301310147.30V1lBcX058640>