PortSystem              1.0

name                    mysql-connector-odbc
version                 5.1.8
revision                1
set branch              [join [lrange [split ${version} .] 0 1] .]
homepage                https://www.mysql.com/products/connector/
categories              databases
platforms               darwin
maintainers             nomaintainer
license                 GPL-2

description \
    The MySQL Connector/ODBC

long_description \
    The MySQL Connector/ODBC is the name for the family of MySQL ODBC drivers \
    (previously called MyODBC drivers) that provide access to a MySQL database \
    using the industry standard Open Database Connectivity (ODBC) API.

master_sites            mysql:Connector-ODBC/${branch}/

checksums               sha1    2272075c66712cf7a05e50eeb4520f7c504c3ae8 \
                        rmd160  0db5c4d42c7377f7fc1fa2ad569f50f9a497511e

depends_lib \
    port:unixODBC \
    port:mysql5

configure.args \
          --with-unixODBC=${prefix} \
          --with-mysql-path=${prefix} \
          --enable-shared \
          --enable-static \
          --enable-gui=no

pre-configure {
    reinplace "s;bin/mysql_config;bin/mysql_config5;" ${worksrcpath}/configure
}

livecheck.type          regex
livecheck.url           https://dev.mysql.com/downloads/connector/odbc/${branch}.html
livecheck.regex         ${name}-(${branch}.\[0-9\.\]+)

notes "To test ${name}
  ${prefix}/etc/odbcinst.ini 
  \[MySQL\] 
  Description     = ODBC for MySQL 
  Driver          = ${prefix}/lib/libmyodbc5.so 
  FileUsage       = 1
  
  ${prefix}/etc/odbc.ini 
  \[MySQL-test\] 
  Description     = MySQL database test 
  Driver          = MySQL 
  Server          = localhost 
  Database        = test 
  Port            = 3306
  
  \$ isql MySQL-test test"