# $Id$

PortSystem      1.0

name            opensync
version         0.22
revision        4
categories      devel
license         LGPL-2.1+
maintainers     nomaintainer
description     Synchronization framework
long_description \
                OpenSync is a synchronization framework that is platform and \
                distribution independent.  It consists of a powerful sync-engine and \
                several plugins that can be used to connect to devices. \
                \
                OpenSync is very flexible and capable of synchronizing any type of \
                data, including contacts, calendar, tasks, notes and files.
platforms       darwin
homepage        http://www.opensync.org/
master_sites    ${homepage}download/releases/${version}/
use_bzip2       yes
distname        lib${name}-${version}
patchfiles      patch-configure.diff \
                patch-wrapper_opensync.i.diff
checksums       md5 f563ce2543312937a9afb4f8445ef932 \
                sha1 47860a8c6621aa89fbff2af2517787747af7cc30 \
                rmd160 a1e9715d037a7c474b80d609e6c96a24cbb6692f

depends_build   path:bin/pkg-config:pkgconfig
depends_lib     port:gettext \
                path:lib/pkgconfig/glib-2.0.pc:glib2 \
                port:libiconv \
                port:libxml2 \
                port:py26-gobject \
                port:py26-numeric \
                port:python26 \
                port:sqlite3 \
                port:swig-python \
                port:zlib

post-patch {
    reinplace "s|__PYTHON_PREFIX__|${frameworks_dir}/Python.framework/Versions/2.6|" ${worksrcpath}/configure
    reinplace "s|__PYTHON_EXEC_PREFIX__|${frameworks_dir}/Python.framework/Versions/2.6|" ${worksrcpath}/configure

    fs-traverse f ${worksrcpath} {
        if [string match "*/Makefile.in" ${f}] {
            reinplace "s|-Werror||" ${f}
        }
    }

    # unbreak with swig 2.0.0 (quick fix)
    reinplace "s|1.3.17|2.0.0|" ${worksrcpath}/configure
}

configure.env   PYTHON=${frameworks_dir}/Python.framework/Versions/2.6/bin/python2.6
configure.args  --disable-dependency-tracking --enable-python=2.6 --libexecdir=${prefix}/sbin

build.target

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README TODO ${destroot}${prefix}/share/doc/${name}
}