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

PortSystem          1.0
PortGroup           qmake 1.0

name                qt4-creator-mac
categories          devel aqua
platforms           darwin
license             LGPL-2.1
maintainers         {michaelld @michaelld} 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.

version             2.8.1
revision            4
checksums           rmd160 9348896ff468a90e2c36260621c615c1ee89e82c \
                    sha256 d5ae007a297a4288d0e95fd605edbfb8aee80f6788c7a6cfb9cb297f50c364b9 \
                    size   24381282

set branch          [join [lrange [split ${version} .] 0 1] .]
homepage            https://www.qt.io/qt-features-libraries-apis-tools-and-ide/
distname            qt-creator-${version}-src
master_sites        https://download.qt.io/official_releases/qtcreator/${branch}/${version}/

depends_lib-append  port:qt4-mac-sqlite3-plugin \
                    port:botan1

# fix up QMake build files to remove debug and release building;
# specify that here instead.
patchfiles          patch-remove_build_types.diff \
                    patch-macports-paths.diff \
                    patch-no-pointer-comparison.diff

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

    # add MacPorts-specific paths to the list of search paths for Qt binaries
    reinplace "s|@@PREFIX@@|${prefix}|" \
        ${worksrcpath}/src/libs/utils/environment.cpp
    reinplace "s|@@QT_APPS_DIR@@|${qt_apps_dir}|" \
        ${worksrcpath}/src/plugins/qtsupport/baseqtversion.cpp
}

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.args      "USE_SYSTEM_BOTAN=1"

build.target-append docs

# 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}"
}

livecheck.type none
