Magellan Linux

Diff of /trunk/ccache/ccache-config

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1617 by niro, Tue May 8 20:06:05 2007 UTC revision 1618 by niro, Sat Jan 14 01:07:08 2012 UTC
# Line 10  Line 10 
10  #  #
11  # Additional features to come; this provides a starting point  # Additional features to come; this provides a starting point
12    
13    LIBDIR="lib"
14    
15  # this should be getopt'd someday (override with CC_QUIET=1)  # this should be getopt'd someday (override with CC_QUIET=1)
16  CC_VERBOSE=1  CC_VERBOSE=1
17    
18  cc_echo() {  cc_echo()
19    {
20   [ -z "${CC_QUIET}" -a -n "${CC_VERBOSE}" ] && echo "$*"   [ -z "${CC_QUIET}" -a -n "${CC_VERBOSE}" ] && echo "$*"
21  }  }
22    
# Line 22  cc_echo() { Line 25  cc_echo() {
25  #  they allow the user or other scripts (namely gcc-config) to  #  they allow the user or other scripts (namely gcc-config) to
26  #  automatically update ccache's links when upgrading toolchains  #  automatically update ccache's links when upgrading toolchains
27  #  #
28  cc_remove_link() {  cc_path()
29   local t="/usr/lib/ccache/bin/${1}"  {
30   if [ -L ${t} ]; then   echo ${MROOT%/}/usr/${LIBDIR}/ccache/bin/$1
31    }
32    
33    cc_remove_link()
34    {
35     local t=$(cc_path "$1")
36     if [ -L ${t} ]
37     then
38   cc_echo "Removing ${t}..."   cc_echo "Removing ${t}..."
39   rm -f "${t}"   rm -f "${t}"
40   fi   fi
41  }  }
42  cc_install_link() {  
43    cc_install_link()
44    {
45   # Search the PATH for the specified compiler   # Search the PATH for the specified compiler
46   #  then create shadow link in /usr/lib/ccache/bin to ccache   #  then create shadow link in /usr/lib/ccache/bin to ccache
47    
48   if [ -n "$(type -p ${1})" ]; then   if [ -n "$(type -p ${1})" ]
49     then
50   # first be sure any old link is removed   # first be sure any old link is removed
51   CC_QUIET=1 cc_remove_link "${1}"   CC_QUIET=1 cc_remove_link "${1}"
52    
53   # then create the new link   # then create the new link
54   local t="/usr/lib/ccache/bin/${1}"   local t=$(cc_path "$1")
55   cc_echo "Creating ccache shadow link: ${t}..."   cc_echo "Creating ccache shadow link: ${t}..."
56   ln -s /usr/bin/ccache "${t}"   mkdir -p -m 0755 "${t%/*}" && ln -s /usr/bin/ccache "${t}"
57   fi   fi
58  }  }
59  cc_links() {  
60    cc_links()
61    {
62   local a   local a
63   for a in gcc cc c++ g++ ; do   for a in gcc cc c++ g++
64   [ -n "${2}" ] && a="${2}-${a}"   do
65     if [ -n "${2}" ]
66     then
67     # gcc-config doesn't install ${CHOST}-cc, so until
68     # it does, don't install a ccache symlink for it
69     [ "${a}" = "cc" ] && continue
70     a="${2}-${a}"
71     fi
72   eval "cc_${1}_link" "${a}"   eval "cc_${1}_link" "${a}"
73   done   done
74  }  }
# Line 65  case "${1}" in Line 87  case "${1}" in
87   echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]"   echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]"
88   ;;   ;;
89  esac  esac
   

Legend:
Removed from v.1617  
changed lines
  Added in v.1618