# -*- 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 118012 2014-03-19 10:32:53Z raimue@macports.org $

PortSystem              1.0
PortGroup               github 1.0

github.setup            visionmedia git-extras 1.9.0
revision                2
maintainers             nomaintainer
platforms               darwin
categories              devel
supported_archs         noarch

description             Git utilities
long_description        \
    ${description} -- repo summary, repl, changelog population, author \
    commit percentages and more
license                 MIT
checksums               rmd160  31271c980b71305c3d0432f961baafbf1298734f \
                        sha256  64043f4193217ecdc115f41e1093f88910e759d7cf2883cd0e72824e61e98854

patchfiles              patch-remove-auto-updater.diff

configure {
    reinplace "s| /etc| ${prefix}/etc|g" ${worksrcpath}/Makefile
    reinplace "s|\$(DESTDIR)/etc|\$(DESTDIR)\$(PREFIX)/etc|g" ${worksrcpath}/Makefile
}
build {}
destroot.destdir        PREFIX=${destroot}${prefix}
post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${subport}
    xinstall -d ${docdir}
    eval xinstall -m 644 [glob ${worksrcpath}/man/*.html] ${docdir}
}

pre-activate {
    # git-extras @1.7.0_0 installed a file to /opt/local/etc/bash_completion.d/
    # remove it if found
    set filepath ${prefix}/etc/bash_completion.d/git-extras
    if {[file exists ${filepath}] && [registry_file_registered ${filepath}] == "0"} {
        if {[catch {delete ${filepath}}]} {
            ui_warn "Cannot delete ${filepath}; please remove it manually"
        }
    }
}
