# -*- 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
PortGroup           openssl 1.0

name                quickfix
version             1.15.1
license             Permissive
# http://www.quickfixengine.org/quickfix/doc/html/license.html
categories          devel finance
platforms           darwin
maintainers         gmail.com:rstachowiak openmaintainer

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.

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

checksums           rmd160  63b491915df6e9b1809a97a4ba252bfc29219e26 \
                    sha256  9842e71b5abc71f744aeacf65d8264cad2f360e32fa70d0c34f8b239384eb49c \
                    size    46100428

compiler.cxx_standard 2011
supported_archs     x86_64

depends_lib         port:libxml2 \
                    port:openssl3

patchfiles          patch-UnitTest++-Makefile.diff

post-patch {
    reinplace "s|@CXX@|${configure.cxx}|g" ${worksrcpath}/UnitTest++/Makefile
    reinplace "s|@ARCHFLAGS@|[get_canonical_archflags cxx]|g" ${worksrcpath}/UnitTest++/Makefile
    reinplace "s|`python3|`${prefix}/bin/python3.12|g" ${worksrcpath}/configure
}

configure.args      --without-java \
                    --with-openssl \
                    --with-mysql-config=false \
                    --without-postgresql \
                    --without-python \
                    --without-ruby

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

variant postgresql16 description {Include PostgreSQL 16 support} {
    depends_lib-append      port:postgresql16
    configure.args-replace  --without-postgresql --with-postgresql=${prefix}/lib/postgresql16/bin/pg_config
}

variant python312 description {Include Python 3.12 support} {
    depends_lib-append      port:python312
    configure.python        ${prefix}/bin/python3.12
    configure.args-replace  --without-python --with-python3
    configure.env-append \
        "LDFLAGS=-L${prefix}/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin -lpython3.12" \
        PYTHON3_PREFIX=${prefix}
}
