From 03fd5eb7495a9b24ed2dc243d6026f04b5828802 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sat, 3 May 2014 15:11:01 +0000 Subject: [PATCH] - Fix WITH_CCACHE_BUILD support (fix build) with ports that use HOME=/dev/null to avoid staging violations. This will force CCACHE_DIR=/root/.ccache when running as root, and otherwise will force CCACHE_DIR to be manually set. With hat: portmgr PR: ports/186410 [textproc/xmlto build] Reported by: mandree, Rainer Duffner MFH: 2014Q2 --- Mk/bsd.port.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 8cab41403d5d..0615300e4a73 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -2125,6 +2125,19 @@ BUILD_FAIL_MESSAGE+= Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reportin .endif # ccache support + +# Try to set a default CCACHE_DIR to workaround HOME=/dev/null and +# HOME=${WRKDIR}/* staging fixes +.if defined(WITH_CCACHE_BUILD) && !defined(CCACHE_DIR) && \ + (!defined(HOME) || ${HOME} == /dev/null || ${HOME:S/^${WRKDIR}//} != ${HOME}) +. if defined(USER) && ${USER} == root +CCACHE_DIR= /root/.ccache +. else +NO_CCACHE= yes +WARNING+= WITH_CCACHE_BUILD support disabled, please set CCACHE_DIR. +. endif +.endif + # Support NO_CCACHE for common setups, require WITH_CCACHE_BUILD, and # don't use if ccache already set in CC .if !defined(NO_CCACHE) && defined(WITH_CCACHE_BUILD) && !${CC:M*ccache*} && \ @@ -2138,12 +2151,15 @@ _CCACHE_PATH= ${LOCALBASE}/libexec/ccache # Prepend the ccache dir into the PATH and setup ccache env PATH:= ${_CCACHE_PATH}:${PATH} +#.MAKEFLAGS: PATH=${PATH} .if !${MAKE_ENV:MPATH=*} && !${CONFIGURE_ENV:MPATH=*} MAKE_ENV+= PATH=${PATH} CONFIGURE_ENV+= PATH=${PATH} .endif +# Ensure this is always in subchild environments . if defined(CCACHE_DIR) +#.MAKEFLAGS: CCACHE_DIR=${CCACHE_DIR} MAKE_ENV+= CCACHE_DIR="${CCACHE_DIR}" CONFIGURE_ENV+= CCACHE_DIR="${CCACHE_DIR}" . endif