ccache, bsdadminscripts and ports

Hi there, I'm currently running 7.2-RELEASE-p0 on a small Geode box (embedded type spec, 400MHz Geode, 256Mb RAM) so I'm looking to use ccache to speed things up (ie any kernel rebuilds and port rebuilds should I have to do them).

I currently use sudo with portmaster to install ports. I have "portmaster" aliased under my account to run "screen sudo portmaster" so that if the build takes too long I can detach and leave it running, and I figured that running sudo inside screen rather than vice versa was slightly more secure as the screen binary itself runs as me. My sudoers file is the included sample one, but allows %wheel to run all commands without a password.

I've installed devel/ccache and sysutils/bsdadminscripts, and configured /etc/make.conf to use buildflags.conf. I've also put in the block to use ccache for kernel/world compiles.

However, I'm unsure where I should be setting the PATH, CCACHE_DIR and CCACHE_PATH environment variables; am I best to set these in /root/.cshrc or should I set them in my own ~/.profile? Everywhere seems to suggest /root/.cshrc but if I set them there and do "sudo echo $PATH" it doesn't appear. Also, if I'm using buildflags.conf to handle CCACHE, do I still need to change the PATH in order to include the ccache "masqueraded" compilers before everything else or is this already handled for me by buildflags.conf?

Thanks!
 
you can configure sude to "forward" environmental variables. in default sudoers file there is already example, just $ visudo

I prefer putting variable in /etc/profile....(forgot the name, i'm on windows atm.) (there is also example)
so it should not be a big problem. ;)

also check guide/how to section, there is good how to on ccache....
It helped me a lot, especially one of the last posts
 
I did see a howto on here earlier, but that just made me a bit more confused; the original poster said "I did x, y and z" and then kamikaze (who seems to be the author of bsdadminscripts) said (s)he was using buildflags.conf, but without saying whether it's JUST this, or buildflags + env. vars.

I just noticed the last post in the thread which you gave thanks for, which suggests that the PATH modification is not needed anyway, and the other vars can be set in /etc/login.conf so they're "shell-neutral" so I'm going to try it this way. I guess I still have plenty of learning to do on FreeBSD having been a Linux user in the past!
 
I actually don't set any env variables. The defaults seem to be fine to me. I only ran [cmd=ccache]-M 4G[/cmd] to get a decently large cache. But 4G is really a lot more than most people need.

Ccache really just works fine. The benefits only show after having used it for a longer time. My current cache hit rate is 42% which is a really decent value.

Some ports do not support spaces in CC and break, but the buildflags.conf.sample file shows how to deal with those.

All you need to enable ccache (for everything) using the buildflags.conf, is the following:

Code:
USE_CCACHE

To turn off ccache support for certain ports use something like this:
Code:
USE_CCACHE

/usr/ports/* {
    */multimedia/ffmpeg {!USE_CCACHE}
    */print/scribus {!USE_CCACHE}
}

If you want to enable ccache only for ports, move the USE_CCACHE statement into the /usr/ports/* block, before the deactivating declarations.

All examples are valid, complete configuration files.
 
Back
Top