Changes between Version 1 and Version 2 of howto/ccache
- Timestamp:
- Feb 16, 2008, 2:57:04 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
howto/ccache
v1 v2 8 8 This 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 9 10 == Installation and Configuration==10 == Installation == 11 11 12 1. '''Install ccache''' 12 === Step 1: '''Install ccache''' === 13 13 14 14 {{{ 15 15 $ sudo port install ccache 16 16 }}} 17 17 18 1. '''Edit macports.conf''' 18 === Step 2: '''Edit macports.conf''' === 19 19 20 21 20 Open `/opt/local/etc/macports/macports.conf` in your favorite editor. Find the line 21 {{{ 22 22 configureccache no 23 24 25 23 }}} 24 and change it to 25 {{{ 26 26 configureccache yes 27 27 }}} 28 28 29 29 And you are done. From now on, MacPorts will use ccache for building. 30 30 31 == Configuration == 32 31 33 Please 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 34 {{{ 33 ccache -s35 $ ccache -s 34 36 }}} 35 37 36 38 If you believe ccache takes up to much disk space for you, there is the possibility to set a maximum by using something like 37 39 {{{ 38 ccache -M 2G40 $ ccache -M 2G 39 41 }}} 40 42 This makes ccache occupy a maximum of 2 GiB disk space to store cached files. 41 43 42 If you want to free some space, do a cleanup 44 If you want to free some space, do a cleanup with 43 45 {{{ 44 ccache -c46 $ ccache -c 45 47 }}} 46 48 47 49 == 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. 50 51 === '''Use ccache outside MacPorts''' === 52 53 To use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`. 54 55 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 56 52 53 57 There will be this line in there: 58 {{{ 54 59 export 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 {{{ 60 }}} 61 62 Now add the ccache binary path `/opt/local/ccache/bin` in front of already existing paths: 63 {{{ 58 64 export 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. 65 }}} 66 67 '''Important:''' Reopen your Terminal afterwards. 68 69 If you now use commands like ''gcc'' they automatically go through ccache.