# -*- 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                qt-assistant
version             4.6.3
revision            1
categories          devel aqua
license             LGPL-2.1
platforms           macosx
maintainers         michaelld openmaintainer

homepage            http://qt.nokia.com/
description         Qt Assistant
long_description    Qt Assistant: Offering backwards compatibility for \
    certain applications, relying on certain parts of Qt 3 through \
    Qt 4.6.3, to work with Qt 4.7+. \
    this module was removed from Qt as of version 4.7.0.

master_sites        trolltech
distname            qt-assistant-qassistantclient-library-compat-src-${version}
checksums           md5     a20148e0488d5c12ab35ccc107dcc64d \
                    sha1    7a5e5155136c406e5b7eb880eed752f56625d10b \
                    rmd160  f34da3587cb311f42aa19b9c8259b90269590c61

worksrcdir          qt-assistant-qassistantclient-library-compat-version-${version}

patchfiles          patch-compat.pro.diff \
                    patch-lib_lib.pro.diff

post-patch {
    # set arch type(s)
    reinplace "s|@ARCHES@|${qt_arch_types}|g" \
        ${worksrcpath}/lib/lib.pro \
        ${worksrcpath}/compat.pro

    # move files around
    system "cd ${worksrcpath} && mkdir compat && \
                mv `/bin/ls -1 | grep -v compat | grep -v lib` \
                    compat.pro compat"

    # copy QMake and library files into place
    system "cd ${filespath}/qmake; tar cf - . | \
            (cd ${worksrcpath}; tar xf -)"

    # fix up libbrary's QMake build file to handle debug and release
    # do not change how the .app builds
    set build_type "release"
    if {[variant_isset debug]} {
        set build_type "debug_and_release build_all"
    }
    reinplace "s/@BUILD_TYPE@/${build_type}/" \
        ${worksrcpath}/lib/lib.pro

    # fix app install location
    reinplace "s,@QT_APPS_DIR@,${qt_apps_dir}," \
        ${worksrcpath}/compat/compat.pro

    # create links so that compiling works
    system "cd ${worksrcpath}/lib/include/QtAssistant; \
                ln -s ../../*.h ."
}

# set up to use the installed QMake files
configure.cmd       ${qt_qmake_cmd}
configure.pre_args  
configure.args      "-o Makefile qta.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"
    }
}

universal_variant   yes

variant debug description "Build release and debug versions" {}

livecheck.type      regex
livecheck.url       http://get.qt.nokia.com/qt/source/
livecheck.regex     "qt-assistant-qassistantclient-library-compat-src-(\[0-9a-z.-\]+)${extract.suffix}"