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

PortGroup           perl5 1.0

name                littleutils
version             1.2.8
revision            0
categories          sysutils
maintainers         {mps @Schamschula} openmaintainer
license             GPL-3+ ijg permissive

description         littleutils includes various small and useful command-line utilities

long_description    The littleutils include a duplicate file finder (repeats), \
                    image optimizers (opt-jpg, opt-png, opt-gif, recomp-jpg), \
                    file rename tools (lowercase, uppercase, pren), archive \
                    recompressors (to-gzip, to-bzip, to-7zip, to-lzma, \
                    to-lzip, to-xz), a tempfile utility (tempname), file \
                    property tools (filedate, filemode, filenode, fileown, \
                    filesize, and lrealpath), and others.

homepage            https://sourceforge.net/projects/littleutils/
master_sites        sourceforge:project/littleutils/littleutils-source/${version}/
use_xz              yes

platforms           {darwin >= 11}

checksums           rmd160  15d587dcbe67da07abfb040151dd082234b83fd5 \
                    sha256  9f198b2aa20890a491f89c5aa204f3c2ce8b5165d267b459481cab4331c6ec5d \
                    size    229616

perl5.major         5.34

depends_build       port:gettext

depends_lib         port:bash \
                    port:bzip2 \
                    port:dash \
                    port:file \
                    port:gettext-runtime \
                    port:ghostscript \
                    port:gifsicle \
                    port:gzip \
                    port:img2pdf \
                    port:imlib2 \
                    port:lzip \
                    port:lzma \
                    port:lzop \
                    port:p${perl5.major}-cryptx \
                    port:p7zip \
                    port:perl${perl5.major} \
                    port:pngcrush \
                    port:pngquant \
                    path:lib/pkgconfig/poppler.pc:poppler \
                    port:xz \
                    port:zstd

configure.args      PROGPERL=${perl5.bin}

destroot.target     "install install-extra"

variant python310 conflicts python311 python312 python313 python314 description {Use Python 3.10} {}
variant python311 conflicts python310 python312 python313 python314 description {Use Python 3.11} {}
variant python312 conflicts python310 python311 python313 python314 description {Use Python 3.12} {}
variant python313 conflicts python310 python311 python312 python314 description {Use Python 3.13} {}
variant python314 conflicts python310 python311 python312 python313 description {Use Python 3.14} {}

if {![variant_isset python310] && ![variant_isset python311] && ![variant_isset python312] && ![variant_isset python314]} {
    default_variants +python313
}

foreach pv {314 313 312 311 310} {
    if {[variant_isset python${pv}]} {
        depends_lib-append \
                    port:python${pv}

        set python.branch \
                    [string index ${pv} 0].[string range ${pv} 1 end]

        configure.env \
                    PROGPYTHON=${prefix}/bin/python${python.branch}
        break
    }
}

livecheck.regex     /${name}-(\[0-9a.\]+)${extract.suffix}
