Using ccache for build{world, kernel}

Nicolas Blais nb_root at videotron.ca
Tue Nov 15 15:01:43 PST 2005


On November 15, 2005 05:58 pm, Steve Hodgson wrote:
> Jens Schweikhardt wrote:
> >Steve et al,
> >
> ># So would the following form a better set of instructions for the port
> ># (given the above patch is merged)?
> >
> >Might not, because...
> >
> ># 1. don't follow the instructions about changing your PATH and setting
> ># CCACHE_PATH in /etc/profile or cshrc
> ># 2. use the following in /etc/make.conf
> >#
> ># .if !defined(NOCCACHE)
> ># .if ${.CURDIR:M/usr/src*}
> >
> >...I'm not sure whether the CURDIR always is under /usr/src;
> >it might change to somewhere under /usr/obj. Haven't investigated, though.
> >
> ># CC=CCACHE_NOHASH_SIZE_MTIME=y /usr/local/bin/ccache cc
> ># CXX=CCACHE_NOHASH_SIZE_MTIME=y /usr/local/bin/ccache c++
> ># .else
> ># CC=/usr/local/bin/ccache cc
> ># CXX=/usr/local/bin/ccache c++
> ># .endif
> ># .endif
> >#
> ># (untested though)
> >
> >I would simply not mess with make.conf and obfuscated .CURDIR magic, but
> >rather write a little and obvious shell script "build-sys" along
> >
> >#!/bin/sh
> >set -e
> >unset CCACHE_PATH  # Make ccache search PATH for the real compilers.
> >CC="/usr/local/bin/ccache cc" CXX="/usr/local/bin/ccache c++"
> >export CCACHE_NOHASH_SIZE_MTIME=yes
> >cd /usr/src
> >make CC="${CC}" CXX="${CXX}" buildworld
> >make CC="${CC}" CXX="${CXX}" buildkernel
> >
> >Does this work for you? BTW, you can always disable ccache with
> >export CCACHE_DISABLE=yes.
> >
> >Regards,
> >
> >	Jens
>
> I agree that that is an option, and here is another. I'm not going to
> suggest which is the better solution, that is probably up to the
> maintainer.
>
> 1. Create a new file /usr/local/bin/ccache-world:
>
> #!/bin/sh
> export CCACHE_NOHASH_SIZE_MTIME=1
> /usr/local/bin/ccache $@
>
> 2. Change the instructions in the ccache port in line with my last
> email, removing references to CCACHE_PATH and changing the PATH
> variable. Edit /etc/make.conf:
>
> .if !defined(NOCCACHE)
> .if ${.CURDIR:M/usr/src*} || ${.CURDIR:M/usr/obj*}
> CC=/usr/local/bin/ccache-world cc
> CXX=/usr/local/bin/ccache-world c++
> .else
> CC=/usr/local/bin/ccache cc
> CXX=/usr/local/bin/ccache c++
> .endif
> .endif
>
> Though this does seem a rather nasty solution. But it doesn't require
> users to change their habits to use ccache for kernel/world builds.
>
> Steve
>
> (this has been tested this time!)

As a frequent 'buildworld' user, I probably like this better.
-- 
FreeBSD 7.0-CURRENT #0: Tue Nov 15 06:21:56 EST 2005     
root at clk01a:/usr/obj/usr/src/sys/CLK01A 
PGP? : http://www.clkroot.net/security/nb_root.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20051115/c32aa83f/attachment.bin


More information about the freebsd-current mailing list