# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0
PortGroup               github 1.0
PortGroup               java 1.0

github.setup            swaldman c3p0 0.14.2 v
github.tarball_from     archive
github.livecheck.regex  {([0-9.]+)}

categories              java devel
license                 {EPL-1 LGPL-2.1+}
platforms               any
supported_archs         noarch
homepage                https://www.mchange.com/projects/c3p0
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             JDBC Connection and Statement pooling
long_description        c3p0 is an easy-to-use library for making traditional \
                        JDBC drivers \"enterprise-ready\" by augmenting them \
                        with functionality defined by the jdbc3 spec and the \
                        optional extensions to jdbc2.  c3p0 now also fully \
                        supports the jdbc4.

depends_build-append    bin:curl:curl

# Mill requires Java >= 17
# Building requres Java == 11 (downloaded by Mill)
# Running requires Java >= 7
java.version            17+

checksums               rmd160  9b38c085e9676abb637034969a1d4b1244d79d9d \
                        sha256  88efde88c48e71d14dce3128ed7c3bdc8ebc6e78d5cacd637d682f52c626a710 \
                        size    430846

patchfiles              use-installed-jdk.diff

use_configure           no

build.cmd               ./mill
build.target            jar
build.args              --no-daemon \
                        --jobs=${build.jobs}
build.env-append        COURSIER_ARCHIVE_CACHE=${workpath}/.coursier/arc \
                        COURSIER_CACHE=${workpath}/.coursier/v1

destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}
    set destjavadir ${destroot}${prefix}/share/java

    xinstall -d ${destjavadir}
    xinstall -W ${worksrcpath} -m 644 \
        out/jar.dest/out.jar \
        ${destjavadir}/${name}.jar

    xinstall -d ${destdocdir}
    xinstall -W ${worksrcpath} -m 644 \
        CHANGELOG \
        README.md \
        adding-properties.md \
        dev-notes.md \
        {*}[glob -directory ${worksrcpath} LICENSE*] \
        {*}[glob -directory ${worksrcpath} RELEASE_NOTES-c3p0-*] \
        ${destdocdir}
}
