# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 118861 2014-04-13 16:53:15Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        jrosdahl ccache c0b40b8b634ff966a097598447317a9f7754a53a
name                ccache-devel
version             3.2.0-20140108
categories          devel
platforms           darwin freebsd
license             GPL-3+

maintainers         landonf ryandesign openmaintainer

description         object-file caching compiler wrapper

long_description \
    ccache is a compiler cache.  It acts as a caching pre-processor to C/C++ \
    compilers, using the -E compiler switch and a hash to detect when a \
    compilation can be satisfied from cache.  This often results in a 5 to 10 \
    times speedup in common compilations.

homepage            http://ccache.samba.org/

checksums           rmd160  dbb6552f564e83db636fd225c44f8c6bb5ee9951 \
                    sha256  573f738adeb4b3bfcd2d09b3823f995b4df474ffad8b0a49f1b4b15f941f45eb

depends_build       port:asciidoc \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:libxslt

depends_lib         port:zlib

patchfiles          patch-dev.mk.in.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/dev.mk.in
}

use_autoconf        yes
autoconf.cmd        ./autogen.sh

build.target-append ccache.1

set symlinks_dir    ${prefix}/libexec/ccache

post-destroot {
    file mkdir ${destroot}${symlinks_dir}

    foreach {bin} {
        cc
        gcc gcc2    gcc3    gcc-3.3 gcc-4.0 gcc-4.2
        c++ c++3    c++-3.3 c++-4.0 c++-4.2
        g++ g++2    g++3    g++-3.3 g++-4.0 g++-4.2
    } {
        ln -sf ${prefix}/bin/ccache ${destroot}${symlinks_dir}/${bin}
    }
}

conflicts           ccache

notes "The ccache symlinks are installed in ${symlinks_dir}"
