# -*- 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
# $Id: Portfile 92751 2012-05-05 20:55:37Z ryandesign@macports.org $

PortSystem          1.0

name                phpmyadmin
set my_name         phpMyAdmin
version             3.5.1
categories          www php databases
maintainers         ryandesign openmaintainer
supported_archs     noarch

description         A tool written in PHP intended to handle the \
                    administration of MySQL 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            http://www.phpmyadmin.net/
master_sites        sourceforge:project/phpmyadmin/phpMyAdmin/${version}
distname            ${my_name}-${version}-all-languages
use_bzip2           yes

checksums           rmd160  4f61be7fe60368efde7b48ff07e0267d48c00737 \
                    sha256  c4938855ad43c41a2c94b2f74c75a24819e01f55d800a347c8373557988b2da3

platforms           darwin freebsd

depends_run         port:php5-gd \
                    port:php5-mbstring \
                    port:php5-mcrypt \
                    port:php5-mysql \
                    port:php5-zip

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

use_configure       no
build               {}

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

notes "
phpMyAdmin must be configured before it can be used.\
Consult the documentation at file://${prefix}/www/phpmyadmin/Documentation.html#config

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 644 ${configsample} ${configfile}
    }
}

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