You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

406 lines
16 KiB

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <>
;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <>
;;; Copyright © 2015 Ricardo Wurmus <>
;;; Copyright © 2013, 2015, 2016, 2017, 2019 Ludovic Courtès <>
;;; Copyright © 2017 Alex Vong <>
;;; Copyright © 2017, 2018, 2019 Efraim Flashner <>
;;; Copyright © 2017 Leo Famulari <>
;;; Copyright © 2018 Tobias Geerinckx-Rice <>
;;; Copyright © 2018, 2020 Marius Bakke <>
;;; Copyright © 2019 Mathieu Othacehe <>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <>.
(define-module (gnu packages ghostscript)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages compression)
#:use-module (gnu packages cups)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages image)
#:use-module (gnu packages perl)
#: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)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (srfi srfi-1))
(define-public lcms
(name "lcms")
(version "2.9")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/lcms/lcms/" version
"/lcms2-" version ".tar.gz"))
(patches (search-patches "lcms-CVE-2018-16435.patch"))
(sha256 (base32
(build-system gnu-build-system)
`(#:configure-flags '("--disable-static")))
(inputs `(("libjpeg" ,libjpeg-turbo)
("libtiff" ,libtiff)
("zlib" ,zlib)))
(synopsis "Little CMS, a small-footprint colour management engine")
"Little CMS is a small-footprint colour management engine, with special
focus on accuracy and performance. It uses the International Color
Consortium standard (ICC), approved as ISO 15076-1.")
(license license:x11)
(home-page "")
(properties '((cpe-name . "little_cms_color_engine")))))
(define-public libpaper
(name "libpaper")
(version "1.1.24")
(source (origin
(method url-fetch)
(uri (string-append
;; Debian moved their libpaper-1.1.24 to
;; but in the move the hash of their tarball changed.
version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
version ".tar.gz"))
(sha256 (base32
(build-system gnu-build-system)
`(("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
`(#:configure-flags '("--disable-static")
(modify-phases %standard-phases
(add-after 'unpack 'fix-configure
(lambda* (#:key inputs native-inputs #:allow-other-keys)
;; Replace outdated config.sub and config.guess:
(for-each (lambda (file)
(string-append (assoc-ref
(or native-inputs inputs) "automake")
(package-version automake))
"/" file) "."))
'("config.sub" "config.guess"))
(synopsis "Library for handling paper sizes")
"The paper library and accompanying files are intended to provide a simple
way for applications to take actions based on a system- or user-specified
paper size.")
(license license:gpl2)
(home-page "")))
(define-public psutils
(name "psutils")
(version "17")
(source (origin
(method url-fetch)
(uri "")
(sha256 (base32
(build-system gnu-build-system)
(inputs `(("perl" ,perl)))
`(#:tests? #f ; none provided
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
(let ((perl (assoc-ref inputs "perl"))
(out (assoc-ref outputs "out")))
(copy-file "Makefile.unix" "Makefile")
(substitute* "Makefile"
(("/usr/local/bin/perl") (string-append perl "/bin/perl")))
(substitute* "Makefile"
(("/usr/local") out))
;; for the install phase
(substitute* "Makefile"
(("-mkdir") "mkdir -p"))
;; drop installation of non-free files
(substitute* "Makefile"
((" install.include") "")))
(synopsis "Collection of utilities for manipulating PostScript documents")
"PSUtils is a collection of utilities for manipulating PostScript
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:non-copyleft "file://LICENSE"
"See LICENSE in the distribution."))
(home-page "")))
(define-public ghostscript
(name "ghostscript")
(version "9.52")
(method url-fetch)
(uri (string-append ""
(string-delete #\. version)
"/ghostscript-" version ".tar.xz"))
(patches (search-patches "ghostscript-no-header-creationdate.patch"
(modules '((guix build utils)))
;; 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".
(for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
"libpng" "tiff" "zlib"))
(build-system gnu-build-system)
(outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
`(#:disallowed-references ("doc")
;; XXX: Starting with version 9.27, building the tests in parallel
;; occasionally fails like this:
;; In file included from ./base/memory_.h:23:0,
;; from ./obj/gsmd5.h:1,
;; from ./obj/gsmd5.c:56:
;; ./base/std.h:25:10: fatal error: arch.h: No such file or directory
#:parallel-tests? #f
(list (string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib")
(string-append "ZLIBDIR="
(assoc-ref %build-inputs "zlib") "/include")
(string-append "--with-fontpath="
(assoc-ref %build-inputs "gs-fonts")
,@(if (%current-target-system)
'(;; Specify the native compiler, which is used to build 'echogs'
;; and other intermediary tools when cross-compiling; see
;; <>.
;; Save 'config.log' etc. of the native build under
;; auxtmp/, useful for debugging.
(modify-phases %standard-phases
(add-before 'configure 'create-output-directory
(lambda* (#:key outputs #:allow-other-keys)
;; 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"))
(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"
(add-after 'configure 'patch-config-files
(lambda _
(substitute* "base/unixhead.mak"
(("/bin/sh") (which "sh")))
,@(if (%current-target-system)
`((add-after 'configure 'add-native-lz
(lambda _
;; Add missing '-lz' for native tools such as 'mkromfs'.
(substitute* "Makefile"
(("^AUXEXTRALIBS=(.*)$" _ value)
(string-append "AUXEXTRALIBS = -lz " value "\n")))
(replace 'build
(lambda _
;; Build '', but don't build the statically-linked 'gs'
;; binary (saves 22 MiB).
(invoke "make" "so" "-j"
(number->string (parallel-job-count)))))
(replace 'install
(lambda _
(invoke "make" "soinstall")))
(add-after 'install 'create-gs-symlink
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
;; Some programs depend on having a 'gs' binary available.
(symlink "gsc" (string-append out "/bin/gs"))
`(("perl" ,perl)
("pkg-config" ,pkg-config) ;needed for freetype
("python" ,python-wrapper)
("tcl" ,tcl)
;; When cross-compiling, some of the natively-built tools require all
;; these libraries.
,@(if (%current-target-system)
`(("zlib/native" ,zlib)
("libjpeg/native" ,libjpeg-turbo))
`(("fontconfig" ,fontconfig)
("freetype" ,freetype)
("gs-fonts" ,gs-fonts)
("jbig2dec" ,jbig2dec)
("libjpeg" ,libjpeg-turbo)
("libpaper" ,libpaper)
("libpng" ,libpng)
("libtiff" ,libtiff)
("zlib" ,zlib)))
(synopsis "PostScript and PDF interpreter")
"Ghostscript is an interpreter for the PostScript language and the PDF
file format. It also includes a C library that implements the graphics
capabilities of the PostScript language. It supports a wide variety of
output file formats and printers.")
(home-page "")
(license license:agpl3+)))
(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 ghostscript/cups
(package/inherit ghostscript
(name "ghostscript-with-cups")
(inputs `(("cups" ,cups-minimal)
,@(package-inputs ghostscript)))))
(define-public ijs
(name "ijs")
(version (package-version ghostscript))
(source (package-source ghostscript))
(build-system gnu-build-system)
`(("libtool" ,libtool)
("automake" ,automake)
("autoconf" ,autoconf)))
(modify-phases %standard-phases
(add-after 'unpack 'autogen
(lambda _
;; need to regenerate macros
(system* "autoreconf" "-if")
;; do not run configure
(substitute* ""
(("^.*\\$srcdir/configure.*") ""))
(system* "bash" "")
;; create configure script in ./ijs/
(chdir "ijs")
;; do not run configure
(substitute* ""
(("^.*\\$srcdir/configure.*") "")
(("^ + && echo Now type.*$") ""))
(invoke "bash" ""))))))
(synopsis "IJS driver framework for inkjet and other raster devices")
"IJS is a protocol for transmission of raster page images. This package
provides the reference implementation of the raster printer driver
(license license:expat)
(home-page (package-home-page ghostscript))))
(define-public gs-fonts
(name "gs-fonts")
(version "8.11")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
(sha256 (base32
(build-system gnu-build-system)
`(#:tests? #f ; nothing to check, just files to copy
#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(dir (string-append out "/share/fonts/type1/ghostscript")))
(mkdir-p dir)
(lambda (file)
(copy-file file (string-append dir "/" file)))
(find-files "." "pfb|afm"))
(synopsis "Free replacements for the PostScript fonts")
"Ghostscript fonts provides fonts and font metrics customarily distributed with
Ghostscript. It currently includes the 35 standard PostScript fonts.")
(license license:gpl2)
(home-page "")))
(define-public libspectre
(name "libspectre")
(version "0.2.8")
(source (origin
(method url-fetch)
(uri (string-append ""
version ".tar.gz"))
(sha256 (base32
(build-system gnu-build-system)
(inputs `(("ghostscript" ,ghostscript)))
(native-inputs `(("pkg-config" ,pkg-config)))
(synopsis "Postscript rendering library")
"libspectre is a small library for rendering Postscript documents.
It provides a convenient easy to use API for handling and rendering
Postscript documents.")
(license license:gpl2+)
(home-page "")))