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

name                gnokii
version             0.6.31
revision            5
license             GPL-2+
categories          comms
platforms           darwin
maintainers         ieee.org:mpal1+bugzilla
description         Tools to manipulate Nokia and other mobile phones.
long_description    gnokii provides tools and a user space driver for use \
                    with mobile phones under Linux, various unices and \
                    Win32. With gnokii you can do such things as make data \
                    calls, update your address book, change calendar \
                    entires, send and receive SMS messages and load ring \
                    tones depending on the phone you have.

homepage            http://www.gnokii.org/

use_bzip2           yes
master_sites        http://gnokii.org/download/gnokii/ \
                    http://gnokii.org/download/gnokii/0.6.x/ \
                    ftp://ftp.gnokii.org/pub/gnokii/ \
                    ftp://ftp.gnokii.org/pub/gnokii/0.6.x/ \
                    http://ftp.slackware.pl/pub/gnokii/gnokii/ \
                    http://ftp.slackware.pl/pub/gnokii/gnokii/0.6.x/

checksums           rmd160  a828dab090c8f6decd28ca2f7c9923df0df28c32 \
                    sha256  8f5a083b05c1a66a3402ca5cd80084e14c2c0632c991bb53b03c78e9adb02501

depends_build       port:intltool \
                    port:pkgconfig \
                    port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         port:gettext \
                    port:iso-codes \
                    port:libical \
                    port:libusb-compat \
                    port:readline

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
    reinplace "s|/etc/gnokiirc|${prefix}/etc/gnokiirc|" ${worksrcpath}/common/cfgreader.c
    reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/Docs/sample/gnokiirc
}

configure.cmd       ./autogen.sh

configure.ldflags-append \
                    -lintl -lglib-2.0

configure.args      --enable-security \
                    --disable-smsd \
                    --with-libiconv-prefix=${prefix} \
                    --with-readline=${prefix} \
                    --disable-bluetooth \
                    --without-x

post-activate {
    if {![file exists ${prefix}/etc/gnokiirc]} {
        copy ${prefix}/share/doc/gnokii/sample/gnokiirc ${prefix}/etc/gnokiirc
    }
}


platform macosx {
    configure.ldflags-append -framework CoreFoundation
    
    # bluetooth does not work anymore on Mac OS X version 10.7+, see #34162, #42640

    if {${os.major} < 11} {
        variant bluetooth description {Enable support for bluetooth (broken on Mac OS X >=10.7)} {
            configure.args-replace --disable-bluetooth --enable-bluetooth
            configure.ldflags-append -framework IOBluetooth
        }
    }
}

variant x11 {
    depends_lib-append      path:lib/pkgconfig/gtk+-2.0.pc:gtk2
    configure.args-delete   --without-x
}

default_variants    +x11
