# -*- 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                spidereyeballs
version             0.21
revision            8
perl5.branches      5.34
categories          www
supported_archs     noarch
platforms           {darwin any}
maintainers         nomaintainer
license             {Artistic-1 GPL}

description         an image gallery generator
long_description    The spidereyeballs program is a HTML image gallery \
                    generator. It can operate at the command line or \
                    under mod_perl

homepage            https://sourceforge.net/projects/${name}/
master_sites        sourceforge:projects/${name}/files/${name}/${version}
distname            Spidy-${version}

checksums           rmd160  70a083c68b9e42c1b295ed6153935f30e3796088 \
                    sha256  b7d9a4e7451a6c0d29ea21d5afea466a183bff85d22011cb1545e6e33eddc62c \
                    size    120045

depends_lib         port:perl${perl5.major} \
                    port:p${perl5.major}-html-template \
                    port:p${perl5.major}-image-size \
                    port:p${perl5.major}-xml-parser

depends_run         port:ImageMagick

depends_test        port:p${perl5.major}-libwww-perl \
                    port:p${perl5.major}-xml-treebuilder

post-patch {
    # TODO: autogenerate the list of files
    reinplace "s|/usr/bin/perl|${perl5.bin}|g" \
        ${worksrcpath}/spider \
        ${worksrcpath}/spider.cgi \
        ${worksrcpath}/t/000loader.t \
        ${worksrcpath}/t/010sizes.t \
        ${worksrcpath}/t/020pattern.t \
        ${worksrcpath}/t/021templates.t \
        ${worksrcpath}/t/030quick.t \
        ${worksrcpath}/t/040urls.t \
        ${worksrcpath}/t/050fixed.t \
        ${worksrcpath}/t/060relative.t
}

configure.cmd       ${perl5.bin}
configure.pre_args  Makefile.PL
configure.args      --prefix=${prefix}
destroot.target     install

post-destroot {
    delete [glob ${destroot}${prefix}/lib/perl5/*/*/perllocal.pod]
}

# many tests fail
test.run            yes

livecheck.regex     "Spidy-(\\d+(?:\\.\\d+)*)"