From: Stuart Henderson Subject: Re: Poison ccache and sccache To: "Anthony J. Bentley" Cc: Klemens Nanni , ports@openbsd.org Date: Thu, 10 Sep 2026 14:54:41 +0100 On 2026/09/10 04:48, Anthony J. Bentley wrote: > Klemens Nanni writes: > > I'm not convinced we should help the port(er) use ccache(1) directly. > > > > Rather all usage should go through USE_CCACHE, which does warn if the > > package is missing. > > USE_CCACHE is a user setting, so ports aren't allowed to toggle it. > The only option within a port is to add ccache to BUILD_DEPENDS or to > disable ccache in the upstream code. yep. > Of course disabling is better, but sometimes there is no knob, so we > patch ccache away. I can imagine a situation where it's too hard to > patch away (I'm thinking of the handful of ports that still use doxygen > despite our best efforts). Avoiding a hidden dep is the most important > thing since it hurts bulks. I've not seen a ccache configure check that would be at all difficult to remove. Based on how it works (compiler wrapper/override) it always ought to be simpler than something with logic that decides whether or not to process files with some program. > Here's a better version that encourages disabling ccache first. > > --- infrastructure/mk/bsd.port.mk > +++ infrastructure/mk/bsd.port.mk > @@ -452,7 +452,8 @@ CCACHE_DIR ?= ${WRKOBJDIR_${PKGPATH}}/.ccache > MAKE_ENV += CCACHE_DIR=${CCACHE_DIR} ${CCACHE_ENV} > CONFIGURE_ENV += CCACHE_DIR=${CCACHE_DIR} > # scons cleans the environment when calling the compiler > -COMPILER_WRAPPER += env CCACHE_DIR=${CCACHE_DIR} ${CCACHE_ENV} ccache > +COMPILER_WRAPPER += env CCACHE_DIR=${CCACHE_DIR} ${CCACHE_ENV} \ > + ${LOCALBASE}/bin/ccache > . if !exists(${LOCALBASE}/bin/ccache) > ERRORS += "Fatal: USE_CCACHE is set, but ccache is not installed." > . endif > @@ -2783,6 +2784,12 @@ ${_WRKDIR_COOKIE}: > @${_PBUILD} mkdir -p ${WRKDIR} ${WRKDIR}/bin > @${_wrap_install_commands} > # poison some common binaries unless the relevant BUILD_DEPENDS is used > +.if empty(_BUILD_DEP:Mdevel/ccache) > + @printf '#!/bin/sh\n\ > + echo "*** $$0 was called; disable it or add an explicit dependency ***" >&2\n\ I think I'd probably say "was called directly". Not sure if I'd allow the "present in BUILD_DEPENDS" carve-out; having ccache in BUILD_DEPENDS won't be enough to make it work (at least with PORTS_PRIVSEP), as at least CCACHE_DIR still needs to be set. Maybe go without that at first and revisit if we end up finding something that really does need it to be present? On 2026/09/10 04:54, Anthony J. Bentley wrote: > Klemens Nanni writes: > > 09.09.2026 13:59, Anthony J. Bentley пишет: > > > There are probably still several ports with hidden deps on ccache. > > > This should catch them. > > > > > > If upstream has a knob to turn off ccache, the port should use it. > > > > We could also add a few likely candidates to configure args by default, > > say -DCCACHE=OFF, -CCACHE_Found=FALSE, etc. > > There's no standard name for these though. Currently the only variables > cmake.port.mk sets are CMAKE_* prefixed variables or language variables > used by cmake's built-in language modules. It would be confusing for the > module to try a bunch of random variable names not standardized anywhere > in hopes of catching the random names individual ports use for ccache. +1