# -*- 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                mandelbrot-set-viewer
version             5.02
revision            0
checksums           rmd160  eb57a125aea9203ce2b5d35a3d8f2214e7bcc32e \
                    sha256  09660425ca28f93ac989029edb72927965da7df8bbb1e0109dd4e97e4802b9b3 \
                    size    6617

categories          graphics
maintainers         nomaintainer
license             unknown

description         Python Mandelbrot Set Viewer
long_description    {*}${description}

homepage            https://geometrian.com/programming/projects/index.php?project=Mandelbrot%20Set
master_sites        https://geometrian.com/data/programming/projects/Mandelbrot%20Set/Viewer%20${version}/

distname            Mandelbrot Set Viewer ${version}
worksrcdir          ${version}
use_zip             yes
supported_archs     noarch
platforms           any

patchfiles          patch-main.py.diff

set python_version  3.10
set python_ver_no_dot [string map {. {}} ${python_version}]

depends_run         port:py${python_ver_no_dot}-game \
                    port:py${python_ver_no_dot}-opengl \
                    port:python${python_ver_no_dot}

use_configure       no
build               {}

destroot {
    file mkdir ${destroot}${prefix}/share/${name}
    xinstall -m 644 -W ${worksrcpath} README.txt config.py ${destroot}${prefix}/share/${name}
    xinstall -m 755 -W ${worksrcpath} gl_shader.py main.py ${destroot}${prefix}/share/${name}
    file rename ${destroot}${prefix}/share/${name}/config.py ${destroot}${prefix}/share/${name}/config.py.dist
}

post-activate {
    if {![file exists ${prefix}/share/${name}/config.py]} {
        file copy ${prefix}/share/${name}/config.py.dist ${prefix}/share/${name}/config.py
    }
}

notes "To run this program, type 'python${python_version} ${prefix}/share/${name}/main.py'.
You can modify the output by changing ${prefix}/share/${name}/config.py"

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     Mandelbrot Set Viewer (\\d+(\\.\\d+)+)[quotemeta ${extract.suffix}]
