# -*- 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$

PortSystem 1.0

name                wikkawiki
set major_version   1.1.6
version             ${major_version}.5
categories          www php
maintainers         wikkawiki.org:brian
description         WikkaWiki is a flexible, standards-compliant and lightweight wiki engine.
long_description    WikkaWiki is a flexible, standards-compliant and \
                    lightweight wiki engine written in PHP, which uses MySQL \
                    to store pages. Forked from WakkaWiki. Designed for \
                    speed,  extensibility, and security.  For installation \
                    instructions, visit http://docs.wikkawiki.org/MacportInstall
homepage            http://www.wikkawiki.org
distname            Wikka-${version}
master_sites        http://wikkawiki.org/downloads/
checksums           md5     e1f3b98b98ff5fb6b22fa4848b54317b \
                    sha1    2d2e114d69223f759a5e0261887748112eba24b2
platforms           darwin freebsd

depends_lib \
    port:php4 \
    port:mysql4

set wikkapath ${prefix}/www/wikka
set osxdocpath /Library/WebServer/Documents

variant php5 description {Use php5 instead of php4 (not fully tested)} {
    depends_lib-append  path:bin/php:php5
    depends_lib-delete  port:php4
}

variant mysql5 description {Use mysql5 instead of mysql4 (not fully tested)} {
    depends_lib-append  path:bin/mysql_config5:mysql5
    depends_lib-delete  port:mysql4
}

variant nodeps description {Use existing php/mysql libs} {
    depends_lib-delete port:php4
    depends_lib-delete port:mysql4
}

variant use_osx_docroot conflicts php5 mysql5 requires nodeps description {Create link to /Library/WebServer/Documents} {
    post-destroot {
        xinstall -d ${destroot}${osxdocpath}
        ln -s ${wikkapath} ${destroot}${osxdocpath}/wikka
    }

    post-activate {
    }
}

use_configure   no
build           {}

destroot {
    xinstall -d -m 0755 ${destroot}${wikkapath}
    eval file copy [glob ${worksrcpath}/*] ${destroot}${wikkapath}
    xinstall -m 0666 ${worksrcpath}/.htaccess ${destroot}${wikkapath}
    touch ${destroot}${wikkapath}/wikka.config.php
    file attributes ${destroot}${wikkapath}/wikka.config.php -permissions 0666
}

post-activate {
    if {[variant_isset use_osx_docroot]} {
        ui_msg "**********************************************************"
        ui_msg "* Point your browser to http://localhost/wikka to continue"
        ui_msg "* installation. Be sure to lock down permissions on"
        ui_msg "* ${osxdocpath}/wikka/wikka.config.php and"
        ui_msg "* ${osxdocpath}/wikka/.htaccess for public sites!"
        ui_msg "* Visit http://docs.wikkawiki.org/MacportInstall for help."
        ui_msg "**********************************************************"
    } else {
        ui_msg "**********************************************************"
        ui_msg "* Point your browser to http://localhost/wikka to continue"
        ui_msg "* installation. Be sure to lock down permissions on"
        ui_msg "* ${prefix}/www/wikka/wikka.config.php and"
        ui_msg "* ${prefix}/www/wikka/.htaccess for public sites!"
        ui_msg "* Visit http://docs.wikkawiki.org/MacportInstall for help."
        ui_msg "**********************************************************"
    }
}