# $Id: Portfile 110599 2013-09-02 22:32:09Z jeremyhu@macports.org $

PortSystem          1.0
name                quickfix
version             1.13.3
revision            1
license             Permissive
# http://www.quickfixengine.org/quickfix/doc/html/license.html
categories          devel finance
maintainers         nomaintainer
description         FIX engine implementation
long_description \
   QuickFIX is a full-featured open source FIX engine, currently compatible \
   with the FIX 4.0-4.4 spec.

platforms           darwin

homepage            http://www.quickfixengine.org/
master_sites        sourceforge:project/quickfix/quickfix/${version}
worksrcdir          ${name}

checksums           md5     1e569a32107ecfc1de9c15bdcb5dc360 \
                    sha1    8a20894a9320206beaeee11c3967dced8b8d2fc0 \
                    rmd160  13d72e1c16a124e444f4ae520654015e06974356

depends_lib         port:libxml2

# error: Failure in test: Expected 2 but was 0
# https://sourceforge.net/tracker/?func=detail&aid=3556800&group_id=37535&atid=1126912
compiler.blacklist  *clang*

patchfiles          patch-UnitTest++-Makefile.diff

post-patch {
   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
   reinplace "s|@CXX@|${configure.cxx}|g" ${worksrcpath}/UnitTest++/Makefile
   reinplace "s|@ARCHFLAGS@|${configure.cxx_archflags}|g" ${worksrcpath}/UnitTest++/Makefile
}

platform darwin {
    if {${os.major} >= 13} {
        # TODO: Test Mavericks once the clang build failures are addressed

        depends_lib
        depends_run
        pre-fetch {
            ui_error "$name does not build on Mavericks or later."
            error "unsupported platform"
        }
    }
}

configure.args      --with-java
configure.env       "JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home"

post-destroot {
   xinstall -m 755 -d ${destroot}${prefix}/share/${name}/sql
   copy ${worksrcpath}/src/sql/postgresql ${destroot}${prefix}/share/${name}/sql
}

variant python description {Include python support} {
   depends_lib-append      port:python26
   configure.args-append   --with-python=${prefix}
   patchfiles-append       patch-python.diff
}

variant postgresql84 conflicts postgresql90 description {Include PostGreSQL 8.4 support} {
   depends_lib-append      port:postgresql84
   configure.args-append   --with-postgresql=${prefix}
   patchfiles-append       patch-postgresql84.diff
}

variant postgresql90 conflicts postgresql84 description {Include PostGreSQL 9.0 support} {
   depends_lib-append      port:postgresql90
   configure.args-append   --with-postgresql=${prefix}
   patchfiles-append       patch-postgresql90.diff
}

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     ${name}-(\[.\\d\]+)${extract.suffix}

