aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/cups-pdf.rb
blob: 19788ccea8ab5427ee05cb64ff03066bedb7141c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
require 'formula'

class CupsPdf < Formula
  homepage 'http://www.cups-pdf.de/'
  url 'http://www.cups-pdf.de/src/cups-pdf_2.6.1.tar.gz'
  sha1 '6806f0004dfed5216625ab60cfe307ded23c2f6a'

  # Patch derived from MacPorts.
  patch :DATA

  def install
    system "#{ENV.cc} #{ENV.cflags} -o cups-pdf src/cups-pdf.c"

    (etc+'cups').install "extra/cups-pdf.conf"
    (lib+'cups/backend').install "cups-pdf"
    (share+'cups/model').install "extra/CUPS-PDF.ppd"
  end

  def caveats; <<-EOF.undent
    In order to use cups-pdf with the Mac OS X printing system change the file
    permissions, symlink the necessary files to their System location and
    have cupsd re-read its configuration using:

    chmod 0700 #{lib}/cups/backend/cups-pdf
    sudo chown root #{lib}/cups/backend/cups-pdf
    sudo ln -sf #{etc}/cups/cups-pdf.conf /etc/cups/cups-pdf.conf
    sudo ln -sf #{lib}/cups/backend/cups-pdf /usr/libexec/cups/backend/cups-pdf
    sudo chmod -h 0700 /usr/libexec/cups/backend/cups-pdf
    sudo ln -sf #{share}/cups/model/CUPS-PDF.ppd /usr/share/cups/model/CUPS-PDF.ppd

    sudo mkdir -p /var/spool/cups-pdf/${USER}
    sudo chown ${USER}:staff /var/spool/cups-pdf/${USER}
    ln -s /var/spool/cups-pdf/${USER} ${HOME}/Documents/cups-pdf
    sudo killall -HUP cupsd

    NOTE: When uninstalling cups-pdf these symlinks need to be removed manually.
    EOF
  end
end

__END__
diff --git a/extra/cups-pdf.conf b/extra/cups-pdf.conf
index cfb4b78..cc8410d 100644
--- a/extra/cups-pdf.conf
+++ b/extra/cups-pdf.conf
@@ -40,7 +40,7 @@
 ##  root_squash! 
 ### Default: /var/spool/cups-pdf/${USER}
 
-#Out /var/spool/cups-pdf/${USER}
+Out ${HOME}/Documents/cups-pdf/
 
 ### Key: AnonDirName
 ##  ABSOLUTE path for anonymously created PDF files
@@ -82,7 +82,7 @@
 ##                      mixed environments    :  3
 ### Default: 3
 
-#Cut 3
+Cut -1
 
 ### Key: Label
 ##  label all jobs with a unique job-id in order to avoid overwriting old
@@ -91,7 +91,7 @@
 ##  0: label untitled documents only, 1: label all documents
 ### Default: 0
 
-#Label 0
+Label 1
 
 ### Key: TitlePref
 ##  where to look first for a title when creating the output filename
@@ -180,7 +180,7 @@
 ##  created directories and log files
 ### Default: lp
 
-#Grp lp
+Grp _lp
 
 
 ###########################################################################
@@ -220,28 +220,28 @@
 ##          or its proper location on your system
 ### Default: /usr/bin/gs
 
-#GhostScript /usr/bin/gs
+GhostScript /usr/bin/pstopdf
 
 ### Key: GSTmp
 ##  location of temporary files during GhostScript operation 
 ##  this must be user-writable like /var/tmp or /tmp ! 
 ### Default: /var/tmp
 
-#GSTmp /var/tmp
+GSTmp /tmp
 
 ### Key: GSCall
 ## command line for calling GhostScript (!!! DO NOT USE NEWLINES !!!)
 ## MacOSX: for using pstopdf set this to %s %s -o %s %s
 ### Default: %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s
 
-#GSCall %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s
+GSCall %s %s -o %s %s
 
 ### Key: PDFVer
 ##  PDF version to be created - can be "1.5", "1.4", "1.3" or "1.2" 
 ##  MacOSX: for using pstopdf set this to an empty value
 ### Default: 1.4
 
-#PDFVer 1.4
+PDFVer 
 
 ### Key: PostProcessing
 ##  postprocessing script that will be called after the creation of the PDF