Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Jul 2012 11:25:50 -0500
From:      "Bryan Drewery" <bryan@shatow.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        portmgr@FreeBSD.org
Subject:   ports/169579: [bsd.port.mk] [exp-run] ccache support for building ports
Message-ID:  <20120701162639.AC6991065670@hub.freebsd.org>
Resent-Message-ID: <201207011630.q61GU9Um044517@freefall.freebsd.org>

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

>Number:         169579
>Category:       ports
>Synopsis:       [bsd.port.mk] [exp-run] ccache support for building ports
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 01 16:30:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Bryan Drewery
>Release:        FreeBSD 8.3-RELEASE i386
>Organization:
>Environment:

	
>Description:
	This patch adds ccache support to ports (off by default). Other patches have changed $CC to use ccache, which results in having a space in $CC. This breaks many ports such as boost and libtool ports.
	This patch however utilizes the symlinks in /usr/local/libexec/ccache/world/{cc,gcc,etc...} by prepending that directory into $PATH in the $MAKE_ENV.
	Using this method, I have seen 0 failures, compared to the $CC method which results in many build failures and requiring to define which ports do not support ccache.

	To enable: Define WANT_CCACHE= in /etc/make.conf
	The cache directory CCACHE_DIR defaults to /usr/obj/ccache
	Defining NO_CCACHE can disable ccache support in make.conf or in a port. This is mostly to allow compatibility with current setups utilizing NO_CCACHE.
	If $CC already contains ccache, the support is disabled in case of custom setup.

	Users can override other ccache env variables [1] by using MAKE_ENV+= in their make.conf. Such as:
	MAKE_ENV+= CCACHE_LOGFILE=/var/log/ccache.log

	To use ccache(1) from the command line to configure the size or view stats: CCACHE_DIR=/usr/obj/ccache ccache -s

	[1] https://ccache.samba.org/manual.html#_environment_variables

>How-To-Repeat:
	
>Fix:

	

--- patch-ccache.txt begins here ---
--- bsd.port.mk.orig	2012-06-30 12:38:02.000000000 -0500
+++ bsd.port.mk	2012-07-01 11:13:06.000000000 -0500
@@ -942,6 +942,13 @@
 #				  that are explicitly marked MAKE_JOBS_UNSAFE.  User settable.
 # MAKE_JOBS_NUMBER
 #				- Override the number of make jobs to be used.  User settable.
+## cacche
+#
+# WANT_CCACHE
+# 				- Enable CCACHE support (devel/ccache)
+# CCACHE_DIR
+# 				- Directory to use for ccache objects
+# 				  Default: /usr/obj/ccache
 #
 # For install:
 #
@@ -2208,6 +2215,21 @@
 .endif
 .endif
 
+# ccache support
+# Support NO_CCACHE for common setups, require WANT_CCACHE, and don't use if ccache already set in CC
+.if !defined(NO_CCACHE) && defined(WANT_CCACHE) && !${CC:M*ccache*}
+CCACHE_DIR?=	/usr/obj/ccache
+
+# Avoid depends loops between pkg and ccache
+.	if !${.CURDIR:M*/devel/ccache} && !${.CURDIR:M*/ports-mgmt/pkg}
+BUILD_DEPENDS+=		${LOCALBASE}/bin/ccache:${PORTSDIR}/devel/ccache
+.	endif
+
+# Prepend the ccache dir into the PATH and setup ccache env
+MAKE_ENV+=	PATH=${LOCALBASE}/libexec/ccache/world:${PATH} \
+			CCACHE_DIR=${CCACHE_DIR}
+.endif
+
 PTHREAD_CFLAGS?=
 PTHREAD_LIBS?=		-pthread
 
--- patch-ccache.txt ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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