hello! the attached patch allows ccache to use non-default compilers (especially clang, as it's the only one which will actually work) to build world and kernel. ehaupt@ suggested to let ports@ review it
it also updates documentation with the new instructions, and replaces libtool15 with libtool a couple of notes: - the clang warnings about unused arguments are really harmless. read more here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010- June/009539.html - i replaced world-* with world/* (this would obviously require a note in UPDATING) because of this (/sys/boot/i386/boot2/Makefile and others): CC:=${CC:C/^(.*\/)?clang$/gcc/1} world-clang wouldn't be replaced with world-gcc, while world/clang is successfully changed to world/gcc. in addition, this allows to have only one script (world/ccache), and just create links to it (like world/clang, world/llvm-gcc...) while i had no problems at building world with world/clang, i've not yet tested the port installation, but i'll do it as soon as i have a free tinderbox. meanwhile you can share your comments about the patch -- Alberto Villa, FreeBSD committer <avi...@freebsd.org> http://people.FreeBSD.org/~avilla Anything free is worth what you pay for it.
Index: Makefile =================================================================== RCS file: /home/pcvs/ports/devel/ccache/Makefile,v retrieving revision 1.57 diff -u -r1.57 Makefile --- Makefile 30 Nov 2010 22:37:33 -0000 1.57 +++ Makefile 17 Dec 2010 10:44:02 -0000 @@ -7,6 +7,7 @@ PORTNAME= ccache PORTVERSION= 3.1.3 +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} ${CCLINKDIR}/world SUB_FILES= ${HOWTO} pkg-message .endif @@ -42,10 +43,9 @@ .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/|} +SUB_FILES+= world-ccache SUB_LIST+= CCACHE_COMPILERS="${CCACHE_COMPILERS}" \ CCLINKDIR="${CCLINKDIR}" \ ICCPREFIX="${LOCALBASE}/intel_cc_80/bin" \ @@ -69,12 +69,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 17 Dec 2010 10:44:02 -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,12 +49,16 @@ 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 -Qunused-arguments to CFLAGS if you want to hide them. !!! 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. -- 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 17 Dec 2010 10:44:02 -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##*/} "$@"
signature.asc
Description: This is a digitally signed message part.