# -*- 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 120119 2014-05-16 15:16:14Z mf2k@macports.org $

PortSystem          1.0
PortGroup           perl5 1.0

perl5.branches      5.8 5.10 5.12 5.14 5.16
perl5.setup         SGMLSpm 1.03ii
# version needs to be set because of a bug in the perl5 portgroup that cannot handle characters in the version number.
# See #43727 <http://trac.macports.org/ticket/43727>. 
version             1.03ii.0
platforms           darwin
license             GPL-2+
maintainers         fourpalms.org:lockhart openmaintainer
supported_archs     noarch

description         Convert SGML, HTML, or XML documents into new formats.
long_description    Perl programs can use the SGMLSpm module to help convert \
                    SGML, HTML or XML documents into new formats.

homepage            http://search.cpan.org/dist/SGMLSpm/
master_sites        http://search.cpan.org/CPAN/authors/id/D/DM/DMEGG/

checksums           rmd160  919963150640d4c1a2a52439cd0d985c52c71bb3 \
                    sha256  f06895c0206dada9f9e7f07ecaeb6a3651fd648f4820f49c1f76bfeaec2f2913

depends_lib-append  port:openjade \
                    port:opensp

worksrcdir          ${perl5.module}

if {${perl5.major} != ""} {
    post-patch {
        reinplace "s|/usr/local/|${destroot}${prefix}/|" ${worksrcpath}/Makefile
        reinplace "s|/usr/local/|${destroot}${prefix}/|" ${worksrcpath}/DOC/Makefile

        xinstall -d -m 775 ${destroot}${prefix}/bin
        xinstall -d -m 775 ${destroot}${perl5.lib}
        xinstall -d -m 775 ${destroot}${perl5.lib}/SGMLS
    }

    use_configure       no

    build.args-append   PERL=${perl5.bin} BINDIR=${destroot}${prefix}/bin
    build.args-append   PERL5DIR=${destroot}${perl5.lib}
    build.args-append   HTMLDIR=${destroot}${prefix}/share/doc/${subport}

    destroot.target install
}
