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

name                yodl
version             3.05.01
categories          textproc
platforms           darwin
license             GPL-3
maintainers         {larryv @larryv}

description         Your Own Document Language
long_description    Yodl is a package implementing a pre-document \
                    language and tools to process it. The idea of Yodl \
                    is that you write up a document in a pre-language, \
                    then use the tools to convert it to some final \
                    document language. Current converters are for \
                    HTML, man, LaTeX, a poor-man's text converter and \
                    an experimental XML converter. Main document types \
                    are 'article', 'report', 'book', 'letter' and \
                    'manpage'. The Yodl document language is designed \
                    to be easy to use and extensible.
homepage            http://yodl.sourceforge.net

depends_build       port:icmake
installs_libs       no

master_sites        sourceforge:project/yodl/yodl/${version}
distfiles           yodl_${version}.orig${extract.suffix}
checksums           rmd160  712337201e8b899fd4ee513004e89db12fd9e540 \
                    sha256  5a3d0e1b2abbba87217cfdc6cd354a00df8d782572495bbddbdfbd4f47fe0d3e

patchfiles          avoid-c++11.patch \
                    use-macports-compilers.patch \
                    use-macports-locations.patch
post-patch {
    reinplace -W ${worksrcpath} s|__MP_CC__|${configure.cc}| INSTALL.im
    reinplace -W ${worksrcpath} s|__MP_CXX__|${configure.cxx}| INSTALL.im
    reinplace -W ${worksrcpath} s|__MP_PREFIX__|${prefix}| INSTALL.im build
}

use_configure       no
variant universal {}

# Install steps derived from INSTALL.txt in the distribution.

build {
    set environ "CFLAGS='${configure.cflags} [get_canonical_archflags cc]'"
    append environ \
            " CXXFLAGS='${configure.cxxflags} [get_canonical_archflags cxx]'"
    append environ \
            " LDFLAGS='${configure.ldflags} [get_canonical_archflags ld]'"

    # Some sed(1) invocations fail without this.
    append environ " LC_ALL=C"

    # Contrary to what the current INSTALL.txt says, 3.05.00 requires
    # that "build macros" be run before "build man".
    system -W ${worksrcpath} "env $environ ./build programs"
    system -W ${worksrcpath} "env $environ ./build macros"
    system -W ${worksrcpath} "env $environ ./build man"
    # Don't bother building manual, since it requires LaTeX.
}

destroot {
    system -W ${worksrcpath} "./build install programs ${destroot}"
    system -W ${worksrcpath} "./build install man ${destroot}"
    system -W ${worksrcpath} "./build install macros ${destroot}"
    system -W ${worksrcpath} "./build install docs ${destroot}"
}
