Index: head/devel/ccache/Makefile =================================================================== --- head/devel/ccache/Makefile (revision 408672) +++ head/devel/ccache/Makefile (revision 408673) @@ -1,98 +1,98 @@ # Created by: Dominic Marks # $FreeBSD$ PORTNAME= ccache PORTVERSION= 3.2.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= http://www.samba.org/ftp/ccache/ \ LOCAL/bdrewery MAINTAINER= bdrewery@FreeBSD.org COMMENT= Tool to minimize the compile time of C/C++ programs LICENSE= GPLv3 GNU_CONFIGURE= yes HOWTO= ccache-howto-freebsd.txt CCLINKDIR= libexec/ccache SUB_FILES= ${HOWTO} world-ccache pkg-message ccache-update-links.sh PORTDOCS= ccache-howto-freebsd.txt MANUAL.html OPTIONS_DEFINE= CLANGLINK LLVMLINK STATIC DOCS TINDERBOX OPTIONS_DEFAULT=CLANGLINK LLVMLINK CLANGLINK_DESC= Create clang compiler links if clang is installed LLVMLINK_DESC= Create llvm compiler links if llvm is installed TINDERBOX_DESC= Create tarball for tinderbox usage USES= compiler # Don't allow autoreconf. We want no dependencies on this to keep # WITH_CCACHE_BUILD working. USES:= ${USES:Nautoreconf} OPTIONS_SUB= yes STATIC_LDFLAGS= -static .include . if ${COMPILER_TYPE} == clang CPPFLAGS+= -DCC_IS_CLANG . elif ${COMPILER_TYPE} == gcc CPPFLAGS+= -DCC_IS_GCC . endif PLIST_SUB+= CCLINKDIR="${CCLINKDIR}" .if ${ARCH}=="i386" CCACHE_COMPILERS+= icc icpc .endif GNU_COMPILERS+= 34 42 43 44 45 46 47 48 49 5 6 CCACHE_COMPILERS+= cc c++ CC gcc g++ ${GNU_COMPILERS:S|^|gcc|} ${GNU_COMPILERS:S|^|g++|} .if ${PORT_OPTIONS:MCLANGLINK} CLANG_COMPILERS+= 33 34 35 36 37 -devel CCACHE_COMPILERS+= clang clang++ ${CLANG_COMPILERS:S|^|clang|} ${CLANG_COMPILERS:S|^|clang++|} .endif .if ${PORT_OPTIONS:MLLVMLINK} CCACHE_COMPILERS+= llvm-gcc llvm-c++ llvm-g++ .endif CCACHE_COMPILERS+= ${EXTRA_COMPILERS} SUB_LIST+= CCACHE_COMPILERS="${CCACHE_COMPILERS}" \ CCLINKDIR="${CCLINKDIR}" \ ICCPREFIX="${LOCALBASE}/intel_cc_80/bin" \ HOWTO="${HOWTO}" post-build-TINDERBOX-on: @${MKDIR} ${WRKDIR}/tb/opt @${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${WRKDIR}/tb/opt .for l in ${CCACHE_COMPILERS} @${LN} -sf ${PORTNAME} ${WRKDIR}/tb/opt/${l} .endfor @${TAR} -C ${WRKDIR}/tb -cpf ${WRKSRC}/${PORTNAME}.tar opt do-install: ${INSTALL_PROGRAM} ${WRKSRC}/ccache ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/ccache.1 ${STAGEDIR}${PREFIX}/man/man1 ${MKDIR} ${STAGEDIR}${PREFIX}/${CCLINKDIR}/world ${INSTALL_SCRIPT} ${WRKDIR}/world-ccache \ ${STAGEDIR}${PREFIX}/${CCLINKDIR}/world/ccache ${INSTALL_SCRIPT} ${WRKDIR}/ccache-update-links.sh \ ${STAGEDIR}${PREFIX}/bin/ccache-update-links do-install-TINDERBOX-on: ${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.tar ${STAGEDIR}${DATADIR} do-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/MANUAL.html ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKDIR}/${HOWTO} ${STAGEDIR}${DOCSDIR} .include Index: head/devel/ccache/files/patch-ccache.c =================================================================== --- head/devel/ccache/files/patch-ccache.c (revision 408672) +++ head/devel/ccache/files/patch-ccache.c (revision 408673) @@ -1,28 +1,62 @@ -Determine whether cc(1) is clang or gcc at compile-time. +- Determine whether cc(1) is clang or gcc at compile-time. +- Don't hash -fcolor-diagnostics; make will auto use it while make -j will not. + There's no reason to not use the cache in either of these cases if it is + already available. +-bdrewery --- ccache.c.orig 2015-10-08 19:14:23 UTC +++ ccache.c @@ -1350,6 +1350,11 @@ compiler_is_clang(struct args *args) { char *name = basename(args->argv[0]); bool is = strstr(name, "clang") != NULL; +#ifdef CC_IS_CLANG + if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || + strcmp(name, "c++") == 0) + is = true; +#endif free(name); return is; } @@ -1359,6 +1364,11 @@ compiler_is_gcc(struct args *args) { char *name = basename(args->argv[0]); bool is = strstr(name, "gcc") || strstr(name, "g++"); +#ifdef CC_IS_GCC + if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || + strcmp(name, "c++") == 0) + is = true; +#endif free(name); return is; } +@@ -1463,6 +1473,7 @@ calculate_common_hash(struct args *args, + free(p); + } + ++#if 0 + /* Possibly hash GCC_COLORS (for color diagnostics). */ + if (compiler_is_gcc(args)) { + const char *gcc_colors = getenv("GCC_COLORS"); +@@ -1471,6 +1482,7 @@ calculate_common_hash(struct args *args, + hash_string(hash, gcc_colors); + } + } ++#endif + } + + /* +@@ -1509,6 +1521,13 @@ calculate_object_hash(struct args *args, + continue; + } + ++ /* Colors do not affect compilation. */ ++ if (str_startswith(args->argv[i], "-fcolor-diagnostics") || ++ str_eq(args->argv[i], "-fdiagnostics-color") || ++ str_eq(args->argv[i], "-fdiagnostics-color=always")) { ++ continue; ++ } ++ + /* The -fdebug-prefix-map option may be used in combination with + * CCACHE_BASEDIR to reuse results across different directories. Skip it + * from hashing. */