]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/backend-library.scm
*** empty log message ***
[lilypond.git] / scm / backend-library.scm
index a008fd28dd57816b38cfe68133eaf627a1a68cc4..74e53693594a9c836aed76fbd10a5768a2c3428a 100644 (file)
 
 (define-public (ly:system command)
   (let* ((status 0)
-        (silenced
-         (string-append command (if (ly:get-option 'verbose)
-                                    ""
-                                    " > /dev/null 2>&1 "))))
+        (dev-null "/dev/null")
+        (silenced (if (or (ly:get-option 'verbose)
+                          (not (access? dev-null W_OK)))
+                      command
+                      (format #f "~a > ~a 2>&1 " command dev-null))))
     (if (ly:get-option 'verbose)
        (ly:message (_ "Invoking `~a'...") command))
     
    "\""))
 
 (define-public (postscript->pdf papersizename name)
-  (let* ((cmd (format #f "ps2pdf -sPAPERSIZE=~a '~a'"
-                     (sanitize-command-option papersizename) name))
-        (pdf-name (string-append (basename name ".ps") ".pdf" )))
+  (let* ((pdf-name (string-append (basename name ".ps") ".pdf" ))
+        (cmd (format #f
+                     "gs\
+ -dSAFER\
+ -dCompatibilityLevel=1.4 \
+ -sPAPERSIZE=~a\
+ -q\
+ -dNOPAUSE\
+ -dBATCH\
+ -sDEVICE=pdfwrite\
+ -sOutputFile=~S\
+ -c .setpdfwrite\
+ -f ~S\
+"
+                     (sanitize-command-option papersizename)
+                     pdf-name
+                     name)))
+    ;; The wrapper on windows cannot handle `=' signs,
+    ;; gs has a workaround with #.
+    (if (eq? PLATFORM 'windows)
+       (set! cmd (string-regex-substitute "=" "#" cmd)))
 
     (if (access? pdf-name W_OK)
        (delete-file pdf-name))
@@ -51,7 +70,7 @@
                           (format "~a/scripts/lilypond-ps2png.py" prefix)
                           "lilypond-ps2png"))
         (cmd (format #f
-                     "~a --resolution=~S --papersize=~a~a '~a'"
+                     "~a --resolution=~S --papersize=~a~a ~S"
                      (if (file-exists? ps2png-source)
                          (format "python ~a" ps2png-source)
                          "lilypond-ps2png")