# -*- 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           app 1.0
PortGroup           cmake 1.1
PortGroup           github 1.0

github.setup        Faster3ck converseen 0.15.2.7 v
revision            0
categories          graphics
license             GPL-3
maintainers         {mps @Schamschula} openmaintainer
description         Converseen is an open source batch image converter and resizer.
long_description    {*}${description} Thanks to the Magick++ image libraries it supports \
                    more than 100 image formats.
checksums           rmd160  a722b60e276957fd912c16f1f83dba66d9bd9275 \
                    sha256  1e2be90695f802e038c385346c19fd438185aac4eda83124af71fbc2854871f2 \
                    size    993583
github.tarball_from archive

# Prefer Qt4 on macOS, aside of arm64:
if {${os.platform} ne "darwin" || ${os.arch} eq "arm"} {
    PortGroup       qt6 1.0

    depends_lib-append \
                    port:qt6-qttools

    compiler.cxx_standard   2017

    configure.args-append \
                    -DUSE_QT6=YES
} else {
    PortGroup       qt4 1.0

    patch.pre_args-replace  -p0 -p1
    patchfiles-append \
                    0001-Add-Qt4-build-support-behind-QT_VERSION-guards.patch \
                    0002-Run-the-Qt4-directory-scan-on-a-worker-thread.patch \
                    0003-Drop-sizeAdjustPolicy-from-the-.ui-files-for-Qt4-s-u.patch \
                    0004-Guard-two-more-Qt5-only-APIs-found-by-an-exhaustive-.patch \
                    0005-Include-QDebug-where-the-streaming-qWarning-is-used.patch

    compiler.cxx_standard   2011

    configure.args-append \
                    -DUSE_QT4=YES
}

depends_lib-append  port:ImageMagick7

configure.args-append \
                    -DCMAKE_BUILD_TYPE=Release \
                    -DCMAKE_PREFIX_PATH=${prefix}/lib/ImageMagick7 \
                    -DCMAKE_INSTALL_PREFIX=${prefix}

app.icon            ${filespath}/Converseen.icns
