Changes between Initial Version and Version 1 of howto/ccache


Ignore:
Timestamp:
Feb 16, 2008, 2:52:58 AM (16 years ago)
Author:
raimue (Rainer Müller)
Comment:

How to enable ccache

Legend:

Unmodified
Added
Removed
Modified
  • howto/ccache

    v1 v1  
     1= How to enable ccache =
     2
     3  * Audience: All users
     4  * Requires: MacPorts >=1.6.0
     5
     6== Introduction ==
     7
     8This HOWTO covers how to enable building with [http://ccache.samba.org ccache]. It is a compiler cache. It uses the gcc -E switch and a hash to detect when a compilation can be satisfied from cache. The effect is that packages frequently compile 5-10 times faster than they would otherwise.
     9
     10== Installation and Configuration ==
     11
     12  1. '''Install ccache'''
     13   
     14    {{{
     15$ sudo port install ccache
     16    }}}
     17
     18  1. '''Edit macports.conf'''
     19 
     20  Open `/opt/local/etc/macports/macports.conf` in your favorite editor. Find the line
     21   {{{
     22configureccache     no
     23    }}}
     24  and change it to
     25    {{{
     26configureccache     yes
     27    }}}
     28
     29And you are done. From now on, MacPorts will use ccache for building.
     30
     31Please note that cache files are stored in .ccache in your home directory. To see some statistics how useful ccache is for you and how many disk space it takes, use
     32{{{
     33ccache -s
     34}}}
     35
     36If you believe ccache takes up to much disk space for you, there is the possibility to set a maximum by using something like
     37{{{
     38ccache -M 2G
     39}}}
     40This makes ccache occupy a maximum of 2 GiB disk space to store cached files.
     41
     42If you want to free some space, do a cleanup
     43{{{
     44ccache -c
     45}}}
     46
     47== Optional Parts ==
     48  * '''Use ccache outside MacPorts'''
     49    To use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`.
     50    First, locate the file you are using. If there is a ''.bash_profile'' edit this file, if there is only ''.profile'' you want to edit this.
     51   
     52  There will be this line in there:
     53    {{{
     54export PATH=/opt/local/bin:/opt/local/sbin:$PATH
     55    }}}
     56  Now add the ccache binary path `/opt/local/ccache/bin` in front of already existing paths:
     57    {{{
     58export PATH=/opt/local/ccache/bin:/opt/local/bin:/opt/local/sbin:$PATH
     59    }}}
     60  '''Important:''' Reopen your Terminal.
     61  [[BR]]
     62  If you now use commands like ''gcc'' they automatically go through ccache.