# Description: Masquerade directory to use distcc with clang
# URL: http://distcc.org/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: clang distcc

name=clang-distcc-bindings
version=18
release=1
source=()

build() {
  install -d $PKG/usr/lib/distcc

  local clang0="$(clang --version | awk -F'[ .]' '/version/ { print $3"."$4 }')"
  local clang1="${clang0:0:2}"

  if [ -z $clang0 ]; then
    echo 'Failed to find clang version'
    exit 1
  fi

  ln -s ../../bin/distcc $PKG/usr/lib/distcc/clang
  ln -s ../../bin/distcc $PKG/usr/lib/distcc/clang-$clang0
  ln -s ../../bin/distcc $PKG/usr/lib/distcc/clang-$clang1
  ln -s ../../bin/distcc $PKG/usr/lib/distcc/clang++
}
