# -*- 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 79747 2011-06-24 20:34:36Z eborisch@macports.org $

PortSystem          1.0
PortGroup           qt4 1.0

name                qt4-creator-mac
version             2.2.1
categories          devel aqua
platforms           darwin
maintainers         mcalhoun openmaintainer
description         Cross-platform integrated development environment (IDE) tailored to the needs of Qt developers.
long_description    Qt Creator is a cross-platform integrated development environment (IDE) tailored to the needs of Qt developers.

homepage            http://qt.nokia.com/products/developer-tools
distname            qt-creator-${version}-src
master_sites        http://get.qt.nokia.com/qtcreator/

use_zip yes

checksums           md5     8a3165f7f68d4932c9a902452993099d \
                    sha1    6a369dffa7ee52ae068d9ebb3616e29d185a5009 \
                    rmd160  dc4b6d6306c770b0bcab3dbaf08cab19bc7c0100

# fix up QMake build files to remove debug and release building;
# specify that here instead.
patchfiles          patch-remove_build_types.diff

# If QT specifies just the name of the compiler, Creator can find it.
# qt4-mac, however,  specifiles the full path of g++ in the form "QMAKE_CXX= /usr/bin/g++-*.*"
# Creator thinks there is a space before the program name and can't find it.
# See http://bugreports.qt.nokia.com/browse/QTCREATORBUG-4370
patchfiles-append   patch-environment.cpp.diff

post-patch {
    # remove arch from QMake build scripts
    reinplace "/ppc/d" ${worksrcpath}/qtcreator.pri
}

pre-configure {
    # set arch type(s); done is a stage to make sure the 'options
    # qt_arch_types' is evaluated -after- +universal (if selected).
    configure.pre_args CONFIG+="${qt_arch_types}"

    # always build just the release, no debug
    configure.pre_args-append CONFIG+="release"
}

configure.cmd       ${qt_qmake_cmd}
configure.args      "-o Makefile qtcreator.pro"
configure.post_args
configure.universal_args

# allow ccache, if specified by the user
pre-build {
    if {[tbool configure.ccache]} {
        build.post_args "CCACHE=ccache"
    }
}

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

universal_variant   yes

livecheck.type      regex
livecheck.url       http://get.qt.nokia.com/qtcreator/
# Qt Creator 2.0.* requires Qt 4.7
livecheck.regex     "qt-creator-(2.\[0-9.-\]+)-src.zip"
#livecheck.regex     "qt-creator-(1.\[0-9.-\]+)-src.zip"
