Ticket #45006: Portfile

File Portfile, 5.7 KB (added by icaines77@…, 9 years ago)

Revised Portfile with instructions re sandboxing.

Line 
1# $Id$
2
3PortSystem          1.0
4
5name                cups-pdf
6version             2.6.1
7categories          print textproc
8license             GPL-2+
9maintainers         nomaintainer
10description         Provides a print-to-PDF feature through CUPS
11long_description \
12   This software is designed to produce PDF files in a heterogeneous \
13   network by providing a PDF printer on the central fileserver.
14
15platforms           darwin
16depends_run         port:ghostscript
17
18if {${os.platform} eq "darwin" && ${os.major} > 9} {
19   set notes-darwinover9 "
20
21   For OS X 10.6 (Snow Leopard) later:
22
23     As of Mac OS X 10.6, cups can no longer write into user directories, so
24     the output directory for ${name} has been updated to reflect this.
25     ${name} will now write PDF files into ${prefix}/var/spool/cups-pdf/\$USER .
26     You can create a symlink to this location from Desktop to have it behave as
27     before:
28        ln -s ${prefix}/var/spool/cups-pdf/\$USER ~/Desktop/cups-pdf
29
30     If you are upgrading, your ${prefix}/etc/cups/cups-pdf.conf file will
31     not be touched, and will probably need the Out parameter updated; see the
32     ${prefix}/etc/cups/cups-pdf.conf.dist file for an example."
33} else {
34   set notes-darwinover9 ""
35}
36
37if {${os.platform} eq "darwin" && ${os.major} > 13} {
38   set notes-yosemite "
39   
40   For OS X 10.10 (Yosemite) or later:
41
42     OS X 10.10 moved to CUPS 2, with stricter sandboxing requirements that
43     interfere with the operation of cups-pdf.  Pending fixes in the cups-pdf
44     package, you can revert to the old sandboxing behavior and allow cups-pdf
45     to work by adding the following line to /etc/cups/cups-files.conf:
46
47       Sandboxing relaxed
48
49     (Note that by doing this you are partially disabling one of the security
50     features in CUPS.)   
51   "
52} else {
53   set notes-yosemite ""
54}
55
56notes "
57   *************************************************************
58   If this is the first installation, there are a couple of items to do / be aware of:
59
60   General notes:
61     -  First, symlinks in /usr are needed for CUPS to see cups-pdf, so run
62        (it will run sudo so may ask for your password):
63           ${prefix}/libexec/cups-pdf_links.sh
64     -  Edit ${prefix}/etc/cups/cups-pdf.conf as needed
65     -  Edit
66     -  Finally, tell cupsd to update (it may not be running on 10.5+):
67           sudo killall -1 cupsd 
68   ${notes-darwinover9}
69   ${notes-yosemite}
70   *************************************************************
71   "
72
73homepage            http://www.cups-pdf.de/
74master_sites        ${homepage}src/
75distname            ${name}_${version}
76worksrcdir          ${name}-${version}
77
78checksums           md5     65f3fd525c4a9b1d736b91594b3166d5 \
79                    sha1    6806f0004dfed5216625ab60cfe307ded23c2f6a \
80                    rmd160  ebb7ed5192ff91201e2ef9d87d8f24c1c7a393cc
81
82post-patch {
83   reinplace "s|/etc|${prefix}/etc|" ${worksrcpath}/src/cups-pdf.h
84   reinplace "s|/var/spool|${prefix}/var/spool|" \
85      ${worksrcpath}/src/cups-pdf.h
86   reinplace "s|/var/log|${prefix}/var/log|" ${worksrcpath}/src/cups-pdf.h
87}
88
89use_configure       no
90
91build {
92   system -W ${worksrcpath}/src "${configure.cc} ${configure.cflags} [get_canonical_archflags] -o cups-pdf cups-pdf.c"
93}
94
95destroot {
96   xinstall -m 755 -d ${destroot}${prefix}/libexec/cups/backend \
97      ${destroot}${prefix}/etc/cups ${destroot}${prefix}/share/cups/model \
98      ${destroot}${prefix}/share/doc/${name} \
99      ${destroot}${prefix}/var/spool/cups-pdf \
100      ${destroot}${prefix}/var/log/cups
101   xinstall -m 700 ${worksrcpath}/src/cups-pdf \
102      ${destroot}${prefix}/libexec/cups/backend
103   xinstall -m 644 ${worksrcpath}/extra/cups-pdf.conf \
104      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
105   xinstall -m 644 ${worksrcpath}/extra/CUPS-PDF.ppd \
106      ${destroot}${prefix}/share/cups/model
107   xinstall -m 644 -W ${worksrcpath} README COPYING ChangeLog \
108      ${destroot}${prefix}/share/doc/${name}
109
110   # Some initial changes to the conf file
111   if {${os.platform} eq "darwin" && ${os.major} > 9} {
112      reinplace "s|#Out .*|Out ${prefix}/var/spool/cups-pdf/\${USER}/|" \
113         ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
114   } else {
115      reinplace "s|#Out .*|Out \${HOME}/Desktop/cups-pdf/|" \
116         ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
117   }
118   reinplace "s| /var/spool| ${prefix}/var/spool|" \
119      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
120   reinplace "s| /var/log| ${prefix}/var/log|" \
121      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
122   reinplace "s|#Cut .*|Cut 3|" \
123      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
124   reinplace "s|#Label .*|Label 1|" \
125      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
126   reinplace "s|#Log |Log |" \
127      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
128   reinplace "s|#Log |Log |" \
129      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
130   reinplace "s|#GhostScript .*|GhostScript ${prefix}/bin/gs|" \
131      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
132#   reinplace "s|#GSCall .*|GSCall %s %s -o %s %s|" \
133#      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
134#   reinplace "s|#PDFVer .*|PDFVer |" \
135#      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
136}
137destroot.keepdirs   ${destroot}${prefix}/var/spool/cups-pdf \
138                    ${destroot}${prefix}/var/log/cups
139post-destroot {
140   xinstall -m 755 -W ${filespath} cups-pdf_links.sh \
141      ${destroot}${prefix}/libexec/
142   reinplace "s|@@PREFIX@@|${prefix}|g" \
143      ${destroot}${prefix}/libexec/cups-pdf_links.sh
144}
145
146post-activate {
147   if {![file exists ${prefix}/etc/cups/cups-pdf.conf]} {
148      copy ${prefix}/etc/cups/cups-pdf.conf.dist \
149         ${prefix}/etc/cups/cups-pdf.conf
150   }
151}
152
153livecheck.type      regex
154livecheck.url       http://www.cups-pdf.de/src
155livecheck.regex     cups-pdf_(\\d(?:\\.\\d)+)${extract.suffix}