Ticket #31674: macports.iso8879.diff

File macports.iso8879.diff, 2.5 KB (added by fgp (Florian G. Pflug), 13 years ago)

Patch for Portfile to register the package catalog with the root catalog in /etc/sgml/catalog

  • iso8879/Portfile

     
    1717
    1818use_zip         yes
    1919
    20 depends_run     bin:mkcatalog:mkcatalog
     20depends_run     port:xmlcatmgr
    2121
    2222use_configure   no
    2323build           {}
    2424
    25 set instdir     share/sgml/iso8879
     25set install_dir ${prefix}/share/sgml/${name}
    2626
     27# xmlcatmgr as installed by MacPorts defaults to using
     28# ${prefix}/etc/sgml/catalog (for XML) and ${prefix}/etc/sgml/catalog (for
     29# SGML) if no catalog is specified, but we'll specify the path just in case
     30# users have another installation of xmlcatmgr and happen to have it before
     31# ${prefix}/bin in their PATH.
     32set catalog.sgml ${prefix}/etc/sgml/catalog
     33set xmlcatmgr.args "-s -c ${catalog.sgml}"
     34
    2735destroot        {
    28         xinstall -m 755 -d ${destroot}${prefix}/${instdir}
    29         xinstall -m 644 ${portpath}/${filesdir}/catalog ${destroot}${prefix}/${instdir}
    30         eval xinstall -m 644 [glob ${workpath}/ISO*] ${destroot}${prefix}/${instdir}
     36        xinstall -m 755 -d ${destroot}${install_dir}
     37        xinstall -m 644 ${portpath}/${filesdir}/catalog ${destroot}${install_dir}
     38        eval xinstall -m 644 [glob ${workpath}/ISO*] ${destroot}${install_dir}
    3139}
    3240
    3341destroot.args   prefix=${destroot}${prefix}
    3442
     43post-activate {
     44    # Make the directory if it doesn't exist
     45    if {![file exists ${prefix}/etc/sgml]} {
     46        xinstall -m 755 -d ${prefix}/etc/sgml
     47    }
     48
     49    # Create the catalog file if it doesn't exist
     50    if {![file exists ${catalog.sgml}]} {
     51        system "xmlcatmgr ${xmlcatmgr.args} create"
     52    }
     53
     54    # Add the CATALOG entry to the catalog if it doesn't exist
     55    if {[catch {exec xmlcatmgr ${xmlcatmgr.args} lookup ${install_dir}/catalog}]} {
     56        system "xmlcatmgr ${xmlcatmgr.args} add CATALOG ${install_dir}/catalog"
     57    }
     58}
     59
     60if {${registry.format} == "receipt_flat"} {
     61    notes \
     62"######################################################################
     63# As the flat registry format does not support post-deactivate hooks,
     64# you will need to ensure that you manually remove the catalog
     65# entry for this port when you uninstall it.  To do so, run
     66# \"xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/catalog\".
     67######################################################################"
     68}
     69
     70# This will remove the catalog entry for this port.
     71post-deactivate {
     72    # Remove the CATALOG entry from the catalog
     73    system "xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/catalog"
     74}