# -*- 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 90176 2012-02-25 07:28:46Z stromnov@macports.org $

PortSystem          1.0

name                omniORB
version             4.1.6
revision            0
categories          devel
platforms           darwin
license             GPL

maintainers         stromnov openmaintainer

description         high performance CORBA ORB for C++
long_description    omniORB is a robust high performance CORBA ORB for C++ and \
                    Python. omniORB is largely CORBA 2.6 compliant.

homepage            http://omniorb.sourceforge.net/
master_sites        sourceforge:omniorb

checksums           rmd160  a0ba42721a1932d29abeb37dff0dc3ea7a9ddce6 \
                    sha256  749c5e615130c804e40f4028104c1f98469613ff32a7f81562d06e669ba0b2c1

use_bzip2           yes

patchfiles          src_tool_omniidl_cxx_cccp_config-darwin.h.diff \
                    include_omniORB4_CORBA_sysdep.h.diff

# Universal variant broken since 4.1.6
universal_variant   no

configure.args      --with-omniORB-config="${prefix}/etc/omniORB.cfg" \
                    --with-omniNames-logdir="${prefix}/var"

if {$build_arch == "x86_64" && ${os.platform} == "darwin"} {
    configure.args-append --build=${build_arch}-apple-${os.platform}${os.version}
}

post-patch {
    reinplace "s|,prefix=\'\$PYTHON_PREFIX\'||g" ${worksrcpath}/configure
    reinplace "s|,prefix=\'\$PYTHON_EXEC_PREFIX\'||g" ${worksrcpath}/configure
    if {[variant_isset universal]} {
        system "cd ${worksrcpath} && ed - ./include/omniconfig.h.in < ${filespath}/include_omniconfig.h.in.ed"
    }
}

if {[variant_isset universal]} {
    patchfiles-append mk_beforeauto.mk.in.diff
    post-configure {
        system "cd ${worksrcpath} && ed - ./include/omniORB4/acconfig.h < ${filespath}/include_omniORB4_acconfig.h.ed"
    }
}

variant ssl description {Enable SSL support} {
    configure.args-append   --with-openssl
    depends_lib-append      port:openssl
}

if { ![variant_isset python24] && ![variant_isset python25] && ![variant_isset python26] && ![variant_isset python27]} {
    default_variants        +python27
}

variant python24 description {Enable python support with python 2.4} {
    depends_lib-append      port:python24
    configure.python        ${prefix}/bin/python2.4
}

variant python25 description {Enable python support with python 2.5} {
    depends_lib-append      port:python25
    configure.python        ${prefix}/bin/python2.5
}

variant python26 description {Enable python support with python 2.6} {
    depends_lib-append      port:python26
    configure.python        ${prefix}/bin/python2.6
}

variant python27 description {Enable python support with python 2.7} {
    depends_lib-append      port:python27
    configure.python        ${prefix}/bin/python2.7
}

platform darwin 8 {
    # needs -Xarch
    universal_variant no
}

livecheck.type      regex
livecheck.url       http://omniorb.sourceforge.net/
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)"
