Ticket #31656: Portfile

File Portfile, 2.7 KB (added by fgp (Florian G. Pflug), 13 years ago)

Enhanced Portfile. Installs the main catalog and also adds it to /etc/sgml/catalog

Line 
1# $Id: Portfile 71533 2010-09-15 20:26:12Z ryandesign@macports.org $
2PortSystem 1.0
3
4name            docbook-dsssl
5version         1.79
6categories      textproc
7description     the docbook dsssl stylesheets
8platforms       darwin
9depends_run     port:xmlcatmgr
10maintainers     decibel.org:decibel
11master_sites    sourceforge:docbook
12homepage        http://docbook.sf.net/
13checksums       md5 8459913bbd8a5724a6fe4b9ed5bab5af
14use_configure   no
15build           {}
16
17set things_to_install   "common contrib dtds frames html images lib olink print catalog"
18set install_dir         ${prefix}/share/dsssl/${name}
19
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
26
27destroot        {
28    # Docs
29        xinstall -m 755 -d ${destroot}${install_dir} \
30                ${destroot}${prefix}/share/doc/${name} \
31                ${destroot}${prefix}/share/${name}
32   
33    # bin
34        xinstall -m 755 -W ${worksrcpath} bin/collateindex.pl \
35                ${destroot}${prefix}/bin
36    # man
37        xinstall -m 644 -W ${worksrcpath} bin/collateindex.pl.1 \
38                ${destroot}${prefix}/share/man/man1
39
40    # everything else
41        xinstall -m 644 -W ${worksrcpath} BUGS ChangeLog README \
42                RELEASE-NOTES.html RELEASE-NOTES.xml RELEASE-NOTES.txt VERSION WhatsNew \
43                ${destroot}${prefix}/share/doc/${name}
44        foreach dirname $things_to_install {
45                file copy ${worksrcpath}/${dirname} ${destroot}${install_dir}
46        }
47}
48
49post-activate {
50    # Make the directory if it doesn't exist
51    if {![file exists ${prefix}/etc/sgml]} {
52        xinstall -m 755 -d ${prefix}/etc/sgml
53    }
54
55    # Create the catalog file if it doesn't exist
56    if {![file exists ${catalog.sgml}]} {
57        system "xmlcatmgr -s -c ${catalog.sgml} create"
58    }
59
60    # Add the CATALOG entry to the catalog if it doesn't exist
61    if {[catch {exec xmlcatmgr lookup ${install_dir}/catalog}]} {
62        system "xmlcatmgr -s -c ${catalog.sgml} add CATALOG ${install_dir}/catalog"
63    }
64}
65
66if {${registry.format} == "receipt_flat"} {
67    notes \
68"######################################################################
69# As the flat registry format does not support post-deactivate hooks,
70# you will need to ensure that you manually remove the catalog
71# entry for this port when you uninstall it.  To do so, run
72# \"xmlcatmgr -s -c ${prefix}/etc/sgml/catalog remove CATALOG ${install_dir}/catalog\".
73######################################################################"
74}
75
76# This will remove the catalog entry for this port.
77post-deactivate {
78    # Remove the CATALOG entry from the catalog
79    system "xmlcatmgr -s -c ${catalog.sgml} remove CATALOG ${install_dir}/catalog"
80}
81
82livecheck.type  none