# -*- 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                mybb
version             1.8.20
categories          www php
platforms           darwin freebsd
maintainers         nomaintainer
supported_archs     noarch
license             LGPL-3

description         A PHP-based bulletin board / discussion forum system

long_description    MyBB is the free and open source, intuitive, extensible, \
                    and incredibly powerful forum software you've been \
                    looking for.

foreach php {php56 php70 php71 php72 php73} {
    variant ${php} description "Use ${php}" "
        depends_run \
                port:${php} \
                port:${php}-gd \
                port:${php}-imagick \
                port:${php}-mysql \
                port:${php}-xsl

    "
}

if {![variant_isset php56] && ![variant_isset php70] && ![variant_isset php71] && ![variant_isset php72]} {
   default_variants +php73
}

homepage            https://mybb.com/
master_sites        http://resources.mybb.com/downloads
distname            ${name}_[string map {. ""} [subst [regsub {\.(\d+)$} ${version} {[format {%02d} {\1}]}]]]
use_zip             yes

checksums           rmd160  2daaef93bafb9677c908f78edc8409fd7dc6131d \
                    sha256  ee96b3eac55ebbbdf86c2057d513c7b015a6d558c7fdf4f297084c3e2f73b212 \
                    size    2251084

worksrcdir          ${name}-${version}

extract.mkdir       yes

use_configure       no

build               {}

set docpath         ${destroot}${prefix}/www

destroot {
    xinstall -d -m 0755 ${docpath}
    copy ${worksrcpath}/Upload ${docpath}/${name}
}

notes "
A lot of extra work is required to get this software to work.\
Run mybb/install/index.php\
in the local web server to obtain additional compatibility info.  See\
https://docs.mybb.com/1.8/install
"

livecheck.type      regex
livecheck.url       ${homepage}download/
livecheck.regex     {Download MyBB ([0-9.]+)}
