# $Id: Portfile 87583 2011-11-26 22:50:44Z blb@macports.org $

PortSystem          1.0
name                mediawiki
version             1.17.0
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           sha1    1d08e1832264311c94e027f31aa997ef84944b6d \
                    rmd160  c98bacd34e8abe3e66804a2fde40db2d88b36c0d

depends_run         port:libiconv port:jpeg port:jasper port:tiff port:lcms \
                    port:libpng port:freetype port:libxml2 port:jbigkit \
                    port:expat port:fontconfig port:ghostscript \
                    port:ImageMagick port:aspell port:php5-web

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

