# -*- 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                redland-bindings
version             1.0.17.1
description         Redland RDF Language Bindings
long_description    Redland is a set of free software libraries that provide \
                    support for the Resource Description Framework (RDF). \
                    This package provides higher-level language APIs to \
                    Redland for multiple popular scripting languages.
maintainers         nomaintainer
categories          www
platforms           darwin
license             Apache-2
homepage            http://librdf.org/bindings/
master_sites        http://download.librdf.org/source/

checksums           sha256  ff72b587ab55f09daf81799cb3f9d263708fad5df7a5458f0c28566a2563b7f5 \
                    rmd160  e2604f0c10ab6922b06e26fa1f1d62a8e53f4b6b \
                    size    933290

depends_lib         port:redland

pre-configure {
    foreach {badport badfile} "raptor ${prefix}/include/raptor.h" {
        if {[file exists ${badfile}]} {
            ui_error "${name} cannot be built while ${badport} is active."
            ui_error "Please deactivate ${badport} and try again."
            ui_error "You can reactivate ${badport} again later."
            return -code error "${badport} is installed"
        }
    }
}

if {![variant_isset perl5] && ![variant_isset php5] && ![variant_isset python27] && ![variant_isset python36] &&
    ![variant_isset ruby] && ![variant_isset tcl] && ![variant_isset lua]} {
        default_variants +python37
}

variant perl5 description {Include Perl 5 binding} {
    depends_lib-append path:bin/perl:perl5
    configure.args-append --with-perl
    configure.perl ${prefix}/bin/perl
}

variant php5 description {Include PHP 5 binding} {
    configure.args-append --with-php
    depends_lib-append path:bin/php:php5
}

variant python27 conflicts python36 python37 description {Include Python 2.7 binding} {
    configure.args-append --with-python=${prefix}/bin/python2.7 --with-python-ldflags="-Wl,-F. -Wl,-F. -bundle ${frameworks_dir}/Python.framework/Versions/2.7/Python"
    depends_lib-append port:python27
}

variant python36 conflicts python27 python37 description {Include Python 3.6 binding} {
    configure.args-append --with-python=${prefix}/bin/python3.6 --with-python-ldflags="-Wl,-F. -Wl,-F. -bundle ${frameworks_dir}/Python.framework/Versions/3.6/Python"
    depends_lib-append port:python36
}

variant python37 conflicts python27 python36 description {Include Python 3.7 binding} {
    configure.args-append --with-python=${prefix}/bin/python3.7 --with-python-ldflags="-Wl,-F. -Wl,-F. -bundle ${frameworks_dir}/Python.framework/Versions/3.7/Python"
    depends_lib-append port:python37
}

variant ruby description {Include Ruby binding} {
    configure.args-append --with-ruby
    depends_lib-append port:ruby
}

variant tcl description {Include Tcl binding} {
    configure.args-append --with-tcl
    depends_lib-append port:tcl
}

variant lua description {Include Lua binding} {
    configure.args-append --with-lua
    depends_lib-append port:lua
}

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