# -*- 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$

PortSystem          1.0
PortGroup           qt4 1.0

name                qgit
version             2.5.20140910
categories          devel
license             GPL-2
maintainers         free.fr:ocroquette openmaintainer
description         A Qt graphical interface to git repositories
long_description    ${description}

homepage            http://libre.tibirna.org/projects/qgit

fetch.type          git
git.url             git://repo.or.cz/qgit4/redivivus.git
git.branch          c83cb5819443adf0e3b60d1ac3a63d9cbb22e124

platforms           darwin

depends_lib-append  port:git

patchfiles          patch_src_qgit.cpp.diff

variant debug description "Build as both release and debug" {}

post-patch {
    # when not doing debug ...
    if {![variant_isset debug]} {
        # ... build just the release version
        reinplace "s@debug_and_release@release@" ${worksrcpath}/qgit.pro
        reinplace "s@debug_and_release@release@" ${worksrcpath}/src/src.pro
    }
    # nothing to do if +debug is specified; this is the default.
}

# --disable-dependency-tracking is not recognized.
configure.universal_args-delete --disable-dependency-tracking

pre-configure {
    configure.args-append CONFIG+=\"${qt_arch_types}\"
}

configure.cmd       ${qt_qmake_cmd}
configure.pre_args
configure.post_args

destroot {
    xinstall -m 755 -d ${destroot}${qt_apps_dir}
    copy ${worksrcpath}/bin/qgit.app ${destroot}${qt_apps_dir}

    # Also link to ${prefix}/bin for easier access from the command line
    # Especially useful since qgit is supposed to be started from
    # the GIT repository location.
    ln -s ${qt_apps_dir}/qgit.app/Contents/MacOS/qgit ${destroot}${prefix}/bin
}

livecheck.type   none