# -*- 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 86279 2011-10-24 10:18:58Z ryandesign@macports.org $

PortSystem       1.0
PortGroup        qt4 1.0

name             qlandkarte
categories       gis
version          0.7.3
revision         4
platforms        darwin
maintainers      nomaintainer

description      Use your Garmin GPS with Linux/Mac OS X
long_description "QLandkarte is a QT Application similar to Garmin's MapSource."

homepage         http://qlandkarte.sourceforge.net/
master_sites     sourceforge:project/qlandkarte/qlandkarte/QLandkarte-${version}
distname         QLandkarte_${version}

checksums        md5 51f804235511f1c10ae8538f86743135

depends_lib-append port:proj \
                 port:libusb-compat

configure.args   --with-extra-includes=${prefix}/include\
                 --with-extra-libs=${prefix}/lib \
                 --with-qt-dir=${qt_dir}

post-patch {
    # fix lack of CoreFoundation after libgarmin.a
    foreach pro_file { EtrexLegendC/EtrexLegendC.pro \
                       EtrexLegendCx/EtrexLegendCx.pro \
                       GPSMap60CSx/GPSMap60CSx.pro \
                       whatGarmin/whatGarmin.pro } {
        reinplace "s|IOKit|IOKit -framework CoreFoundation|" \
            ${worksrcpath}/src/device/${pro_file}
    }
}

destroot {
    xinstall -d ${destroot}${applications_dir}
    copy ${worksrcpath}/bin/QLandkarte.app ${destroot}${applications_dir}
    ln -s ${applications_dir}/QLandkarte.app/Contents/MacOS/QLandkarte ${destroot}${prefix}/bin
    foreach plugin [glob -directory ${worksrcpath}/bin/plugins *] {
        copy ${plugin} ${destroot}${applications_dir}/QLandkarte.app/Contents/Resources/plugins/
    }
}
