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

name                itstool
epoch               1
version             2.0.7
revision            3
license             GPL-3+
set branch          [join [lrange [split ${version} .] 0 1] .]

description         ITS Tool allows you to translate your XML documents with PO files, \
                    using rules from the W3C Internationalization Tag Set.

long_description    {*}${description}

maintainers         nomaintainer
categories          textproc
platforms           any
homepage            https://itstool.org/
master_sites        https://files.itstool.org/${name}

use_bzip2           yes

checksums           rmd160  a19767226488d512d63c0a240f01fba57d73ca30 \
                    sha256  6b9a7cd29a12bb95598f5750e8763cee78836a1a207f85b74d8b3275b27e87ca \
                    size    104648

supported_archs     noarch
installs_libs       no

depends_build       port:gawk

# per its manpage, itstool uses msgfmt provided by gettext to create MO files
depends_lib         port:gettext

patchfiles          patch-configure.diff

variant python27 conflicts python38 python39 python310 python311 python312 description {Use Python 2.7} {
    configure.python \
                    ${prefix}/bin/python2.7
    depends_lib-append \
                    port:py27-libxml2
}

variant python38 conflicts python27 python39 python310 python311 python312 description {Use Python 3.8} {
    configure.python \
                    ${prefix}/bin/python3.8
    depends_lib-append \
                    port:py38-libxml2
}

variant python39 conflicts python27 python38 python310 python311 python312 description {Use Python 3.9} {
    configure.python \
                    ${prefix}/bin/python3.9
    depends_lib-append \
                    port:py39-libxml2
}

variant python310 conflicts python27 python38 python39 python311 python312 description {Use Python 3.10} {
    configure.python \
                    ${prefix}/bin/python3.10
    depends_lib-append \
                    port:py310-libxml2
}

variant python311 conflicts python27 python38 python39 python310 python312 description {Use Python 3.11} {
    configure.python \
                    ${prefix}/bin/python3.11
    depends_lib-append \
                    port:py311-libxml2
}

variant python312 conflicts python27 python38 python39 python310 python311 description {Use Python 3.12} {
    configure.python \
                    ${prefix}/bin/python3.12
    depends_lib-append \
                    port:py312-libxml2
    patchfiles-append \
                    invalid-sequence-pygte-312.patch
}

if {![variant_isset python27] && \
    ![variant_isset python38] && \
    ![variant_isset python39] && \
    ![variant_isset python310] && \
    ![variant_isset python311] && \
    ![variant_isset python312]} {
    default_variants +python312
}

livecheck.type      regex
livecheck.url       http://itstool.org/download/
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
