gnu: upower: Enable GObject introspection.
[jackhill/guix/guix.git] / gnu / packages / ghostscript.scm
index 405b4e7..818072a 100644 (file)
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +21,7 @@
 
 (define-module (gnu packages ghostscript)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages image)
@@ -26,6 +29,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages tcl)
+  #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -38,8 +42,7 @@
    (source (origin
             (method url-fetch)
             (uri (string-append
-                   "http://downloads.sourceforge.net/project/lcms/lcms/"
-                   version "/lcms2-" version ".tar.gz"))
+                  "mirror://sourceforge/lcms/lcms2-" version ".tar.gz"))
             (sha256 (base32
                      "1c8lgq8gfs3nyplvbx9k8wzfj6r2bqi3f611vb1m8z3476454wji"))))
    (build-system gnu-build-system)
@@ -112,7 +115,7 @@ documents.  Programs included are psnup, for placing out several logical pages
 on a single sheet of paper, psselect, for selecting pages from a document,
 pstops, for general imposition, psbook, for signature generation for booklet
 printing, and psresize, for adjusting page sizes.")
-   (license (license:bsd-style "file://LICENSE"
+   (license (license:non-copyleft "file://LICENSE"
                                 "See LICENSE in the distribution."))
    (home-page "http://knackered.org/angus/psutils/")))
 
@@ -124,9 +127,19 @@ printing, and psresize, for adjusting page sizes.")
             (method url-fetch)
             (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
                                 version ".tar.xz"))
-            (sha256 (base32
-                     "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
+            (sha256
+             (base32
+              "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))
+            (patches (map search-patch '("ghostscript-CVE-2015-3228.patch"
+                                         "ghostscript-runpath.patch")))
+            (modules '((guix build utils)))
+            (snippet
+             ;; Honor --docdir.
+             '(substitute* "Makefile.in"
+                (("^docdir=.*$") "docdir = @docdir@\n")
+                (("^exdir=.*$") "exdir = $(docdir)/examples\n")))))
    (build-system gnu-build-system)
+   (outputs '("out" "doc"))                  ;16 MiB of HTML/PS doc + examples
    (inputs `(("freetype" ,freetype)
              ("lcms" ,lcms)
              ("libjpeg-8" ,libjpeg-8)
@@ -141,20 +154,27 @@ printing, and psresize, for adjusting page sizes.")
         ("tcl" ,tcl)))
    (arguments
     `(#:phases
-      (alist-cons-after
-       'configure 'patch-config-files
-       (lambda _
-         (substitute* "base/all-arch.mak"
-           (("/bin/sh") (which "bash")))
-         (substitute* "base/unixhead.mak"
-           (("/bin/sh") (which "bash"))))
-      (alist-cons-after
-       'build 'build-so
-       (lambda _ (system* "make" "so"))
-      (alist-cons-after
-       'install 'install-so
-       (lambda _ (system* "make" "install-so"))
-      %standard-phases)))))
+      (modify-phases %standard-phases
+        (add-after 'configure 'patch-config-files
+                   (lambda _
+                     (substitute* "base/all-arch.mak"
+                       (("/bin/sh") (which "bash")))
+                     (substitute* "base/unixhead.mak"
+                       (("/bin/sh") (which "bash")))))
+        (add-after 'configure 'remove-doc-reference
+                   (lambda _
+                     ;; Don't retain a reference to the 'doc' output in 'gs'.
+                     ;; The only use of this definition is in the output of
+                     ;; 'gs --help', so this change is fine.
+                     (substitute* "base/gscdef.c"
+                       (("GS_DOCDIR")
+                        "\"~/.guix-profile/share/doc/ghostscript\""))))
+        (add-after 'build 'build-so
+                   (lambda _
+                     (zero? (system* "make" "so"))))
+        (add-after 'install 'install-so
+                   (lambda _
+                     (zero? (system* "make" "install-so")))))))
    (synopsis "PostScript and PDF interpreter")
    (description
     "Ghostscript is an interpreter for the PostScript language and the PDF
@@ -164,6 +184,56 @@ output file formats and printers.")
    (license license:agpl3+)
    (home-page "http://www.gnu.org/software/ghostscript/")))
 
+(define-public ghostscript/x
+  (package (inherit ghostscript)
+    (name (string-append (package-name ghostscript) "-with-x"))
+    (inputs `(("libxext" ,libxext)
+              ("libxt" ,libxt)
+              ,@(package-inputs ghostscript)))))
+
+(define-public ijs
+  (package
+   (name "ijs")
+   (version "9.14.0")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
+                                version ".tar.xz"))
+            (sha256 (base32
+                     "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
+   (build-system gnu-build-system)
+   (native-inputs
+    `(("libtool"    ,libtool)
+      ("automake"   ,automake)
+      ("autoconf"   ,autoconf)))
+   (arguments
+    `(#:phases
+      (alist-cons-after
+       'unpack 'autogen
+       (lambda _
+         ;; need to regenerate macros
+         (system* "autoreconf" "-if")
+         ;; do not run configure
+         (substitute* "autogen.sh"
+           (("^.*\\$srcdir/configure.*") ""))
+         (system* "bash" "autogen.sh")
+
+         ;; create configure script in ./ijs/
+         (chdir "ijs")
+         ;; do not run configure
+         (substitute* "autogen.sh"
+           (("^.*\\$srcdir/configure.*") "")
+           (("^ + && echo Now type.*$")  ""))
+         (zero? (system* "bash" "autogen.sh")))
+       %standard-phases)))
+   (synopsis "IJS driver framework for inkjet and other raster devices")
+   (description
+    "IJS is a protocol for transmission of raster page images.  This package
+provides the reference implementation of the raster printer driver
+architecture.")
+   (license license:expat)
+   (home-page "http://www.gnu.org/software/ghostscript/")))
+
 (define-public gs-fonts
   (package
    (name "gs-fonts")