gnu: pocl: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / ghostscript.scm
index 0561387..518e183 100644 (file)
@@ -6,6 +6,8 @@
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:use-module (srfi srfi-1))
 
 (define-public lcms
   (package
    (name "lcms")
 
 (define-public lcms
   (package
    (name "lcms")
-   (version "2.8")
+   (version "2.9")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://sourceforge/lcms/lcms/" version
                                 "/lcms2-" version ".tar.gz"))
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://sourceforge/lcms/lcms/" version
                                 "/lcms2-" version ".tar.gz"))
-            (patches (search-patches "lcms-CVE-2016-10165.patch"))
             (sha256 (base32
             (sha256 (base32
-                     "08pvl289g0mbznzx5l6ibhaldsgx41kwvdn2c974ga9fkli2pl36"))))
+                     "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8"))))
    (build-system gnu-build-system)
    (inputs `(("libjpeg-8" ,libjpeg-8)
              ("libtiff" ,libtiff)
    (build-system gnu-build-system)
    (inputs `(("libjpeg-8" ,libjpeg-8)
              ("libtiff" ,libtiff)
@@ -132,7 +135,8 @@ printing, and psresize, for adjusting page sizes.")
 (define-public ghostscript
   (package
     (name "ghostscript")
 (define-public ghostscript
   (package
     (name "ghostscript")
-    (version "9.22")
+    (replacement ghostscript/fixed)
+    (version "9.23")
     (source
       (origin
         (method url-fetch)
     (source
       (origin
         (method url-fetch)
@@ -142,7 +146,7 @@ printing, and psresize, for adjusting page sizes.")
                             "/ghostscript-" version ".tar.xz"))
         (sha256
          (base32
                             "/ghostscript-" version ".tar.xz"))
         (sha256
          (base32
-          "1fyi4yvdj39bjgs10klr31cda1fbx1ar7a7b7yz7v68gykk65y61"))
+          "1ng8d9fm5lza7k1f7ybc791275c07z5hcmpkrl2i226nshkxrkhz"))
         (patches (search-patches "ghostscript-runpath.patch"
                                  "ghostscript-no-header-creationdate.patch"
                                  "ghostscript-no-header-id.patch"
         (patches (search-patches "ghostscript-runpath.patch"
                                  "ghostscript-no-header-creationdate.patch"
                                  "ghostscript-no-header-id.patch"
@@ -152,10 +156,11 @@ printing, and psresize, for adjusting page sizes.")
           ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
           ;; we leave it, at least for now.
           ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
           ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
           ;; we leave it, at least for now.
           ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
+          ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
          '(begin
             (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
          '(begin
             (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
-                                                "lcms2" "libpng"
-                                                "tiff" "zlib"))))))
+                                                "libpng" "tiff" "zlib"))
+            #t))))
     (build-system gnu-build-system)
     (outputs '("out" "doc"))                  ;19 MiB of HTML/PS doc + examples
     (arguments
     (build-system gnu-build-system)
     (outputs '("out" "doc"))                  ;19 MiB of HTML/PS doc + examples
     (arguments
@@ -179,13 +184,6 @@ printing, and psresize, for adjusting page sizes.")
                    '()))
        #:phases
        (modify-phases %standard-phases
                    '()))
        #:phases
        (modify-phases %standard-phases
-        (add-after 'unpack 'fix-doc-dir
-          (lambda _
-            ;; Honor --docdir.
-            (substitute* "Makefile.in"
-              (("^docdir=.*$") "docdir = @docdir@\n")
-              (("^exdir=.*$") "exdir = $(docdir)/examples\n"))
-            #t))
         (add-after 'configure 'remove-doc-reference
           (lambda _
             ;; Don't retain a reference to the 'doc' output in 'gs'.
         (add-after 'configure 'remove-doc-reference
           (lambda _
             ;; Don't retain a reference to the 'doc' output in 'gs'.
@@ -194,6 +192,10 @@ printing, and psresize, for adjusting page sizes.")
             (substitute* "base/gscdef.c"
               (("GS_DOCDIR")
                "\"~/.guix-profile/share/doc/ghostscript\""))
             (substitute* "base/gscdef.c"
               (("GS_DOCDIR")
                "\"~/.guix-profile/share/doc/ghostscript\""))
+            ;; The docdir default changed in 9.23 and a compatibility
+            ;; symlink was added from datadir->docdir.  Remove it.
+            (substitute* "base/unixinst.mak"
+              (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") ""))
             #t))
          (add-after 'configure 'patch-config-files
            (lambda _
             #t))
          (add-after 'configure 'patch-config-files
            (lambda _
@@ -213,11 +215,11 @@ printing, and psresize, for adjusting page sizes.")
            (lambda _
              ;; Build 'libgs.so', but don't build the statically-linked 'gs'
              ;; binary (saves 22 MiB).
            (lambda _
              ;; Build 'libgs.so', but don't build the statically-linked 'gs'
              ;; binary (saves 22 MiB).
-             (zero? (system* "make" "so" "-j"
-                             (number->string (parallel-job-count))))))
+             (invoke "make" "so" "-j"
+                     (number->string (parallel-job-count)))))
          (replace 'install
            (lambda _
          (replace 'install
            (lambda _
-             (zero? (system* "make" "soinstall"))))
+             (invoke "make" "soinstall")))
          (add-after 'install 'create-gs-symlink
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
          (add-after 'install 'create-gs-symlink
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
@@ -233,13 +235,11 @@ printing, and psresize, for adjusting page sizes.")
        ;; these libraries.
        ,@(if (%current-target-system)
              `(("zlib/native" ,zlib)
        ;; these libraries.
        ,@(if (%current-target-system)
              `(("zlib/native" ,zlib)
-               ("libjpeg/native" ,libjpeg)
-               ("lcms2/native" ,lcms))
+               ("libjpeg/native" ,libjpeg))
              '())))
     (inputs
      `(("freetype" ,freetype)
        ("jbig2dec" ,jbig2dec)
              '())))
     (inputs
      `(("freetype" ,freetype)
        ("jbig2dec" ,jbig2dec)
-       ("lcms2" ,lcms)
        ("libjpeg" ,libjpeg)
        ("libpaper" ,libpaper)
        ("libpng" ,libpng)
        ("libjpeg" ,libjpeg)
        ("libpaper" ,libpaper)
        ("libpng" ,libpng)
@@ -254,6 +254,44 @@ output file formats and printers.")
     (home-page "https://www.ghostscript.com/")
     (license license:agpl3+)))
 
     (home-page "https://www.ghostscript.com/")
     (license license:agpl3+)))
 
+(define-public ghostscript/fixed
+  (hidden-package
+    (package
+      (inherit ghostscript)
+      (version "9.24")
+      (source
+        (origin
+          (inherit (package-source ghostscript))
+          (uri (string-append "https://github.com/ArtifexSoftware/"
+                              "ghostpdl-downloads/releases/download/gs"
+                              (string-delete #\. version)
+                              "/ghostscript-" version ".tar.xz"))
+          (sha256
+           (base32
+            "1mk922rnml93w2g42yxiyn8xqanc50cm65irrgh0b6lp4kgifjfl"))
+          (patches (search-patches "ghostscript-CVE-2018-16509.patch"
+                                   "ghostscript-bug-699708.patch"
+                                   "ghostscript-no-header-creationdate.patch"
+                                   "ghostscript-no-header-id.patch"
+                                   "ghostscript-no-header-uuid.patch"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments ghostscript)
+         ((#:configure-flags flags)
+          ;; Notice that we removed the 'ghostscript-runpath' patch above.
+          ;; The reason is that it conflicts with an upstream change that
+          ;; takes LDFLAGS into account.
+          `(cons (string-append "LDFLAGS=-Wl,-rpath="
+                                (assoc-ref %outputs "out") "/lib")
+                 ,flags))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'configure 'create-output-directory
+               (lambda* (#:key outputs #:allow-other-keys)
+                 ;; Unfortunately the configure script refuses to function if
+                 ;; the directory specified as -rpath does not already exist.
+                 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
+                 #t)))))))))
+
 (define-public ghostscript/x
   (package/inherit ghostscript
     (name (string-append (package-name ghostscript) "-with-x"))
 (define-public ghostscript/x
   (package/inherit ghostscript
     (name (string-append (package-name ghostscript) "-with-x"))
@@ -294,7 +332,7 @@ output file formats and printers.")
             (substitute* "autogen.sh"
               (("^.*\\$srcdir/configure.*") "")
               (("^ + && echo Now type.*$")  ""))
             (substitute* "autogen.sh"
               (("^.*\\$srcdir/configure.*") "")
               (("^ + && echo Now type.*$")  ""))
-            (zero? (system* "bash" "autogen.sh")))))))
+            (invoke "bash" "autogen.sh"))))))
    (synopsis "IJS driver framework for inkjet and other raster devices")
    (description
     "IJS is a protocol for transmission of raster page images.  This package
    (synopsis "IJS driver framework for inkjet and other raster devices")
    (description
     "IJS is a protocol for transmission of raster page images.  This package
@@ -335,7 +373,8 @@ architecture.")
               (for-each
                 (lambda (file)
                   (copy-file file (string-append dir "/" file)))
               (for-each
                 (lambda (file)
                   (copy-file file (string-append dir "/" file)))
-                (find-files "." "pfb|afm"))))))))
+                (find-files "." "pfb|afm"))
+              #t))))))
    (synopsis "Free replacements for the PostScript fonts")
    (description
     "Ghostscript fonts provides fonts and font metrics customarily distributed with
    (synopsis "Free replacements for the PostScript fonts")
    (description
     "Ghostscript fonts provides fonts and font metrics customarily distributed with
@@ -362,4 +401,4 @@ Ghostscript.  It currently includes the 35 standard PostScript fonts.")
 It provides a convenient easy to use API for handling and rendering
 Postscript documents.")
    (license license:gpl2+)
 It provides a convenient easy to use API for handling and rendering
 Postscript documents.")
    (license license:gpl2+)
-   (home-page "http://www.freedesktop.org/wiki/Software/libspectre")))
+   (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))