55 | | To use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`. |
| 55 | MacPorts doesn't create symlinks to local compiler therefore you need to create it manually. |
| 56 | |
| 57 | One way could be to use the following script that find the available compilers and create symlinks on {{{/opt/local/libexec/ccache}}}. |
| 58 | |
| 59 | {{{ |
| 60 | #!/bin/sh |
| 61 | |
| 62 | ## |
| 63 | ## run with sudo or adjust prefix/dest_links |
| 64 | ## |
| 65 | |
| 66 | # adjust if needed |
| 67 | prefix="/opt/local" |
| 68 | dest_links="${prefix}/libexec/ccache" |
| 69 | bin_paths="/usr/bin /opt/local/bin /usr/local/bin" |
| 70 | ccache_bin=$(which ccache) |
| 71 | |
| 72 | # set umask to avoid strict starting shell |
| 73 | umask 022 |
| 74 | |
| 75 | if [ ! -d ${dest_links} ]; then |
| 76 | install -d ${dest_links} |
| 77 | fi |
| 78 | |
| 79 | find $bin_paths \( -name "gcc*" -or -name "cc*" \ |
| 80 | -or -name "g++*" -or -name "c++*" \ |
| 81 | -or -name "clang++-mp*" -or -name "clang-mp*" \) | \ |
| 82 | egrep -v "cmake*|ccache*|ccomps*|c\+\+filt*" | \ |
| 83 | while read file; do |
| 84 | base=$(basename $file) |
| 85 | ln -s ${ccache_bin} ${dest_links}/${base} |
| 86 | done |
| 87 | |
| 88 | echo ">> add $dest_links in front of your \$PATH" |
| 89 | }}} |
| 90 | |
| 91 | |
| 92 | Now to use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`. |