Index: Makefile =================================================================== RCS file: /home/pcvs/ports/devel/ccache/Makefile,v retrieving revision 1.58 diff -u -r1.58 Makefile --- Makefile 10 Jan 2011 16:44:24 -0000 1.58 +++ Makefile 24 Feb 2011 17:12:42 -0000 @@ -7,6 +7,7 @@ PORTNAME= ccache PORTVERSION= 3.1.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://samba.org/ftp/ccache/ CRITICAL @@ -26,7 +27,7 @@ .if !defined(WITHOUT_COMPILER_LINKS) HOWTO= ccache-howto-freebsd.txt CCLINKDIR= libexec/ccache -PLIST_DIRS= ${CCLINKDIR} +PLIST_DIRS= ${CCLINKDIR}/world ${CCLINKDIR} SUB_FILES= ${HOWTO} pkg-message .endif @@ -42,10 +43,10 @@ .if defined(EXTRA_COMPILERS) CCACHE_COMPILERS+= ${EXTRA_COMPILERS} .endif -WORLD_COMPILERS= world-cc world-c++ PLIST_FILES+= ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/|} \ - ${WORLD_COMPILERS:S|^|${CCLINKDIR}/|} -SUB_FILES+= ${WORLD_COMPILERS} + ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/world/|} \ + ${CCLINKDIR}/world/ccache +SUB_FILES+= world-ccache SUB_LIST+= CCACHE_COMPILERS="${CCACHE_COMPILERS}" \ CCLINKDIR="${CCLINKDIR}" \ ICCPREFIX="${LOCALBASE}/intel_cc_80/bin" \ @@ -69,12 +70,11 @@ ${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1 .if !defined(WITHOUT_COMPILER_LINKS) - @${MKDIR} ${PREFIX}/${CCLINKDIR} + @${MKDIR} ${PREFIX}/${CCLINKDIR}/world + ${INSTALL_SCRIPT} ${WRKDIR}/world-ccache ${PREFIX}/${CCLINKDIR}/world/ccache .for link in ${CCACHE_COMPILERS} ${LN} -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${link} -.endfor -.for script in ${WORLD_COMPILERS} - ${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/${CCLINKDIR} + ${LN} -sf ccache ${PREFIX}/${CCLINKDIR}/world/${link} .endfor .endif .if !defined(NOPORTDOCS) Index: files/ccache-howto-freebsd.txt.in =================================================================== RCS file: /home/pcvs/ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v retrieving revision 1.13 diff -u -r1.13 ccache-howto-freebsd.txt.in --- files/ccache-howto-freebsd.txt.in 17 Nov 2010 18:41:35 -0000 1.13 +++ files/ccache-howto-freebsd.txt.in 24 Feb 2011 17:12:42 -0000 @@ -2,12 +2,14 @@ # $FreeBSD: ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v 1.13 2010/11/17 18:41:35 ehaupt Exp $ # -To use ccache add the following to /etc/make.conf +To use ccache add the following to /etc/make.conf. +You can replace cc and c++ with the compilers of your choice. +(remember that only GCC and Clang can build world and kernel) .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) .if !defined(NOCCACHE) -CC:=${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world-cc,1} -CXX:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world-c++,1} +CC:=${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world/cc,1} +CXX:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world/c++,1} .endif .endif @@ -47,18 +49,25 @@ Ccache has installed links for the following compilers %%CCACHE_COMPILERS%% in %%PREFIX%%/%%CCLINKDIR%% +and %%PREFIX%%/%%CCLINKDIR%%/world + +Clang will return a lot of 'unused argument' warnings: they are harmless. +Just add this to /etc/make.conf if you want to hide them: +.if ${CC:T} == "clang" +CFLAGS+= -Qunused-arguments +.endif !!! WARNING !!! Please make sure you have the compiler installed before you do this or your build will fail because it will not be able to find the compiler. -Any time you change CC/CXX you need to reinstall devel/libtool15 or you +Any time you change CC/CXX you need to reinstall devel/libtool or you will run in to problems. -- Ccache's default cache size is 1GB and this is larger than the default size of -the root partition (/) on FreeBSD. To over come this you may specify a new +the root partition (/) on FreeBSD. To over come this you may specify a new cache location on a different partition with the following examples. For Korn/Bourne shells Add the following to /etc/profile: Index: files/world-c++.in =================================================================== RCS file: files/world-c++.in diff -N files/world-c++.in --- files/world-c++.in 31 Jul 2010 10:48:26 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,4 +0,0 @@ -#!/bin/sh -unset CCACHE_PATH -export CCACHE_COMPILERCHECK=content -exec %%PREFIX%%/%%CCLINKDIR%%/c++ "$@" Index: files/world-cc.in =================================================================== RCS file: files/world-cc.in diff -N files/world-cc.in --- files/world-cc.in 31 Jul 2010 10:48:26 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,4 +0,0 @@ -#!/bin/sh -unset CCACHE_PATH -export CCACHE_COMPILERCHECK=content -exec %%PREFIX%%/%%CCLINKDIR%%/cc "$@" Index: files/world-ccache.in =================================================================== RCS file: files/world-ccache.in diff -N files/world-ccache.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/world-ccache.in 24 Feb 2011 17:12:42 -0000 @@ -0,0 +1,9 @@ +#!/bin/sh + +[ "${0##*/}" = "ccache" ] && +printf "Please, use one of the compiler links in\n%%PREFIX%%/%%CCLINKDIR%%/world\nto invoke ccache\n" >&2 && +exit 1 + +unset CCACHE_PATH +export CCACHE_COMPILERCHECK=content +exec %%PREFIX%%/%%CCLINKDIR%%/${0##*/} "$@"