# -*- 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           boost 1.0
PortGroup           legacysupport 1.1
PortGroup           meson 1.0
PortGroup           openssl 1.0

boost.version       1.81
# clock_gettime
legacysupport.newest_darwin_requires_legacy 15
# TODO: see if this needs redirect_bins; looks like executables work, however they still complain:
# kea-msg-compiler(18708) malloc: *** error for object 0xa04da754: pointer being freed was not allocated

name                kea
set ver_major       3
version             ${ver_major}.0.1
revision            0
categories          net
license             MPL-2
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Alternative DHCP implementation by ISC
long_description    {*}${description}
homepage            https://kea.isc.org
master_sites        https://dl.cloudsmith.io/public/isc/${name}-${ver_major}-0/raw/versions/${version}/
use_xz              yes
checksums           rmd160  735c4c96ca888bd90345fb5a47eb95dd5f8997b6 \
                    sha256  ec84fec4bb7f6b9d15a82e755a571e9348eb4d6fbc62bb3f6f1296cd7a24c566 \
                    size    6632284

patchfiles          patch-meson.build.diff

set py_v            3.13
set py_v_nodot      [string map {. {}} ${py_v}]
configure.python    ${prefix}/bin/python${py_v}

post-patch {
    reinplace "s|@PYTHON@|${configure.python}|" ${worksrcpath}/meson.build
    reinplace "s|/usr/bin/env python3|${configure.python}|" ${worksrcpath}/scripts/grabber.py
}

compiler.cxx_standard   2011

depends_build-append \
                    port:bison \
                    path:bin/cmake:cmake \
                    port:flex \
                    port:gtest \
                    port:libtool \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_v_nodot}

depends_lib-append  port:kerberos5 \
                    port:libiconv \
                    port:log4cplus

configure.args-append \
                    -Dcrypto=openssl \
                    -Dkrb5=enabled \
                    -Dmysql=disabled \
                    -Dnetconf=disabled \
                    -Dpostgresql=disabled \
                    -Dtests=disabled
