| 28 | # xmlcatmgr as installed by MacPorts defaults to using |
| 29 | # ${prefix}/etc/sgml/catalog (for XML) and ${prefix}/etc/sgml/catalog (for |
| 30 | # SGML). For historic reasons, openjade expects the catalog to be in |
| 31 | # share/sgml/catalog. To avoid breaking existing setup, we simply add |
| 32 | # a reference to the root catalog (/etc/sgml/catalog) to openjade's |
| 33 | # catalog (/share/sgml/catalog) |
| 34 | set catalog.sgml ${prefix}/etc/sgml/catalog |
| 35 | set catalog.openjade ${prefix}/share/sgml/catalog |
| 36 | |
| 65 | |
| 66 | post-activate { |
| 67 | # Make the directory if it doesn't exist |
| 68 | if {![file exists ${prefix}/etc/sgml]} { |
| 69 | xinstall -m 755 -d ${prefix}/etc/sgml |
| 70 | } |
| 71 | |
| 72 | # Create the root catalog file if it doesn't exist |
| 73 | if {![file exists ${catalog.sgml}]} { |
| 74 | system "xmlcatmgr -s -c ${catalog.sgml} create" |
| 75 | } |
| 76 | |
| 77 | # Create the openjade catalog file if it doesn't exist |
| 78 | if {![file exists ${catalog.openjade}]} { |
| 79 | system "xmlcatmgr -s -c ${catalog.openjade} create" |
| 80 | } |
| 81 | |
| 82 | # Add the root catalog to openjade's catalog |
| 83 | if {[catch {exec xmlcatmgr -s -c ${catalog.openjade} lookup ${catalog.sgml}}]} { |
| 84 | system "xmlcatmgr -s -c ${catalog.openjade} add CATALOG ${catalog.sgml}" |
| 85 | } |
| 86 | |
| 87 | # And add openjade's catalog to the root catalog |
| 88 | if {[catch {exec xmlcatmgr -s -c ${catalog.sgml} lookup ${prefix}/share/sgml/openjade/catalog}]} { |
| 89 | system "xmlcatmgr -s -c ${catalog.sgml} add CATALOG ${prefix}/share/sgml/openjade/catalog" |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | if {${registry.format} == "receipt_flat"} { |
| 94 | notes \ |
| 95 | "###################################################################### |
| 96 | # As the flat registry format does not support post-deactivate hooks, |
| 97 | # you will need to ensure that you manually remove the catalog |
| 98 | # entry for this port when you uninstall it. To do so, run |
| 99 | # \"xmlcatmgr -s -c ${catalog.sgml} remove CATALOG ${prefix}/share/sgml/openjade/catalog\". |
| 100 | ######################################################################" |
| 101 | } |
| 102 | |
| 103 | # This will remove the catalog entry for this port. |
| 104 | post-deactivate { |
| 105 | # Remove the CATALOG entry from the catalog |
| 106 | system "xmlcatmgr -s -c ${catalog.sgml} remove CATALOG ${prefix}/share/sgml/openjade/catalog" |
| 107 | } |