# $Id: PKGBUILD 171533 2016-04-21 19:25:15Z arojas $
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=ccache
pkgver=3.2.5
pkgrel=1.1
pkgdesc="A compiler cache"
arch=('i686' 'x86_64')
url="http://ccache.samba.org/"
license=('GPL3')
depends=('zlib')
source=("http://samba.org/ftp/${pkgname}/${pkgname}-${pkgver}.tar.xz")
md5sums=('270c9ad0631c6e34f5fa84f0d9385f95')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr \
              --sysconfdir=/etc

  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  install -Dm 755 ccache ${pkgdir}/usr/bin/ccache
  install -Dm 644 ccache.1 ${pkgdir}/usr/share/man/man1/ccache.1

  install -d ${pkgdir}/usr/lib/ccache/bin
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/cc
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/gcc
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/g++
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/cpp
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/c++
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/${CHOST}-cc
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/${CHOST}-gcc
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/${CHOST}-g++
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/${CHOST}-cpp
  ln -sf /usr/bin/ccache ${pkgdir}/usr/lib/ccache/bin/${CHOST}-c++
}
