# -*- 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           github 1.0
github.setup        qorelanguage module-mysql 2.1 v
github.tarball_from releases

name                qore-mysql-module
revision            2
categories          lang
license             LGPL-2.1
maintainers         {davidnichols @davidnich} openmaintainer
description         MySQL module for Qore
long_description    Module allowing communication with MySQL and MySQL-compatible DBs from the Qore Programming Language
use_bzip2           yes
homepage            http://qore.org
platforms           darwin
distname            qore-mysql-module-${github.version}

checksums           rmd160 2f1dc9fc048fdc7ab6b0b4ee86753ecba1cf4a1c \
                    sha256 15c5cdbd431eeebfe0d352941c558eb03a7d5690fea2d8375672aa92d038e234 \
                    size 457496

variant mariadb conflicts mariadb105 mariadb106 mariadb107 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb} {}
variant mariadb105 conflicts mariadb mariadb106 mariadb107 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb-10.5} {}
variant mariadb106 conflicts mariadb mariadb105 mariadb107 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb-10.6} {}
variant mariadb107 conflicts mariadb mariadb105 mariadb106 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb-10.7} {}
variant mariadb108 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb109 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb-10.8} {}
variant mariadb109 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb108 mariadb1010 mariadb1011 mysql57 mysql80 description {use mariadb-10.9} {}
variant mariadb1010 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb108 mariadb109 mariadb1011 mysql57 mysql80 description {use mariadb-10.10} {}
variant mariadb1011 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb108 mariadb109 mariadb1010 mysql57 mysql80 description {use mariadb-10.11} {}
variant mysql57 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql80 description {use mysql 5.7} {}
variant mysql80 conflicts mariadb mariadb105 mariadb106 mariadb107 mariadb108 mariadb109 mariadb1010 mariadb1011 mysql57 description {use mysql 8.0} {}

if {![variant_isset mariadb] && ![variant_isset mariadb105] && ![variant_isset mariadb106] && ![variant_isset mariadb107] && ![variant_isset mariadb108] && ![variant_isset mariadb109] && ![variant_isset mariadb1010] && ![variant_isset mariadb1011] && ![variant_isset mysql80] && ![variant_isset mysql57]} {
    default_variants +mariadb1011
}

if {[variant_isset mariadb]} {
    set mysql_port "mariadb"
} elseif {[variant_isset mariadb105]} {
    set mysql_port "mariadb-10.5"
} elseif {[variant_isset mariadb106]} {
    set mysql_port "mariadb-10.6"
} elseif {[variant_isset mariadb107]} {
    set mysql_port "mariadb-10.7"
} elseif {[variant_isset mariadb108]} {
    set mysql_port "mariadb-10.8"
} elseif {[variant_isset mariadb109]} {
    set mysql_port "mariadb-10.9"
} elseif {[variant_isset mariadb1010]} {
    set mysql_port "mariadb-10.10"
} elseif {[variant_isset mariadb1011]} {
    set mysql_port "mariadb-10.11"
} elseif {[variant_isset mysql80]} {
    set mysql_port "mysql8"
} elseif {[variant_isset mysql57]} {
    set mysql_port "mysql57"
}

depends_lib         port:qore \
                    port:${mysql_port}

configure.args      --disable-debug \
                    --with-mysql-libs=${prefix}/lib/${mysql_port} --with-mysql-includes=${prefix}/include/${mysql_port}
configure.ldflags-append -Wl,-undefined -Wl,dynamic_lookup
