2013/11/27 Vadim Zhukov <persg...@gmail.com>: > 2013/11/27 Juan Francisco Cantero Hurtado <i...@juanfra.info>: >> On Wed, Nov 27, 2013 at 09:24:33AM +0000, Stuart Henderson wrote: >>> On 2013/11/27 13:05, Vadim Zhukov wrote: >>> > CCache won't work for non-base C/C++ compilers, so don't even try >>> > to do it. Okays, objections? >>> > >> >> The ports framework only uses ccache with base gcc. I don't know why you >> need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453: >> >> .if ${USE_CCACHE:L} == "yes" && ${NO_CCACHE:L} == "no" >> @${ECHO_MSG} "===> Enabling ccache for >> ${FULLPKGNAME}${_MASTER}" >> @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc >> @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++ >> @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc >> @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++ >> .endif >> >> ccache is pretty intelligent, ignores unknown languages or compiler >> options. > > Yes. gcc4.port.mk and clang.port.mk overwrite > ${WRKDIR}/bin/{cc,c++,...} that are written by bsd.port.mk when > USE_CCACHE is enabled. But this gives you false sense that ccache > works, while it does not. This is bad. > >>> Ok for now, though in those cases you might want to investigate setting >>> CC/CXX to "ccache egcc", etc. I didn't use that method for the general >>> case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC} >>> but this might be manageable if it's just for ports using non-base >>> compilers. >>> >> >> Why not add support for ports-gcc/clang?. The symlinks only works with >> base-gcc but ccache can work with any compiler using >> "CCACHE_CC=mycompiler". I think a script in ${WRKDIR}/bin with >> "CCACHE_CC=mycompiler ccache $@" inside or something similar should be >> enough. > > Won't work for more than one language: either C or C++, but not both. > And there are ports that have both C and C++ sources to be built.
Missed the "script" part, sorry. Yes, this could work but, as sthen@ pointed out, it'll require additional exec(2). Still thinking about it...