Ticket #31674: Portfile

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

Adds a post-activation hook with adds the catalog to /etc/sgml/catalog using xmlcatmgr (in SGML mode)

Line 
1# $Id: Portfile 56184 2009-08-25 06:11:10Z ryandesign@macports.org $
2
3PortSystem 1.0
4name            iso8879
5version         1986
6categories      textproc
7maintainers     nomaintainer
8description     Character entity sets from ISO 8879:1986 (SGML)
9platforms       darwin
10
11long_description $description
12
13master_sites    freebsd
14
15distname        isoENTS
16checksums       md5 c8a9561212c1a2ec6e48919640de9c67
17
18use_zip         yes
19
20depends_run     bin:mkcatalog:mkcatalog port:xmlcatmgr
21
22use_configure   no
23build           {}
24
25set install_dir ${prefix}/share/sgml/${name}
26
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
33
34destroot        {
35        xinstall -m 755 -d ${destroot}${install_dir}
36        xinstall -m 644 ${portpath}/${filesdir}/catalog ${destroot}${install_dir}
37        eval xinstall -m 644 [glob ${workpath}/ISO*] ${destroot}${install_dir}
38}
39
40destroot.args   prefix=${destroot}${prefix}
41
42post-activate {
43    # Make the directory if it doesn't exist
44    if {![file exists ${prefix}/etc/sgml]} {
45        xinstall -m 755 -d ${prefix}/etc/sgml
46    }
47
48    # Create the catalog file if it doesn't exist
49    if {![file exists ${catalog.sgml}]} {
50        system "xmlcatmgr -s -c ${catalog.sgml} create"
51    }
52
53    # Add the CATALOG entry to the catalog if it doesn't exist
54    if {[catch {exec xmlcatmgr lookup ${install_dir}/catalog}]} {
55        system "xmlcatmgr -s -c ${catalog.sgml} add CATALOG ${install_dir}/catalog"
56    }
57}
58
59if {${registry.format} == "receipt_flat"} {
60    notes \
61"######################################################################
62# As the flat registry format does not support post-deactivate hooks,
63# you will need to ensure that you manually remove the catalog
64# entry for this port when you uninstall it.  To do so, run
65# \"xmlcatmgr -s -c ${prefix}/etc/sgml/catalog remove CATALOG ${install_dir}/catalog\".
66######################################################################"
67}
68
69# This will remove the catalog entry for this port.
70post-deactivate {
71    # Remove the CATALOG entry from the catalog
72    system "xmlcatmgr -s -c ${catalog.sgml} remove CATALOG ${install_dir}/catalog"
73}