--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/textproc/openjade/Portfile	2014-01-21 16:32:53.000000000 -0800
+++ Portfile	2014-02-19 15:42:59.000000000 -0800
@@ -2,21 +2,21 @@
 # $Id: Portfile 115642 2014-01-07 19:12:38Z ryandesign@macports.org $
 
 PortSystem 1.0
+PortGroup xmlcatalog 1.0
 
 name            openjade
 version         1.3.2
-revision        7
+revision        8
 categories      textproc
 license         MIT
 maintainers     fourpalms.org:lockhart openmaintainer
 description     James Clark's implementation of DSSSL
+long_description \
+    OpenJade is an implementation of ISO/IEC 10179:1996 \
+    standard DSSSL language.
 homepage        http://openjade.sourceforge.net/
 platforms       darwin freebsd
-
-long_description OpenJade is an implementation of ISO/IEC 10179:1996 \
-                 standard DSSSL language.
-
-master_sites    sourceforge:project/openjade/openjade/${version}
+master_sites    sourceforge
 
 checksums       md5 7df692e3186109cc00db6825b777201e
 
@@ -30,24 +30,18 @@
 depends_lib     port:opensp
 depends_run     port:xmlcatmgr
 
-# xmlcatmgr as installed by MacPorts defaults to using
-# ${prefix}/etc/sgml/catalog (for XML) and ${prefix}/etc/sgml/catalog (for
-# SGML). For historic reasons, openjade expects the catalog to be in
-# share/sgml/catalog. To avoid breaking existing setup, we simply add
-# a reference to the root catalog (/etc/sgml/catalog) to openjade's
-# catalog (/share/sgml/catalog)
-set catalog.sgml      ${prefix}/etc/sgml/catalog
-set catalog.openjade  ${prefix}/share/sgml/catalog
- 
-configure.args  --enable-http --enable-html --enable-mif \
-                --disable-dependency-tracking \
-                --enable-default-catalog=${catalog.openjade} \
-                --datadir=${prefix}/share/sgml/openjade \
-                --mandir=${prefix}/share/man
-
-configure.env-append        LIBS="-L${prefix}/lib"
-configure.cxxflags-append   "-isystem ${prefix}/include -fno-rtti"
-configure.ldflags-delete    "-L${prefix}/lib"
+set openjade.catalog ${prefix}/share/sgml/catalog
+set openjade.rootcatalog ${prefix}/share/sgml/openjade/catalog
+
+sgml.catalog ${openjade.rootcatalog}
+# Add the root catalog to the openjade catalog
+sgml.addtocatalog "${openjade.catalog}" "${sgml.rootcatalog}"
+
+configure.args --enable-http --enable-html --enable-mif \
+               --disable-dependency-tracking \
+               --enable-default-catalog=${openjade.catalog} \
+               --datadir=${prefix}/share/sgml/openjade \
+               --mandir=${prefix}/share/man
 
 # Fix build failure on Tiger due to use of -isystem
 compiler.blacklist    gcc-4.0 gcc-3.3
@@ -58,6 +52,10 @@
     set cxx_stdlibflags "-stdlib=${configure.cxx_stdlib}"
 }
 
+configure.env-append      LIBS="-L${prefix}/lib"
+configure.cxxflags-append "-isystem ${prefix}/include -fno-rtti"
+configure.ldflags-delete  "-L${prefix}/lib"
+
 post-configure  {
     reinplace "s|^#pragma implementation||g" ${worksrcpath}/grove/Node.cxx
     reinplace "s|^#pragma implementation||g" ${worksrcpath}/msggen.pl
@@ -75,40 +73,7 @@
 
 destroot.target install install-man
 
-post-destroot   {
+post-destroot {
     system "install -d -m 755 ${destroot}${prefix}/share/sgml/openjade"
     system "install -m 644 ${worksrcpath}/dsssl/* ${destroot}${prefix}/share/sgml/openjade"
 }
-
-post-activate {
-    # Make the directory if it doesn't exist
-    if {![file exists ${prefix}/etc/sgml]} {
-        xinstall -m 755 -d ${prefix}/etc/sgml
-    }
-
-    # Create the root catalog file if it doesn't exist
-    if {![file exists ${catalog.sgml}]} {
-        system "xmlcatmgr -s -c ${catalog.sgml} create"
-    }
-
-    # Create the openjade catalog file if it doesn't exist
-    if {![file exists ${catalog.openjade}]} {
-        system "xmlcatmgr -s -c ${catalog.openjade} create"
-    }
-
-    # Add the root catalog to openjade's catalog
-    if {[catch {exec xmlcatmgr -s -c ${catalog.openjade} lookup ${catalog.sgml}}]} {
-        system "xmlcatmgr -s -c ${catalog.openjade} add CATALOG ${catalog.sgml}"
-    }
-
-    # And add openjade's catalog to the root catalog
-    if {[catch {exec xmlcatmgr -s -c ${catalog.sgml} lookup ${prefix}/share/sgml/openjade/catalog}]} {
-        system "xmlcatmgr -s -c ${catalog.sgml} add CATALOG ${prefix}/share/sgml/openjade/catalog"
-    }
-}
-
-# This will remove the catalog entry for this port.
-post-deactivate {
-    # Remove the CATALOG entry from the catalog
-    system "xmlcatmgr -s -c ${catalog.sgml} remove CATALOG ${prefix}/share/sgml/openjade/catalog"
-}
