# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        pieter gitx 0.7.1 v
name                GitX
revision            3
maintainers         cal openmaintainer

categories          devel
description         GitX is a git GUI specifically for Mac OS X
long_description    GitX is a gitk like clone written specifically for OS X Leopard and higher. \
                    This means that it has a native interface and tries to integrate with the \
                    operating system as good as possible. Examples of this are drag and drop \
                    support and QuickLook support.

platforms           darwin
license             GPL
homepage            http://gitx.frim.nl/

fetch.type          git

depends_lib-append  port:git
installs_libs       no

xcode.target        GitX
xcode.configuration Release

patchfiles          10-disable-finder-integration.patch \
                    20-remove-enable-terminal-usage.patch \
                    21-remove-install-cli-tool.patch \
                    30-remove-sparkle.patch \
                    31-remove-sparkle-from-xcodebuild.patch \
                    40-git-submodules-via-https.patch \
                    50-use-libstc++.patch
                    # GitX uses __gnu_cxx::stdio_filebuf, which isn't available in libc++

variant finder_integration description {Enable Finder integration, opening .git folders with GitX} {
    patchfiles-delete   10-disable-finder-integration.patch
}

default_variants +finder_integration

pre-fetch {
    if {${os.major} < 9} {
        return -code error "This version of ${name} is only for Mac OS X 10.5 or later."
    }
}

post-patch {
    file delete -force ${worksrcpath}/Sparkle.framework
    reinplace "s|make CFLAGS=\\\\\"-arch .*\\\\\"|make CFLAGS=\\\\\"[get_canonical_archflags]\\\\\"|g" \
        ${worksrcpath}/GitX.xcodeproj/project.pbxproj
}

post-destroot {
    move ${destroot}${applications_dir}/gitx ${destroot}${prefix}/bin
}