# -*- 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 85498 2011-10-14 02:38:32Z dports@macports.org $

PortSystem 1.0
PortGroup perl5 1.0

name                    ikiwiki
perl5.major             5.12
perl5.setup             ikiwiki 3.20110608
# reset version because perl5 portgroup incorrectly converts it
version                 3.20110608
revision                1
categories              www perl
license                 GPL-2+
description             A wiki compiler.
long_description        Ikiwiki is a wiki compiler. It converts wiki pages \
                        into HTML pages suitable for publishing on a website. \
                        Ikiwiki stores pages and history in a revision control \
                        system such as Subversion or Git. There are many other \
                        features, including support for blogging, as well as a \
                        large array of plugins.
homepage                http://ikiwiki.info/
maintainers             tommyd openmaintainer
platforms               darwin
master_sites            http://ftp.debian.org/debian/pool/main/i/ikiwiki/
distname                ${name}_${version}
worksrcdir              ${name}

# Livecheck URL is for a file listing in reverse filename order. Using reverse
# chronological order is impractical because older versions are sometimes
# patched, giving them a newer timestamp than the latest release.

livecheck.url           http://ftp.debian.org/debian/pool/main/i/ikiwiki/?C=N\;O=D
livecheck.regex         ">ikiwiki_(\[^<\]+)\\.tar\\.gz<"

patchfiles              patch-Makefile.PL.diff

checksums               md5     c5cce6866137f77b0c5a8eb8d6395391 \
                        sha1    0808e5f2f03bb5d604b903b96a6a897aeeb24a9e \
                        rmd160  fa3c774c148c7ef8001579a49c97c92320d18ac6

depends_build           port:coreutils

# needed modules (see Bundle/IkiWiki.pm)
depends_lib-append      port:p${perl5.major}-cgi-formbuilder \
                        port:p${perl5.major}-cgi-session \
                        port:p${perl5.major}-data-dumper \
                        port:p${perl5.major}-html-parser \
                        port:p${perl5.major}-html-scrubber \
                        port:p${perl5.major}-html-template \
                        port:p${perl5.major}-html-tree \
                        port:p${perl5.major}-mail-sendmail \
                        port:p${perl5.major}-text-markdown \
                        port:p${perl5.major}-uri \
                        port:p${perl5.major}-timedate \
                        port:p${perl5.major}-xml-simple

# a couple of optional extra modules bundled from MacPorts used by plugins
# (for a complete list see Bundle/IkiWiki/Extras.pm)
depends_lib-append      port:p${perl5.major}-crypt-ssleay \
                        port:p${perl5.major}-digest-sha1 \
                        port:p${perl5.major}-file-mimeinfo \
                        port:p${perl5.major}-locale-gettext \
                        port:p${perl5.major}-rpc-xml \
                        port:p${perl5.major}-term-readline-gnu \
                        port:p${perl5.major}-text-csv \
                        port:p${perl5.major}-text-wikiformat \
                        port:p${perl5.major}-xml-feed \
                        port:p${perl5.major}-yaml

destroot.target         CP=gcp install
configure.args          INSTALLDIRS=vendor PREFIX=${prefix}

post-patch {
    reinplace "s|/usr/bin/perl|${prefix}/bin/perl${perl5.major}|g" \
        ${worksrcpath}/ikiwiki.in \
        ${worksrcpath}/IkiWiki.pm \
        ${worksrcpath}/Makefile.PL \
        ${worksrcpath}/ikiwiki-calendar.in \
        ${worksrcpath}/ikiwiki-makerepo \
        ${worksrcpath}/ikiwiki-mass-rebuild \
        ${worksrcpath}/ikiwiki-transition.in \
        ${worksrcpath}/ikiwiki-update-wikilist \
        ${worksrcpath}/ikiwiki-w3m.cgi \
        ${worksrcpath}/ikiwiki.in \
        ${worksrcpath}/gitremotes \
        ${worksrcpath}/mdwn2man \
        ${worksrcpath}/pm_filter \
        ${worksrcpath}/docwiki.setup \
        ${worksrcpath}/auto.setup \
        ${worksrcpath}/auto-blog.setup
    reinplace "s|/etc/ikiwiki/wikilist|${prefix}/etc/ikiwiki/wikilist|g" \
    ${worksrcpath}/ikiwiki-update-wikilist \
    ${worksrcpath}/ikiwiki-mass-rebuild
}
