Ticket #31656: macports.docbook-dsssl.diff

File macports.docbook-dsssl.diff, 3.3 KB (added by fgp (Florian G. Pflug), 13 years ago)

Portfile patch. See comments for details

  • docbook-dsssl/Portfile

     
    66categories      textproc
    77description     the docbook dsssl stylesheets
    88platforms       darwin
     9depends_run     port:xmlcatmgr
    910maintainers     decibel.org:decibel
    1011master_sites    sourceforge:docbook
    1112homepage        http://docbook.sf.net/
     
    1314use_configure   no
    1415build           {}
    1516
    16 set dirs_to_install     "common contrib dtds frames html images lib olink print"
    17 set instdir                     "share/dsssl/${name}"
     17set things_to_install   "common contrib dtds frames html images lib olink print catalog VERSION"
     18set install_dir         ${prefix}/share/dsssl/${name}
    1819
     20# xmlcatmgr as installed by MacPorts defaults to using
     21# ${prefix}/etc/sgml/catalog (for XML) and ${prefix}/etc/sgml/catalog (for
     22# SGML) if no catalog is specified, but we'll specify the path just in case
     23# users have another installation of xmlcatmgr and happen to have it before
     24# ${prefix}/bin in their PATH.
     25set catalog.sgml ${prefix}/etc/sgml/catalog
     26set xmlcatmgr.args "-s -c ${catalog.sgml}"
     27
    1928destroot        {
    2029    # Docs
    21         xinstall -m 755 -d ${destroot}${prefix}/${instdir} \
     30        xinstall -m 755 -d ${destroot}${install_dir} \
    2231                ${destroot}${prefix}/share/doc/${name} \
    2332                ${destroot}${prefix}/share/${name}
    2433   
    2534    # bin
    26         xinstall -m 644 -W ${worksrcpath} bin/collateindex.pl \
     35        xinstall -m 755 -W ${worksrcpath} bin/collateindex.pl \
    2736                ${destroot}${prefix}/bin
    2837    # man
    2938        xinstall -m 644 -W ${worksrcpath} bin/collateindex.pl.1 \
     
    3140
    3241    # everything else
    3342        xinstall -m 644 -W ${worksrcpath} BUGS ChangeLog README \
    34                 RELEASE-NOTES.html RELEASE-NOTES.xml RELEASE-NOTES.txt VERSION WhatsNew \
     43                RELEASE-NOTES.html RELEASE-NOTES.xml RELEASE-NOTES.txt WhatsNew \
    3544                ${destroot}${prefix}/share/doc/${name}
    36         foreach dirname $dirs_to_install {
    37                 file copy ${worksrcpath}/${dirname} ${destroot}${prefix}/${instdir}
     45        foreach dirname $things_to_install {
     46                file copy ${worksrcpath}/${dirname} ${destroot}${install_dir}
    3847        }
    3948}
    4049
     50post-activate {
     51    # Make the directory if it doesn't exist
     52    if {![file exists ${prefix}/etc/sgml]} {
     53        xinstall -m 755 -d ${prefix}/etc/sgml
     54    }
     55
     56    # Create the catalog file if it doesn't exist
     57    if {![file exists ${catalog.sgml}]} {
     58        system "xmlcatmgr ${xmlcatmgr.args} create"
     59    }
     60
     61    # Add the CATALOG entry to the catalog if it doesn't exist
     62    if {[catch {exec xmlcatmgr ${xmlcatmgr.args} lookup ${install_dir}/catalog}]} {
     63        system "xmlcatmgr ${xmlcatmgr.args} add CATALOG ${install_dir}/catalog"
     64    }
     65}
     66
     67if {${registry.format} == "receipt_flat"} {
     68    notes \
     69"######################################################################
     70# As the flat registry format does not support post-deactivate hooks,
     71# you will need to ensure that you manually remove the catalog
     72# entry for this port when you uninstall it.  To do so, run
     73# \"xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/catalog\".
     74######################################################################"
     75}
     76
     77# This will remove the catalog entry for this port.
     78post-deactivate {
     79    # Remove the CATALOG entry from the catalog
     80    system "xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/catalog"
     81}