Hi,

ports/169579 is currently tracking this.

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/{cc,gcc,etc...} by prefixing 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 WITH_CCACHE_BUILD=yes 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

FWIW, this is also possible to achieve with bsd.local.mk [2], but it
would be much nicer to support without needing to customize your checkout.

[1] https://ccache.samba.org/manual.html#_environment_variables
[2] http://fossil.etoilebsd.net/poudriere/doc/trunk/doc/ccache.wiki


-- 
Regards,
Bryan Drewery
bdrewery@freenode/EFNet


--- bsd.port.mk.orig    2012-08-04 02:57:19.000000000 +0200
+++ bsd.port.mk 2012-08-04 02:58:43.000000000 +0200
@@ -934,6 +934,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
+#
+# WITH_CCACHE_BUILD
+#                              - Enable CCACHE support (devel/ccache)
+# CCACHE_DIR
+#                              - Directory to use for ccache objects
+#                                Default: /usr/obj/ccache
 #
 # For install:
 #
@@ -2217,6 +2224,21 @@
 .endif
 .endif
 
+# ccache support
+# Support NO_CCACHE for common setups, require WITH_CCACHE_BUILD, and don't 
use if ccache already set in CC
+.if !defined(NO_CCACHE) && defined(WITH_CCACHE_BUILD) && !${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:${PATH} \
+                       CCACHE_DIR=${CCACHE_DIR}
+.endif
+
 PTHREAD_CFLAGS?=
 PTHREAD_LIBS?=         -pthread
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[email protected]"

Reply via email to