On Thu, Nov 09, 2006 at 01:09:46AM +0000, Deanna Phillips wrote: > I've been asking around for the best way to use ccache within > OpenBSD ports. It seems everyone has a different way of doing > it, and what follows is maybe the simplest. > > For those who don't know, devel/ccache is a compiler cache that > significantly speeds up the sometimes unavoidable make ; make > clean ; make cycle when working on a port. > > So, the idea is a module, ccache, and a ccache.port.mk like so: > > CCACHE_DIR?= "${WRKDIR}/ccache" > > BUILD_DEPENDS+= ::devel/ccache > > CONFIGURE_ENV+= CCACHE_DIR="${CCACHE_DIR}" \ > CC="ccache ${CC}" \ > CXX="ccache ${CXX}" > > MAKE_ENV+= CCACHE_DIR="${CCACHE_DIR}" > > Putting the ccache dir within the WRKDIR is pretty much useless, > since it gets wiped out on a make clean, but it needs to be set > to something or the build will just fail. The best idea was > making it a subdirectory of TMPDIR; that way no systrace filter > modification is required. > > So, this way, to use ccache on your port you only need to add > this ccache.port.mk into /usr/ports/infrastructure/mk and add a > few lines to your port like this: > > MODULES=ccache > TMPDIR=/usr/obj > CCACHE_DIR=${TMPDIR}/ccache > > Or, you can put your TMPDIR and CCACHE_DIR in your /etc/mk.conf > and only have to add and remove the MODULES entry while working > on a port. > > I hope this makes anyone's porting experience less painful, and > thank you, people who helped me with it. :-)
Okay, the directory should be called MODCCACHE_DIR. Not that it makes a lot of difference, but those are the naming rules: new stuff in modules is prefixed with MOD to avoid invading the global namespace... you'll notice the only modules that do not respect that rules are legacy modules which replace stuff which used to live in bsd.port.mk