Ticket #31673: Portfile

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

Portfile for docbook-sgml-4.2

Line 
1# $Id: Portfile 80952 2011-07-21 23:51:47Z jmr@macports.org $
2
3PortSystem 1.0
4
5name        docbook-sgml-4.2
6version     [strsed ${name} {s/docbook-sgml-//}]
7description Version ${version} of the DocBook SGML DTDs
8long_description \
9    Version ${version} of the DocBook SGML DTDs, which provide a structured,\
10    semantic markup format for books and documentation, especially for\
11    computer hardware and software.
12categories  textproc
13license     MIT Permissive
14platforms   darwin
15maintainers phlo.org:fgp
16supported_archs noarch
17distname    docbook-${version}
18
19homepage    http://www.docbook.org/sgml/${version}/
20master_sites    http://www.oasis-open.org/docbook/sgml/${version}/
21checksums   md5 0dfeb94569334dd22a62d90d99fc0630 \
22            sha1 98afcae616ed24edb30e40baa4ddd8cd8731f2c7
23worksrcdir  ${distname}
24
25depends_run port:xmlcatmgr port:docbook-dsssl port:iso8879
26
27use_zip     yes
28
29extract.mkdir   yes
30
31use_configure   no
32build       {}
33
34set install_dir    ${prefix}/share/sgml/docbook/${version}
35
36# xmlcatmgr as installed by MacPorts defaults to using
37# ${prefix}/etc/sgml/catalog (for XML) and ${prefix}/etc/sgml/catalog (for
38# SGML) if no catalog is specified, but we'll specify the path just in case
39# users have another installation of xmlcatmgr and happen to have it before
40# ${prefix}/bin in their PATH.
41set catalog.sgml ${prefix}/etc/sgml/catalog
42set xmlcatmgr.args "-s -c ${catalog.sgml}"
43
44destroot {
45    set destroot_dir    ${destroot}${install_dir}
46    set destroot_files  [readdir ${worksrcpath}]
47    xinstall -m 755 -d ${destroot_dir}
48    foreach file ${destroot_files} {
49        copy ${worksrcpath}/${file} ${destroot_dir}
50    }
51}
52
53post-activate {
54    # Make the directory if it doesn't exist
55    if {![file exists ${prefix}/etc/sgml]} {
56        xinstall -m 755 -d ${prefix}/etc/sgml
57    }
58
59    # Create the catalog file if it doesn't exist
60    if {![file exists ${catalog.sgml}]} {
61        system "xmlcatmgr ${xmlcatmgr.args} create"
62    }
63
64    # Add the CATALOG entry to the catalog if it doesn't exist
65    if {[catch {exec xmlcatmgr ${xmlcatmgr.args} lookup ${install_dir}/docbook.cat}]} {
66        system "xmlcatmgr ${xmlcatmgr.args} add CATALOG ${install_dir}/docbook.cat"
67    }
68}
69
70if {${registry.format} == "receipt_flat"} {
71    notes \
72"######################################################################
73# As the flat registry format does not support post-deactivate hooks,
74# you will need to ensure that you manually remove the catalog
75# entry for this port when you uninstall it.  To do so, run
76# \"xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/docbook.cat\".
77######################################################################"
78}
79
80# This will remove the catalog entry for this port.
81post-deactivate {
82    # Remove the CATALOG entry from the catalog
83    system "xmlcatmgr ${xmlcatmgr.args} remove CATALOG ${install_dir}/docbook.cat"
84}