Changes between Version 7 and Version 8 of howto/ccache


Ignore:
Timestamp:
Apr 26, 2019, 8:00:07 AM (5 years ago)
Author:
ra1nb0w
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/ccache

    v7 v8  
    5353=== '''Use ccache outside MacPorts''' ===
    5454
    55 To use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`.
     55MacPorts doesn't create symlinks to local compiler therefore you need to create it manually.
     56
     57One 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
     67prefix="/opt/local"
     68dest_links="${prefix}/libexec/ccache"
     69bin_paths="/usr/bin /opt/local/bin /usr/local/bin"
     70ccache_bin=$(which ccache)
     71
     72# set umask to avoid strict starting shell
     73umask 022
     74
     75if [ ! -d ${dest_links} ]; then
     76  install -d ${dest_links}
     77fi
     78
     79find $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*" | \
     83while read file; do
     84  base=$(basename $file)
     85  ln -s ${ccache_bin} ${dest_links}/${base}
     86done
     87
     88echo ">> add $dest_links in front of your \$PATH"
     89}}}
     90
     91
     92Now to use ccache also outside MacPorts you have to edit your PATH which is set in your `.profile` or `.bash_profile`.
    5693
    5794First, 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.
     
    69106'''Important:''' Reopen your Terminal afterwards.
    70107
    71 If you now use commands like ''gcc'' they automatically go through ccache.
     108If you now use commands like ''gcc'' or "clang" they automatically go through ccache.
    72109
    73110[wiki:howto <- Back to the HOWTO section]