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

checksums           rmd160  073e7f8c6e216f371d3063f4c4d4533895ffe624 \
                    sha256  6d1112ef658034b5341598c28d8acc6553658996718f620aa2a0bd86e5df7475 \
                    size    203368

platforms           {darwin >= 11}

perl5.major         5.34

depends_build       port:gettext

depends_lib         port:bash \
                    port:bzip2 \
                    port:bzip3 \
                    port:dash \
                    port:file \
                    port:gettext-runtime \
                    port:ghostscript \
                    port:gifsicle \
                    port:gzip \
                    port:img2pdf \
                    port:imlib2 \
                    port:libjpeg-turbo \
                    port:libpng \
                    port:lzip \
                    port:lzma \
                    port:lzop \
                    port:optipng \
                    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 +python314
}

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}
