Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2008 22:51:54 +1000
From:      Edwin Groothuis <edwin@mavetju.org>
To:        ports@freebsd.org
Subject:   Standardize NO_CCACHE flag and ccache definitions
Message-ID:  <20080618125154.GC90685@k7.mavetju>

next in thread | raw e-mail | index | archive | help
Hello,

Recently I've started to use devel/ccache again (sometimes it takes
a while before you understand how it works) and it works pretty
well, except for some ports which can't be build with it. For example
devel/cmake.

To prevent everybody from having to re-invent the wheel, we could
introduce a NO_CCACHE flag in the affected ports Makefile:

	NO_CCACHE=yes

Unfortunately /etc/make.conf is read before the ports Makefile is
read, so this in /etc/make.conf isn't going to work anymore:

	.if !defined(NO_CCACHE)
	CC=/usr/local/libexec/ccache/cc
	CXX=/usr/local/libexec/ccache/c++
	CPP=/usr/local/libexec/ccache/cpp
	CCACHE_DIR=/usr/local/ccache
	.endif

So, what is wisdom? Maybe this:

Having a flag in /etc/make.conf to indicate you want to use
devel/ccache:

	WANT_CCACHE=yes

And in the ports Makefile you could have:

	NO_CCACHE=yes

And in bsd.port.mk before the inclusion of bsd.gcc.mk:

	.if defined(WANT_CCACHE) && !defined(NO_CCACHE)
	CC?=		${LOCALBASE}/libexec/ccache/cc
	CXX?=		${LOCALBASE}/libexec/ccache/c++
	CPP?=		${LOCALBASE}/libexec/ccache/cpp
	CCACHE_DIR?=	${LOCALBASE}/ccache
	.endif

How about this approach?

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/



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