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

name                img2pdf
# keep in sync with python/py-img2pdf
version             0.6.3
revision            0
categories-prepend  graphics
license             LGPL-3
maintainers         {mps @Schamschula} openmaintainer
description         Lossless conversion of raster images to PDF.
long_description    {*}${description}
supported_archs     noarch
platforms           {darwin any}
homepage            https://gitlab.mister-muffin.de/josch/img2pdf

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

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

foreach pv {313 312 311 310} {
    if {[variant_isset python${pv}]} {
        python.default_version ${pv}
        break
    }
}

distfiles
use_configure       no
build               {}

depends_lib-append  port:py${python.version}-img2pdf

destroot {
    # symlink the img2pdf scripts
    ln -s ${prefix}/bin/img2pdf-${python.branch} ${destroot}${prefix}/bin/img2pdf
    ln -s ${prefix}/bin/img2pdf-gui-${python.branch} ${destroot}${prefix}/bin/img2pdf-gui
}
