# -*- 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 79511 2011-06-16 04:49:06Z jeremyhu@macports.org $

PortSystem          1.0
PortGroup           archcheck 1.0
PortGroup           cmake 1.0

name                libproxy
version             0.4.6
revision            1
epoch               1
categories          net
maintainers         devans openmaintainer
platforms           darwin
homepage            http://code.google.com/p/${name}/
master_sites        googlecode

description         A library that provides automatic proxy configuration management.


long_description    Libproxy exists to answer the question: Given a \
                    network resource, how do I reach it? It handles all \
                    the details, enabling you to get back to programming.

checksums           md5     199c6b120baf1f7258a55f38d5ec74f5 \
                    sha1    6e9745c87b774f34bf53f07a54284c0d72020e94 \
                    rmd160  f5f03c84ad2d87fe728869fadc669628737c639e

patchfiles          patch-libproxy-cmake.diff

depends_build-append \
                    port:pkgconfig

depends_lib         port:gconf \
                    port:perl5

# default to python27 bindings
if {![variant_isset python27] && ![variant_isset python26]} {
    default_variants +python27
}

variant python27 conflicts python26 \
description {Build Bindings for Python 2.7} {
    set python_prefix ${frameworks_dir}/Python.framework/Versions/2.7
    depends_lib-append port:python27
    configure.python ${prefix}/bin/python2.7
    configure.args-append \
                    -DPYTHON_SITEPKG_DIR=${python_prefix}/lib/python2.7/site-packages
}

variant python26 conflicts python27 \
description {Build Bindings for Python 2.6} {
    set python_prefix ${frameworks_dir}/Python.framework/Versions/2.6
    depends_lib-append port:python26
    configure.python ${prefix}/bin/python2.6
    configure.args-append \
                    -DPYTHON_SITEPKG_DIR=${python_prefix}/lib/python2.6/site-packages
}

#
# webkit and mozjs pacrunners disabled by default due to the
# following issues
#
# webkit pacrunner circular dependency problem
# webkit-gtk -> libsoup -> libproxy -> webkit-gtk (#26261)
#
# pac files support not available on Tiger (#24127)
#
# TODO: add variants that safely enable these features
#

configure.args-append \
                    -DWITH_GNOME=YES \
                    -DWITH_KDE4=NO \
                    -DWITH_WEBKIT=NO \
                    -DWITH_MOZJS=NO \
                    -DWITH_NM=NO \
                    -DWITH_VALA=NO \
                    -DWITH_PERL=YES \
                    -DWITH_PYTHON=YES

variant no_gnome description {Disable GNOME plugin} {
        configure.args-delete -DWITH_GNOME=YES
        configure.args-append -DWITH_GNOME=NO
        depends_lib-delete port:gconf
}

variant kde description {Enable KDE4 plugin} {
        configure.args-delete -DWITH_KDE4=NO
        configure.args-append -DWITH_KDE4=YES
        depends_lib-append port:kdelibs4
}

post-patch {
	reinplace "s:-D_POSIX_C_SOURCE=1:-D_POSIX_C_SOURCE=200112L:" ${worksrcpath}/libproxy/CMakeLists.txt
}

livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
