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

name                sgml-common
version             0.6.3
set openjade_version 1.3.2
revision            1
categories          textproc
platforms           any
license             GPL-2+
maintainers         {gmail.com:tlockhart1976 @lockhart} openmaintainer
supported_archs     noarch
# Actually - there is no homepage of this project, on that URL
# page you could get complete ISO 8879 listing as was on the
# old page - only part of it is included in sgml-common package.
homepage            http://www.w3.org/2003/entities/
description         A collection of entities and DTDs common to multiple packages.
long_description \
    The sgml-common package contains a collection of entities and DTDs \
    that are useful for processing SGML, but that don't need to be \
    included in multiple packages.  Sgml-common also includes an \
    up-to-date Open Catalog file. \
    Transcribed from the Fedora 15 RPM written originally by \
    Tim Waugh <twaugh@redhat.com> based on work by Eric Bischoff \
    and with recent maintenance by Ondrej Vasik <ovasik@redhat.com>.

master_sites        ftp://sources.redhat.com/pub/docbook-tools/new-trials/SOURCES/:redhat \
                    sourceforge:project/openjade/openjade/${openjade_version}:openjade

extract.suffix      .tgz
set openjade        openjade-${openjade_version}

distfiles           ${distname}${extract.suffix}:redhat \
                    ${openjade}.tar.gz:openjade

checksums           ${distname}${extract.suffix} \
                    rmd160  246d01272f70cd8382a7d596392e61d7dc0eec78 \
                    sha256  7dc418c1d361123ffc5e45d61f1b97257940a8eb35d0bfbbc493381cc5b1f959 \
                    ${openjade}.tar.gz \
                    rmd160  3b12f6596a42c49a60cc07cd9b8f4c5fdf3bafd2 \
                    sha256  1d2d7996cc94f9b87d0c51cf0e028070ac177c4123ecbfd7ac1cb8d0b7d322d1

depends_lib-append  port:perl5 \
                    port:libxml2

set sgmldir ${prefix}/share/sgml

patch.pre_args-replace  -p0 -p1
patchfiles          patch-bin-install-catalog.in.diff \
                    patch-config-sgml.conf.diff \
                    patch-xml-iso-entities-Makefile.am.diff \
                    patch-xml-iso-entities-Makefile.in.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|" \
        ${worksrcpath}/config/sgml.conf
}

use_configure       no

build {}

destroot {
    xinstall -d ${destroot}${sgml.confdir}
    xinstall ${worksrcpath}/config/sgml.conf ${destroot}${sgml.confdir}/sgml.conf
    xinstall -d ${destroot}${sgmldir}
    # Following 4 from openjade/pubtext - same maintainer as in SGML-common, so up2date:
    xinstall -W ${workpath}/${openjade}/pubtext xml.dcl xml.soc html.dcl html.soc ${destroot}${sgmldir}
}
