# -*- 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 103611 2013-03-03 04:43:04Z larryv@macports.org $

PortSystem          1.0

name                asciidoc
version             8.6.8
revision            1
categories          textproc
license             GPL-2+
maintainers         cal openmaintainer
description         Formatter/translator for text files to numerous formats
long_description \
    AsciiDoc is a text document format for writing short documents, \
    articles, books and UNIX man pages. AsciiDoc files can be translated to \
    HTML (with or without stylesheets), DocBook and LinuxDoc markup using \
    the asciidoc(1) command.  AsciiDoc is highly configurable: both the \
    AsciiDoc source file syntax and the backend output markups (which can be \
    almost any type of SGML/XML markup) can be customized and extended by \
    the user.

platforms           darwin
supported_archs     noarch

homepage            http://www.methods.co.nz/asciidoc/
master_sites        sourceforge

checksums           sha256  ffb67f59dccaf6f15db72fcd04fdf21a2f9b703d31f94fcd0c49a424a9fcfbc4 \
                    rmd160  8312fbd9105c9443d1c5d309c1f5fadc5983d753

patchfiles          patch-vim-ftdetect-asciidoc_filetype.vim.diff

depends_run         port:docbook-xml-4.5 \
                    port:fop

variant python25 conflicts python26 python27 description {Use python 2.5} {
    depends_lib-append        port:python25
    configure.python          ${prefix}/bin/python2.5

    post-destroot {
    reinplace "s:#!/usr/bin/env python:#!${prefix}/bin/python2.5:" \
        ${destroot}${prefix}/bin/asciidoc \
        ${destroot}${prefix}/bin/a2x
    }
}

variant python26 conflicts python25 python27 description {Use python 2.6} {
    depends_lib-append        port:python26
    configure.python          ${prefix}/bin/python2.6

    post-destroot {
    reinplace "s:#!/usr/bin/env python:#!${prefix}/bin/python2.6:" \
        ${destroot}${prefix}/bin/asciidoc \
        ${destroot}${prefix}/bin/a2x
    }
}

variant python27 conflicts python25 python26 description {Use python 2.7} {
    depends_lib-append        port:python27
    configure.python          ${prefix}/bin/python2.7

    post-destroot {
    reinplace "s:#!/usr/bin/env python:#!${prefix}/bin/python2.7:" \
        ${destroot}${prefix}/bin/asciidoc \
        ${destroot}${prefix}/bin/a2x
    }
}

if {![variant_isset python25] && ![variant_isset python26]} {
    default_variants +python27
}

destroot.target install docs vimdir=${prefix}/share/vim/vimfiles/

pre-destroot {
    xinstall -d ${destroot}${prefix}/share/vim/vimfiles
}

platform darwin {
    # Avoid hidden dependency on gsed
    configure.env-append SED=/usr/bin/sed
}
