# -*- 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                libxmlxx2
set gname           libxml++
version             2.42.3
revision            0

categories          textproc
license             LGPL
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            http://libxmlplusplus.sourceforge.net

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

checksums           rmd160  5d3241035da255a01e3cfd04e4cd15bdb97016e2 \
                    sha256  74b95302e24dbebc56e97048e86ad0a4121fc82a43e58d381fbe1d380e8eba04 \
                    size    922400

# 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
}

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