# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 119952 2014-05-11 20:43:50Z devans@macports.org $

PortSystem      1.0

name            evolution-data-server
version         3.12.2
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Addressbook and calender libs for GNOME.
long_description    Evolution Data Server provides a central location for \
                    addressbook and calendar in the GNOME Desktop.
maintainers     devans openmaintainer
categories      gnome
license         LGPL-2+
platforms       darwin
homepage        https://wiki.gnome.org/Apps/Evolution
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  d1ed55fc11522b92b88facda85ea918034a2fc43 \
                sha256  91c95e17a8c1cd1086dafcd99a40bdf8f5993770f251f8b0a10e5395e3f5a3b6

depends_build   port:pkgconfig \
                port:gnome-common \
                port:intltool \
                port:gtk-doc

depends_lib     port:gtk3 \
                port:libxml2 \
                port:libsoup \
                port:libsecret \
                port:gcr \
                port:libiconv \
                port:nss \
                port:nspr \
                port:libgweather \
                port:libical \
                port:libgdata \
                port:gnome-online-accounts \
                port:gobject-introspection \
                port:sqlite3 \
                port:vala \
                port:db46

patchfiles      patch-configure.ac.diff \
                patch-addressbook-libebook-contacts-e-phone-number-private.cpp.diff

# update m4/intltool.m4 and autoreconf

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf  yes
autoreconf.args -fvi

configure.env-append \
                DB_CFLAGS="-I${prefix}/include/db46" \
                DB_LIBS="-L${prefix}/lib/db46 -ldb"

configure.args  --enable-smime \
                --enable-ipv6 \
                --enable-weather \
                --enable-google \
                --enable-goa \
                --enable-introspection=yes \
                --enable-vala-bindings \
                --with-nspr-includes=${prefix}/include/nspr  \
                --with-nspr-libs=${prefix}/lib/nspr  \
                --with-nss-includes=${prefix}/include/nss \
                --with-nss-libs=${prefix}/lib/nss \
                --with-krb5=/usr \
                --disable-uoa \
                --disable-silent-rules \
                --disable-schemas-compile

#
# port nss is not universal
#

universal_variant no

# gobject-introspection uses g-ir-scanner, which uses $CC from env
build.args-append       CC="${configure.cc} ${configure.cc_archflags}"
destroot.args-append    CC="${configure.cc} ${configure.cc_archflags}"

variant phonenumber description {Phone number parsing/validation using libphonenumber} {
    depends_lib-append          port:libphonenumber-cpp
    configure.cxxflags-append   -DI18N_PHONENUMBERS_USE_BOOST
    configure.args-append       --with-phonenumber=${prefix}/lib
}

post-activate    {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type  gnome
