The fonts in pcl/urwfonts and the jpegxr library are non-free.
Autogenerated files are removed as well.
Due to a circular dependency with python-sphinx, the documentation is not
built.
* gnu/packages/ghostscript.scm (ghostscript)[source]: Use git-fetch. Adjust
snippet. Replace patches.
[outputs]: Delete field.
[arguments]<configure-flags>: Add "--without-xps". Remove "--enable-dynamic".
<#:phases>: Add 'unbundle' and 'generate-scfdtab' phases.
[native-inputs]: Add autoconf and automake.
[inputs]: Add extract, ijs, lcms2mt, memento and openjpeg.
[license]: Add missing licenses.
(ghostscript/fixed): Delete variable.
* gnu/packages/patches/ghostscript-CVE-2023-36664.patch: Delete file.
* gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch: Delete file.
* gnu/packages/patches/ghostscript-leptonica-hurd.patch: Delete file.
* gnu/packages/patches/ghostscript-no-header-creationdate.patch: Delete file.
* gnu/packages/patches/ghostscript-no-header-id.patch: Delete file.
* gnu/packages/patches/ghostscript-no-header-uuid.patch: Delete file.
* gnu/packages/patches/ghostscript-reproducibility.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
---
gnu/local.mk | 7 +-
gnu/packages/ghostscript.scm | 142 +++++++++++++-----
.../ghostscript-CVE-2023-36664-fixup.patch | 56 -------
.../patches/ghostscript-CVE-2023-36664.patch | 142 ------------------
.../patches/ghostscript-leptonica-hurd.patch | 78 ----------
.../ghostscript-no-header-creationdate.patch | 46 ------
.../patches/ghostscript-no-header-id.patch | 57 -------
.../patches/ghostscript-no-header-uuid.patch | 49 ------
.../patches/ghostscript-reproducibility.patch | 26 ++++
9 files changed, 129 insertions(+), 474 deletions(-)
delete mode 100644 gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
delete mode 100644 gnu/packages/patches/ghostscript-CVE-2023-36664.patch
delete mode 100644 gnu/packages/patches/ghostscript-leptonica-hurd.patch
delete mode 100644 gnu/packages/patches/ghostscript-no-header-creationdate.patch
delete mode 100644 gnu/packages/patches/ghostscript-no-header-id.patch
delete mode 100644 gnu/packages/patches/ghostscript-no-header-uuid.patch
create mode 100644 gnu/packages/patches/ghostscript-reproducibility.patch
Toggle diff (337 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 2fc14e68fe..c44c21ffa0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1338,12 +1338,7 @@ dist_patch_DATA = \
%D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch \
%D%/packages/patches/ghc-memory-fix-32bit.patch \
%D%/packages/patches/ghc-persistent-fix-32bit.patch \
- %D%/packages/patches/ghostscript-CVE-2023-36664.patch \
- %D%/packages/patches/ghostscript-CVE-2023-36664-fixup.patch \
- %D%/packages/patches/ghostscript-leptonica-hurd.patch \
- %D%/packages/patches/ghostscript-no-header-id.patch \
- %D%/packages/patches/ghostscript-no-header-uuid.patch \
- %D%/packages/patches/ghostscript-no-header-creationdate.patch \
+ %D%/packages/patches/ghostscript-reproducibility.patch \
%D%/packages/patches/git-filter-repo-generate-doc.patch \
%D%/packages/patches/gklib-suitesparse.patch \
%D%/packages/patches/glib-appinfo-watch.patch \
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 40891676b3..2bc168db68 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -215,43 +215,61 @@ (define-public psutils
(define-public ghostscript
(package
(name "ghostscript")
- (version "9.56.1")
- (replacement ghostscript/fixed)
+ (version "10.03.1")
(source
(origin
- (method url-fetch)
- (uri (string-append "https://github.com/ArtifexSoftware/"
- "ghostpdl-downloads/releases/download/gs"
- (string-delete #\. version)
- "/ghostscript-" version ".tar.xz"))
+ (method git-fetch)
+ (uri (git-reference
+ (url "git://git.ghostscript.com/ghostpdl.git")
+ (commit (string-append "ghostpdl-" version))))
+ (file-name (git-file-name name version))
(sha256
(base32
- "1r5qash65m6ignki6z72q4rlai9ka99xrxnmqd19n02has00cd6l"))
- (patches (search-patches "ghostscript-no-header-creationdate.patch"
- "ghostscript-no-header-id.patch"
- "ghostscript-no-header-uuid.patch"))
+ "1rzgk12vmv3062l8w7vw5kdsgfphmpwbq38alv2qgiz5wpalsrds"))
+ (patches (search-patches "ghostscript-reproducibility.patch"))
(modules '((guix build utils)))
(snippet
- ;; 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"
- "libpng" "tiff" "zlib"))))))
+ (for-each
+ delete-file-recursively
+ (append
+ (list
+ ;; Bundled software (some non-free)
+ "cups" "expat" "freetype" "ijs" "jbig2dec" "jpeg" "jpegxr"
+ "lcms2mt" "libpng" "openjpeg" "pcl" "tiff" "xps" "zlib"
+ ;; Non-free ICC profile
+ "doc/language-bindings/images"
+ ;; Contain autogenerated files
+ "demos/csharp/windows"
+ "toolbin/Acrobat2Tiff"
+ "base/scfdtab.c"
+ "demos/java/jni/gs_jni/com_artifex_gsjava_util_NativePointer.h"
+ "demos/java/jni/gs_jni/com_artifex_gsjava_GSAPI.h"
+ "doc/GS9_Color_Management.pdf"
+ "doc/Ghostscript.pdf"
+ "doc/pclxps/ghostpdl.pdf")
+ (find-files "doc/src/_static" "cm-fig.*\\.png")))
+ (for-each
+ (lambda (name)
+ (delete-file (string-append "arch/" name)))
+ '("osx-x86-x86_64-ppc-gcc.h"
+ "windows-arm-msvc.h"
+ "windows-x64-msvc.h"
+ "windows-x86-msvc.h"))
+ (delete-file "base/memento.c")
+ (delete-file "base/memento.h")))))
(build-system gnu-build-system)
- (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
(arguments
(list
- #:disallowed-references '("doc")
#:configure-flags
#~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
"--with-system-libtiff"
+ ;; Requires jpegxr, which has a nonfree license.
+ "--without-xps"
"LIBS=-lz"
(string-append "ZLIBDIR="
(dirname (search-input-file %build-inputs
"include/zlib.h")))
- "--enable-dynamic"
"--disable-compile-inits"
(string-append "--with-fontpath="
(search-input-directory
@@ -270,16 +288,19 @@ (define-public ghostscript
'()))
#:phases
#~(modify-phases %standard-phases
- #$@(if (target-hurd?)
- #~((add-after 'unpack 'patch-leptonica
- (lambda _
- (let ((patch-file
- #$(local-file
- (search-patch
- "ghostscript-leptonica-hurd.patch"))))
- (with-directory-excursion "leptonica"
- (invoke "patch" "--force" "-p1" "-i" patch-file))))))
- #~())
+ (add-after 'unpack 'unbundle
+ (lambda _
+ (substitute* '("base/lib.mak" "base/tiff.mak"
+ "devices/dcontrib.mak" "devices/devs.mak"
+ "psi/int.mak")
+ ((".*:\\$\\(GLSRC\\)memento\\.h".*) ""))
+ (substitute* "base/lib.mak"
+ ((" \\$\\(GLOBJ\\)memento\\.\\$\\(OBJ\\)") ""))))
+ (add-before 'bootstrap 'patch-autogen
+ (lambda _
+ (substitute* "autogen.sh"
+ (("^autoreconf.*" orig)
+ (string-append orig "\nexit\n")))))
(add-before 'configure 'create-output-directory
(lambda _
;; The configure script refuses to function if the directory
@@ -287,7 +308,6 @@ (define-public ghostscript
(mkdir-p (string-append #$output "/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"
@@ -305,6 +325,25 @@ (define-public ghostscript
(("^AUXEXTRALIBS=(.*)$" _ value)
(string-append "AUXEXTRALIBS = -lz " value "\n"))))))
'())
+ (add-before 'build 'generate-scfdtab
+ (lambda _
+ (invoke "make" "obj/arch.h")
+ ;; These changes are necessary for cross builds, where there can
+ ;; be a conflict for int64_t.
+ (with-directory-excursion "base"
+ (copy-file "scommon.h" "tmpfile")
+ (substitute* "scommon.h"
+ ((".*#include \"stdint_\\.h\".*") ""))
+ (let ((include-path (getenv "C_INCLUDE_PATH")))
+ ;; For cross builds
+ (setenv "C_INCLUDE_PATH"
+ (string-append #$(this-package-input "memento")
+ "/include"))
+ (invoke "gcc" "-Dfopen=fopen" "-I../obj"
+ "scfdgen.c" "scfetab.c" "-o" "scfdgen")
+ (setenv "C_INCLUDE_PATH" include-path))
+ (rename-file "tmpfile" "scommon.h")
+ (invoke "./scfdgen"))))
(replace 'build
(lambda _
;; Build 'libgs.so', but don't build the statically-linked 'gs'
@@ -320,7 +359,9 @@ (define-public ghostscript
(symlink "gsc" (string-append #$output "/bin/gs")))))))
(native-inputs
(append
- (list perl
+ (list autoconf
+ automake
+ perl
pkg-config ;needed for freetype
python-minimal-wrapper
tcl)
@@ -330,14 +371,19 @@ (define-public ghostscript
(list zlib libjpeg-turbo)
'())))
(inputs
- (list fontconfig
+ (list extract
+ fontconfig
freetype
font-ghostscript
+ ijs
jbig2dec
+ lcms2mt
libjpeg-turbo
libpaper
libpng
libtiff
+ memento
+ openjpeg
zlib))
(synopsis "PostScript and PDF interpreter")
(description
@@ -346,13 +392,29 @@ (define-public ghostscript
capabilities of the PostScript language. It supports a wide variety of
output file formats and printers.")
(home-page "https://www.ghostscript.com/")
- (license license:agpl3+)))
-
-(define ghostscript/fixed
- (package-with-patches
- ghostscript
- (search-patches "ghostscript-CVE-2023-36664.patch"
- "ghostscript-CVE-2023-36664-fixup.patch")))
+ (license
+ (list
+ ;; Most of the code is distributed under the AGPLv3+.
+ license:agpl3+
+ ;; Some files (or parts of files) are distributed under other,
+ ;; compatible licenses.
+ (license:non-copyleft "file://devices/gdev4693.c")
+ (license:non-copyleft "file://devices/gdevifno.c")
+ (license:non-copyleft "file://base/icc34.h")
+ (license:non-copyleft "file://base/CMap/78-EUC-H")
+ license:asl2.0
+ license:bsd-3
+ license:expat
+ license:freetype
+ license:gpl1+
+ license:gpl2+
+ license:isc
+ license:lgpl2.1
+ license:public-domain
+ license:zlib
+ ;; Additional exception for the font files in Resource/Font for
+ ;; inclusion in Postscript and PDF files.
+ (license:non-copyleft "file://LICENSE")))))
(define-public ghostscript/x
(package/inherit ghostscript
diff --git a/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch b/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
deleted file mode 100644
index c2a222701f..0000000000
--- a/gnu/packages/patches/ghostscript-CVE-2023-36664-fixup.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0974e4f2ac0005d3731e0b5c13ebc7e965540f4d Mon Sep 17 00:00:00 2001
-From: Chris Liddell <chris.liddell@artifex.com>
-Date: Wed, 14 Jun 2023 09:08:12 +0100
-Subject: [PATCH] Bug 706778: 706761 revisit
-
-Two problems with the original commit. The first a silly typo inverting the
-logic of a test.
-
-The second was forgetting that we actually actually validate two candidate
-strings for pipe devices. One with the expected "%pipe%" prefix, the other
-using the pipe character prefix: "|".
-
-This addresses both those.
----
- base/gpmisc.c | 2 +-
- base/gslibctx.c | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/base/gpmisc.c b/base/gpmisc.c
-index 58511270e..2b0064bea 100644
---- a/base/gpmisc.c
-+++ b/base/gpmisc.c
-@@ -1081,7 +1081,7 @@ gp_validate_path_len(const gs_memory_t *mem,
- /* "%pipe%" do not follow the normal rules for path definitions, so we
- don't "reduce" them to avoid unexpected results
- */
-- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
-+ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
- bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path");
- if (buffer == NULL)
- return gs_error_VMerror;
-diff --git a/base/gslibctx.c b/base/gslibctx.c
-index d2a1aa91d..42af99090 100644
---- a/base/gslibctx.c
-+++ b/base/gslibctx.c
-@@ -743,7 +743,7 @@ gs_add_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, co
- /* "%pipe%" do not follow the normal rules for path definitions, so we
- don't "reduce" them to avoid unexpected results
- */
-- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
-+ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
- buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len");
- if (buffer == NULL)
- return gs_error_VMerror;
-@@ -850,7 +850,7 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type,
- /* "%pipe%" do not follow the normal rules for path definitions, so we
- don't "reduce" them to avoid unexpected results
- */
-- if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
-+ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) {
- buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len");
- if (buffer == NULL)
- return gs_error_VMerror;
---
-2.34.1
-
diff --git a/gnu/packages/patches/ghostscript-CVE-2023-36664.patch b/gnu/packages/patches/ghostscript-CVE-2023-36664.patch
deleted file mode 100644
index e9c53c1f87..0000000000
--- a/gnu/packages/patches/ghostscript-CVE-2023-36664.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From 505eab7782b429017eb434b2b95120855f2b0e3c Mon Sep 17 00:00:00 2001
-From: Chris Liddell <chris.liddell@artifex.com>
-Date: Wed, 7 Jun 2023 10:23:06 +0100
-Subject: [PATCH] Bug 706761: Don't "reduce" %pipe% file names for permission
- validation
-
-For regular file names, we try to simplfy relative paths before we use them.
-
-Because the %pipe% device can, effectively, accept command line calls, we
-shouldn't be simplifying that string, because the command line syntax can end
-up confusing the path simplifying code. That can result in permitting a pipe
-command which does not match what was originally permitted.
-
-Special case "%pipe" in the validation code so we always deal with the entire
-string.
----
- base/gpmisc.c | 31 +++++++++++++++++++--------
- base/gslibctx.c | 56 ++++++++++++++++++++++++++++++++++++-------------
- 2 files changed, 64 insertions(+), 23 deletions(-)
-
-diff --git a/base/gpmisc.c b/base/gpmisc.c
-index 5f39ebba7..2fb87f769 100644
---- a/base/gpmisc.c
-+++ b/base/gpmisc.c
-@@ -1076,16 +1076,29 @@ gp_validate_path_len(const gs_memory_t *mem,
- && !memcmp(path + cdirstrl, dirsepstr, dirsepstrl)) {
- prefix_len = 0;
- }
-- rlen = len+1;
-- bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path");
-- if (bufferfull == NULL)
-- return gs_error_VMerror;
--
-- buffer = bufferfull + prefix_len;
-- if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success)
-- return gs_error_invalidfileaccess;
-- buffer[rlen] = 0;
-
-+ /* "%pipe%" do not follow the normal rules for path definitions, so we
-+ don't "reduce" them to avoid unexpected results
-+ */
-+ if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
-+ bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path");
-+ if (buffer == NULL)
-+ return gs_error_VMerror;
-+ memcpy(buffer, path, len);
-+ buffer[len] = 0;
-+ rlen = len;
-+ }
-+ else {
-+ rlen = len+1;
-+ bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path");
-+ if (bufferfull == NULL)
-+ return gs_error_VMerror;
-+
-+ buffer = bufferfull + prefix_len;
-+ if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success)
-+ return gs_error_invalidfileaccess;
-+ buffer[rlen] = 0;
-+ }
- while (1) {
- switch (mode[0])
- {
-diff --git a/base/gslibctx.c b/base/gslibctx.c
-index eb566ed06..d2a1aa91d 100644
---- a/base/gslibctx.c
-+++ b/base/gslibctx.c
-@@ -740,14 +740,28 @@ gs_add_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, co
- return gs_error_rangecheck;
- }
-
-- rlen = len+1;
-- buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gp_validate_path");
-- if (buffer == NULL)
-- return gs_error_VMerror;
-+ /* "%pipe%" do not follow the normal rules for path definitions, so we
-+ don't "reduce" them to avoid unexpected results
-+ */
-+ if (len > 5 && memcmp(path, "%pipe", 5) != 0) {
-+ buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len");
-+ if (buffer == NULL)
-+ return gs_error_VMerror;
-+ memcpy(buffer, path, len);
-+ buffer[len] = 0;
-+ rlen = len;
-+ }
-+ else {
-+ rlen = len + 1;
-
-- if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success)
-- return gs_error_invalidfileaccess;
-- buffer[rlen] = 0;
-+ buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gs_add_control_path_len");
-+ if (buffer == NULL)
-+ return gs_error_VMerror;
-+
-+ if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success)
-+ return gs_error_invalidfileaccess;
-+ buffer[rlen] = 0;
-+ }
-
- n = control->num;
- for (i = 0; i < n; i++)
-@@ -833,14 +847,28 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type,
- return gs_error_rangecheck;
- }
-
-- rlen = len+1;
-- buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gp_validate_path");
-- if (buffer == NULL)
-- return gs_error_VMerror;
-+ /* "%pipe%" do not follow the normal rules for path definitions, so we
-+