# -*- 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                phpmyadmin
set my_name         phpMyAdmin
version             5.2.3
revision            0
checksums           rmd160  cd0ef1cb88b5aa4f5de86ef188e801607025b94d \
                    sha256  57881348297c4412f86c410547cf76b4d8a236574dd2c6b7d6a2beebe7fc44e3 \
                    size    7748924

categories          www php databases
platforms           any
maintainers         {ryandesign @ryandesign} openmaintainer
license             GPL-2
supported_archs     noarch

description         A tool written in PHP intended to handle the \
                    administration of MySQL and MariaDB over the Web.
long_description    phpMyAdmin is a tool written in PHP intended to handle \
                    the administration of MySQL over the Web. phpMyAdmin \
                    supports a wide range of operations with MySQL. The most \
                    frequently used operations are supported by the user \
                    interface (managing databases, tables, fields, relations, \
                    indexes, users, permissions, etc), while you still have \
                    the ability to directly execute any SQL statement.
homepage            https://www.phpmyadmin.net/
master_sites        https://files.phpmyadmin.net/phpMyAdmin/${version}/
distname            ${my_name}-${version}-all-languages
use_xz              yes

# The php variants deliberately do not conflict

foreach php {php72 php73 php74 php80 php81 php82 php83 php84} {
    variant ${php} description "Use ${php}" "
        depends_run-append  port:${php}-gd \
                            port:${php}-mbstring \
                            port:${php}-mcrypt \
                            port:${php}-mysql \
                            port:${php}-openssl \
                            port:${php}-zip
    "
}

if {![variant_isset php72] && ![variant_isset php73] && ![variant_isset php74] \
&& ![variant_isset php80] && ![variant_isset php81] && ![variant_isset php82] && ![variant_isset php83]} {
    default_variants +php83
}

set docroot         ${prefix}/www/${name}
set configfile      ${docroot}/config.inc.php
set configsample    ${docroot}/config.sample.inc.php

use_configure       no
build               {}

destroot {
    xinstall -d -m 0755 ${destroot}${docroot}
    copy {*}[glob ${worksrcpath}/*] ${destroot}${docroot}
}

notes "
phpMyAdmin must be configured before it can be used.\
Consult the documentation at file://${docroot}/doc/html/config.html

A sample configuration file is installed at ${configsample}, but you mustn’t edit this file.\
The file to edit is the real configuration file at ${configfile}.
"

pre-activate {
    if {[file exists ${configfile}]} {
        notes-append "\n\nYour existing config file has not been modified. You should manually compare the new sample config file with your existing config file."
    }
}

post-activate {
    if {![file exists ${configfile}]} {
        xinstall -m 0644 ${configsample} ${configfile}
    }
}

livecheck.type      regex
livecheck.url       ${homepage}home_page/version.php
livecheck.regex     {^([0-9.]+)$}
