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

name                libxmlxx3
set gname           libxml++
version             3.2.5
revision            0

categories          textproc
license             LGPL-2.1+
maintainers         {devans @dbevans} {mascguy @mascguy} openmaintainer

description         libxml++ is a C++ interface for working with XML files
long_description    libxml++ is a C++ interface for working with XML files, using \
                    libxml (gnome-xml) to parse and write the actual XML files. It \
                    has a simple but complete API.
homepage            https://libxmlplusplus.github.io/libxmlplusplus/

set branch          [join [lrange [split ${version} .] 0 1] .]
master_sites        gnome:sources/${gname}/${branch}/
distname            ${gname}-${version}
use_xz              yes

checksums           rmd160  6ca5b2aa6a786105935bf4fe1de39b9e19d9dc58 \
                    sha256  0c9b381b5a83d6b3ab4b0b865d7256dab27d575981b63be2f859edcb94da59c7 \
                    size    903840

# Disable unexpected download of subprojects
meson.wrap_mode     nodownload

set py_ver          3.12
set py_ver_nodot    [string map {. {}} ${py_ver}]
set port_ver_major  [lindex [split ${version} .] 0]

patchfiles-append   patch-meson-python3.diff

post-patch {
    reinplace "s|@@PYTHON3@@|python${py_ver}|g" \
                    meson.build
}

depends_build-append  \
                    port:mm-common \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_ver_nodot} \
                    port:py${py_ver_nodot}-setuptools

depends_lib-append \
                    path:lib/pkgconfig/glibmm-2.68.pc:glibmm \
                    port:libxml2

# requires C++11 as of version 2.39.1
compiler.cxx_standard 2011

if { [string match *clang* ${configure.compiler}] } {
    # Quiet deprecation warnings
    configure.cxxflags-append \
                    -Wno-deprecated-declarations \
                    -Wno-error=unknown-warning-option \
                    -Wno-unknown-warning-option
}

test.run            yes

livecheck.type      gnome
livecheck.name      ${gname}
livecheck.regex     "LATEST-IS-(${port_ver_major}\\.\\d*\[02468\](?:\\.\\d+)*)"
