# -*- 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           ocaml 1.0

name                ocaml-mysql
version             1.2.4
revision            0
categories          databases devel ocaml
maintainers         nomaintainer
license             LGPL-2.1+
description         OCaml bindings to the MySQL/MariaDB C client library
long_description    {*}${description}
homepage            https://github.com/ygrek/ocaml-mysql
master_sites        https://ygrek.org/p/release/ocaml-mysql/

checksums           rmd160  c7131d78ed418317d591eaf9eac865dab4484e68 \
                    sha256  8535a88f74a34dfdb51c4539e4a965b84204273bd04e539a5d729f2536da6c9f \
                    size    99473

set mariadb_port    mariadb-10.11

depends_build-append \
                    port:ocaml-findlib
depends_lib-append  port:${mariadb_port}

# configure locates the client library by running mysql_config or
# mariadb_config; point it at the mariadb port's script, which is not on PATH
post-patch {
    reinplace "s|mysql_config --|${prefix}/lib/${mariadb_port}/bin/mariadb_config --|g" \
        ${worksrcpath}/configure
}

configure.ld_archflags
configure.cc_archflags

use_parallel_build  no

build.target        reallyall

# OCamlMakefile only sets OCAMLFIND when unset, so the destroot-aware
# wrapper from the ocaml portgroup can be injected via the environment
destroot.env-append OCAMLFIND=${ocamlfind_wrapper}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     {ocaml-mysql-(\d+(?:\.\d+)+)\.tar\.gz}
