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

PortSystem          1.0
PortGroup           github 1.0

github.setup        txt2tags txt2tags 2.6
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball

name                txt2tags
version             2.6
categories          textproc
maintainers         nomaintainer
license             GPL-2
platforms           any
supported_archs     noarch

description         A document generator: ONE source, MULTI targets
long_description \
    Txt2tags is a document generator. It reads a text file with minimal \
    markup as **bold** and //italic// and converts it to the following \
    formats: HTML, XHTML, SGML, LaTeX, Lout, Man page, MoinMoin, MagicPoint, \
    PageMaker...

homepage            http://txt2tags.org/

checksums           rmd160  82188a5ad5ea71bd81c8af570d90819b25a43685 \
                    sha256  5f206d4f9dd0e2345b3f8a2cef8ddf0c697a2c3bea40963dbabe4cdb3e554b20

use_configure       no
depends_lib         port:python27

build {
    copy ${worksrcpath}/doc/English/manpage.man ${worksrcpath}/txt2tags.1
}

destroot {
    xinstall -d ${destroot}${prefix}/share/doc/txt2tags
    xinstall -m 0755 ${worksrcpath}/txt2tags ${destroot}${prefix}/bin
# I cannot get the following to work without error
#    fs-traverse file ${worksrcpath}/doc/English {
#        if {[file isfile ${file}]} {
#            copy ${file} ${destroot}${prefix}/share/doc/txt2tags
#        }
#    }
    xinstall -d ${destroot}${prefix}/share/txt2tags
    copy ${worksrcpath}/extras ${destroot}${prefix}/share/txt2tags
    copy ${worksrcpath}/samples ${destroot}${prefix}/share/txt2tags
    xinstall -m 0644 ${worksrcpath}/txt2tags.1 ${destroot}${prefix}/share/man/man1
    reinplace "s|#!/usr/bin/env python|#!${prefix}/bin/python2.7|" \
        ${destroot}${prefix}/bin/txt2tags \
        ${destroot}${prefix}/share/txt2tags/extras/gensite
}
