--- Portfile.orig	2015-03-29 16:02:22.000000000 -0400
+++ Portfile	2015-03-29 15:55:53.000000000 -0400
@@ -13,34 +13,62 @@
    network by providing a PDF printer on the central fileserver.
 
 platforms           darwin
+depends_run         port:ghostscript
 
 if {${os.platform} eq "darwin" && ${os.major} > 9} {
    set notes-darwinover9 "
-   As of Mac OS X 10.6, cups can no longer write into user directories, so
-   the output directory for ${name} has been updated to reflect this.
-   ${name} will now write PDF files into ${prefix}/var/spool/cups-pdf/\$USER .
-   You can create a symlink to this location from Desktop to have it behave as
-   before:
-      ln -s ${prefix}/var/spool/cups-pdf/\$USER ~/Desktop/cups-pdf
-
-   If you are upgrading, your ${prefix}/etc/cups/cups-pdf.conf file will
-   not be touched, and will probably need the Out parameter updated; see the
-   ${prefix}/etc/cups/cups-pdf.conf.dist file for an example."
+
+   For OS X 10.6 (Snow Leopard) later:
+
+     As of Mac OS X 10.6, cups can no longer write into user directories, so
+     the output directory for ${name} has been updated to reflect this.
+     ${name} will now write PDF files into ${prefix}/var/spool/cups-pdf/\$USER .
+     You can create a symlink to this location from Desktop to have it behave as
+     before:
+        ln -s ${prefix}/var/spool/cups-pdf/\$USER ~/Desktop/cups-pdf
+
+     If you are upgrading, your ${prefix}/etc/cups/cups-pdf.conf file will
+     not be touched, and will probably need the Out parameter updated; see the
+     ${prefix}/etc/cups/cups-pdf.conf.dist file for an example."
 } else {
    set notes-darwinover9 ""
 }
 
+if {${os.platform} eq "darwin" && ${os.major} > 13} {
+   set notes-yosemite "
+   
+   For OS X 10.10 (Yosemite) or later:
+
+     OS X 10.10 moved to CUPS 2, with stricter sandboxing requirements that
+     interfere with the operation of cups-pdf.  Pending fixes in the cups-pdf 
+     package, you can revert to the old sandboxing behavior and allow cups-pdf 
+     to work by adding the following line to /etc/cups/cups-files.conf:
+
+       Sandboxing relaxed
+
+     (Note that by doing this you are partially disabling one of the security
+     features in CUPS.)    
+   "
+} else {
+   set notes-yosemite ""
+}
+
 notes "
    *************************************************************
-   If this is the first installation, there are a couple of items to do:
-   -  First, symlinks in /usr are needed for CUPS to see cups-pdf, so run
-      (it will run sudo so may ask for your password):
-         ${prefix}/libexec/cups-pdf_links.sh
-   -  Edit ${prefix}/etc/cups/cups-pdf.conf as needed
-   -  Finally, tell cupsd to update (it may not be running on 10.5+):
-         sudo killall -1 cupsd
+   If this is the first installation, there are a couple of items to do / be aware of:
+
+   General notes:
+     -  First, symlinks in /usr are needed for CUPS to see cups-pdf, so run
+        (it will run sudo so may ask for your password):
+           ${prefix}/libexec/cups-pdf_links.sh
+     -  Edit ${prefix}/etc/cups/cups-pdf.conf as needed
+     -  Edit 
+     -  Finally, tell cupsd to update (it may not be running on 10.5+):
+           sudo killall -1 cupsd  
+   ${notes-darwinover9}
+   ${notes-yosemite}
    *************************************************************
-   ${notes-darwinover9}"
+   "
 
 homepage            http://www.cups-pdf.de/
 master_sites        ${homepage}src/
@@ -99,12 +127,12 @@
       ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
    reinplace "s|#Log |Log |" \
       ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
-   reinplace "s|#GhostScript .*|GhostScript /usr/bin/pstopdf|" \
-      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
-   reinplace "s|#GSCall .*|GSCall %s %s -o %s %s|" \
-      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
-   reinplace "s|#PDFVer .*|PDFVer |" \
+   reinplace "s|#GhostScript .*|GhostScript ${prefix}/bin/gs|" \
       ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
+#   reinplace "s|#GSCall .*|GSCall %s %s -o %s %s|" \
+#      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
+#   reinplace "s|#PDFVer .*|PDFVer |" \
+#      ${destroot}${prefix}/etc/cups/cups-pdf.conf.dist
 }
 destroot.keepdirs   ${destroot}${prefix}/var/spool/cups-pdf \
                     ${destroot}${prefix}/var/log/cups
