# $Id$

PortSystem          1.0

name                mediawiki
version             1.23.2
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          www php
license             GPL-2+
maintainers         nomaintainer
supported_archs     noarch
description         The wiki engine used by Wikipedia
long_description \
   MediaWiki is the collaborative editing software that runs Wikipedia, the \
   free encyclopedia, and other projects. It's designed to handle a large \
   number of users and pages without imposing too rigid a structure or \
   workflow.

platforms           darwin freebsd

homepage            http://www.mediawiki.org
master_sites        http://download.wikimedia.org/mediawiki/${branch}/

checksums           rmd160  7d3c986c9b0697f6550e461f2e7291b6270fc6e2 \
                    sha256  b99637ec5fdc78307aa745395170e56908a09dd816498736f5007294868344de

depends_run         port:php5-web port:php5-intl port:php5-dba \
                    port:php5-mbstring port:ImageMagick

use_configure       no

build               {}

set docpath ${prefix}/www/data/${name}

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

notes "
MediaWiki has now been installed into ${docpath}. Any further information\
on installation and configuration can be found at:

   http://www.mediawiki.org/wiki/Manual:Installation_guide

If you are upgrading, read:

   http://www.mediawiki.org/wiki/Manual:Upgrading

and

   http://www.mediawiki.org/wiki/Release_notes/1.17

For an upgrade, ${docpath}/AdminSettings.php is no longer needed as of\
1.16.0 so its settings can be migrated into ${docpath}/LocalSettings.php;\
see https://bugzilla.wikimedia.org/show_bug.cgi?id=18768 for details.

Finally, be sure to have a look at ${docpath}/UPGRADE and possibly\
${docpath}/RELEASE-NOTES for all the details of performing an upgrade.

Make sure to use MacPorts' php for running the command line scripts, e.g.

   ${prefix}/bin/php update.php
"

variant mysql4 description "Deprecated variant, use just +mysql" {}
if {[variant_isset mysql4]} {
   variant_set mysql
}

variant postgresql83 description "Deprecated variant, use just +postgresql" {}
variant postgresql84 description "Deprecated variant, use just +postgresql" {}
if {[variant_isset postgresql83] || [variant_isset postgresql84]} {
   variant_set postgresql
}

variant mysql description "Use MySQL as the database backend" {
   depends_run-append   port:php5-mysql
}

variant postgresql description "Use PostGreSQL as the database backend" {
   depends_run-append   port:php5-postgresql
}

# Default to +mysql since that was previously the built-in setting
if {![variant_isset mysql] && ![variant_isset postgresql]} {
   default_variants     +mysql
}

livecheck.type      regex
livecheck.url       http://www.mediawiki.org/wiki/Download
livecheck.regex     ${name}-(\[.\\d]+)\\.tar\\.gz