From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Re: Switching to Artifex Ghostscript Date: Mon, 29 May 2017 13:50:13 -0400 Message-ID: <20170529175013.GA13897@jasmine> References: <20170520205523.GA27152@jasmine> <87k25b5h5d.fsf@fastmail.com> <87vaougxzy.fsf@elephly.net> <87inkr8fui.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFOo8-0003Yn-Mm for guix-devel@gnu.org; Mon, 29 May 2017 13:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFOo4-0006HL-IH for guix-devel@gnu.org; Mon, 29 May 2017 13:50:20 -0400 Content-Disposition: inline In-Reply-To: <87inkr8fui.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?iso-8859-1?Q?Court=E8s?= Cc: guix-devel@gnu.org --uQr8t48UFsdbeI+V Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 23, 2017 at 10:42:45PM +0200, Ludovic Court=E8s wrote: > Ricardo Wurmus skribis: > > Marius Bakke writes: > >> Leo Famulari writes: > >>> Both programs are distributed under the AGPL, as far as I can tell. B= ut > >>> Artifex Ghostscript is actively developed, which I think is very > >>> important for C software that is designed to handle untrusted input. > >> > >> Thanks for bringing this up. GNU Ghostscript seemed to go > >> mostly-inactive[0] after Artifex changed to AGPL in 2013[1]. The latest > >> "upstream" release is 9.21[2], we have 9.14.0 (from 2014!). > >> > >> I'm in favor of switching to the active fork. > > > > Me too. In fact, I once tried to package Artifex Ghostscript, but > > failed in the attempt to unbundle libraries. >=20 > Ditto. In the discussion you mentioned above, Didier Link of > GNU=A0Ghostscript did not really address our concerns. Here are patches that allow you build groff, cairo, and cups with the Artifex Ghostscript. I didn't take the step of replacing the GNU Ghostscript yet. --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-gnu-Add-Artifex-Ghostscript.patch" Content-Transfer-Encoding: quoted-printable =46rom da63a583441ac70adea4f6668f0fd7a8424991c2 Mon Sep 17 00:00:00 2001 =46rom: Leo Famulari Date: Mon, 29 May 2017 13:47:39 -0400 Subject: [PATCH 1/3] gnu: Add Artifex Ghostscript. * gnu/packages/ghostscript.scm (artifex-ghostscript): New variable. * gnu/packages/patches/artifex-ghostscript-runpath.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/ghostscript.scm | 100 +++++++++++++++++= ++++ .../patches/artifex-ghostscript-runpath.patch | 18 ++++ 3 files changed, 119 insertions(+) create mode 100644 gnu/packages/patches/artifex-ghostscript-runpath.patch diff --git a/gnu/local.mk b/gnu/local.mk index e811e9a0b..283cae208 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -504,6 +504,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/antiword-CVE-2014-8123.patch \ %D%/packages/patches/apr-skip-getservbyname-test.patch \ %D%/packages/patches/artanis-fix-Makefile.in.patch \ + %D%/packages/patches/artifex-ghostscript-runpath.patch \ %D%/packages/patches/aspell-default-dict-dir.patch \ %D%/packages/patches/ath9k-htc-firmware-binutils.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc.patch \ diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm index 1cb651c96..f0d96bb31 100644 --- a/gnu/packages/ghostscript.scm +++ b/gnu/packages/ghostscript.scm @@ -24,6 +24,7 @@ (define-module (gnu packages ghostscript) #:use-module (gnu packages) #:use-module (gnu packages autotools) + #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages fontutils) #:use-module (gnu packages image) @@ -31,6 +32,8 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages tcl) + #:use-module (gnu packages tls) + #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) @@ -127,6 +130,103 @@ printing, and psresize, for adjusting page sizes.") "See LICENSE in the distribution.")) (home-page "http://knackered.org/angus/psutils/"))) =20 +(define-public artifex-ghostscript + (package + (name "artifex-ghostscript") + (version "9.21") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/ArtifexSoftware/" + "ghostpdl-downloads/releases/download/gs" + (string-delete #\. version) + "/ghostscript-" version ".tar.xz")) + (sha256 + (base32 + "0lyhjcrkmd5fcmh8h56bs4xr9k4jasmikv5vsix1hd4ai0ad1q9b")) + (patches (search-patches "artifex-ghostscript-runpath.patch" + ;; TODO: + ;;"ghostscript-CVE-2017-8291.patch" + )) + (modules '((guix build utils))) + (snippet + ;; Remove bundled libraries. + ;; TODO Try unbundling ijs, which is developed alongside Ghostsc= ript. + '(begin + (for-each delete-file-recursively '("freetype" "jbig2dec" "jpe= g" + "lcms2" "libpng" + ;;"openjpeg" ; Patched for= k. + "tiff" "zlib")))))) + (build-system gnu-build-system) + (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + exa= mples + (arguments + `(#:disallowed-references ("doc") + #:configure-flags + (list "--with-system-libtiff" + "LIBS=3D-lz" + (string-append "ZLIBDIR=3D" + (assoc-ref %build-inputs "zlib") "/include") + "--enable-dynamic") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-doc-dir + (lambda _ + ;; Honor --docdir. + (substitute* "Makefile.in" + (("^docdir=3D.*$") "docdir =3D @docdir@\n") + (("^exdir=3D.*$") "exdir =3D $(docdir)/examples\n")) + #t)) + (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\"")) + #t)) + (add-after 'configure 'patch-config-files + (lambda _ + (substitute* "base/unixhead.mak" + (("/bin/sh") (which "sh"))) + #t)) + (replace 'build + (lambda _ + ;; Build 'libgs.so', but don't build the statically-linked 'g= s' + ;; binary (saves 22 MiB). + (zero? (system* "make" "so" "-j" + (number->string (parallel-job-count)))))) + (replace 'install + (lambda _ + (zero? (system* "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")) + #t)))))) + (native-inputs + `(("perl" ,perl) + ("python" ,python-wrapper) + ("tcl" ,tcl))) + (inputs + `(("freetype" ,freetype) + ("jbig2dec" ,jbig2dec) + ("lcms2" ,lcms) + ("libjpeg" ,libjpeg) + ("libpaper" ,libpaper) + ("libpng" ,libpng) + ("libtiff" ,libtiff) + ("zlib" ,zlib))) + (synopsis "PostScript and PDF interpreter") + (description + "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 "https://www.ghostscript.com/") + (license license:agpl3+))) + (define-public ghostscript (package (name "ghostscript") diff --git a/gnu/packages/patches/artifex-ghostscript-runpath.patch b/gnu/p= ackages/patches/artifex-ghostscript-runpath.patch new file mode 100644 index 000000000..9f161e45b --- /dev/null +++ b/gnu/packages/patches/artifex-ghostscript-runpath.patch @@ -0,0 +1,18 @@ +diff --git a/base/unix-dll.mak b/base/unix-dll.mak +index 9d57a99..36ef1ff 100644 +--- a/base/unix-dll.mak ++++ b/base/unix-dll.mak +@@ -171,11 +171,11 @@ gpdl-so-links-subtarget: $(GPDL_SO) $(UNIX_DLL_MAK) = $(MAKEDIRS) + # Build the small Ghostscript loaders, with Gtk+ and without + $(GSSOC_XE): gs-so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) = $(MAKEDIRS) + $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \ +- -L$(BINDIR) -l$(GS_SO_BASE) ++ -L$(BINDIR) -l$(GS_SO_BASE) -Wl,-rpath=3D$(libdir) +=20 + $(GSSOX_XE): gs-so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) = $(MAKEDIRS) + $(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \ +- -L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS) ++ -L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS) -Wl,-rpath=3D$(libdir) +=20 + $(PCLSOC_XE): gpcl6-so-links-subtarget $(PLSRC)$(REALMAIN_SRC).c $(UNIX_D= LL_MAK) $(MAKEDIRS) + $(GLCC) -g -o $(PCLSOC_XE) $(PLSRC)$(REALMAIN_SRC).c -L$(BINDIR) -l$(PCL= _SO_BASE) --=20 2.13.0 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="0002-gnu-ijs-Use-modify-phases-syntax.patch" Content-Transfer-Encoding: quoted-printable =46rom 8ee8b63f35909ca1b9cfd89552f08e22f28b5d10 Mon Sep 17 00:00:00 2001 =46rom: Leo Famulari Date: Mon, 29 May 2017 04:42:37 -0400 Subject: [PATCH 2/3] gnu: ijs: Use modify-phases syntax. * gnu/packages/ghostscript.scm (ijs)[arguments]: Use modify-phases. --- gnu/packages/ghostscript.scm | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm index f0d96bb31..1c68a04ff 100644 --- a/gnu/packages/ghostscript.scm +++ b/gnu/packages/ghostscript.scm @@ -5,6 +5,7 @@ ;;; Copyright =A9 2013, 2015, 2016 Ludovic Court=E8s ;;; Copyright =A9 2017 Alex Vong ;;; Copyright =A9 2017 Efraim Flashner +;;; Copyright =A9 2017 Leo Famulari ;;; ;;; This file is part of GNU Guix. ;;; @@ -345,24 +346,22 @@ output file formats and printers.") ("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))) + (modify-phases %standard-phases + (add-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"))))))) (synopsis "IJS driver framework for inkjet and other raster devices") (description "IJS is a protocol for transmission of raster page images. This packa= ge --=20 2.13.0 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0003-gnu-ijs-Update-to-9.21.0-and-switch-to-Artifex-Ghost.patch" Content-Transfer-Encoding: quoted-printable =46rom 35a515a7d2bbd95a45fde81b31201bd48a7e7588 Mon Sep 17 00:00:00 2001 =46rom: Leo Famulari Date: Mon, 29 May 2017 04:43:21 -0400 Subject: [PATCH 3/3] gnu: ijs: Update to 9.21.0 and switch to Artifex Ghostscript source. * gnu/packages/ghostscript.scm (ijs): Update to 9.21.0. [source, version, home-page]: Inherit from artifex-ghostscript. --- gnu/packages/ghostscript.scm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm index 1c68a04ff..8676bafb9 100644 --- a/gnu/packages/ghostscript.scm +++ b/gnu/packages/ghostscript.scm @@ -332,13 +332,8 @@ output file formats and printers.") (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= ")))) + (version (package-version artifex-ghostscript)) + (source (package-source artifex-ghostscript)) (build-system gnu-build-system) (native-inputs `(("libtool" ,libtool) @@ -368,7 +363,7 @@ output file formats and printers.") provides the reference implementation of the raster printer driver architecture.") (license license:expat) - (home-page "https://www.gnu.org/software/ghostscript/"))) + (home-page (package-home-page artifex-ghostscript)))) =20 (define-public gs-fonts (package --=20 2.13.0 --ZPt4rx8FFjLCG7dd-- --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlksX1AACgkQJkb6MLrK fwh9bRAAqIGe0hED72PplKi+bdmhQ/dF3pw/U/TSVDrJ1AB8O1RqMpTi5gcQbKgr ENXWxtoYa8uxAP+NptCf5eDzSf0frsHaH3A5gt0iPvitPJ/9LYWhj3F2qVJTMjXT /U3G0qSWjHEv6FGedQobecL41MYEuxR+irpJLk/I7hYKyqGhLkILFOozMBfm6Q6r NcAfGN+No/KjKl1/Mhjp6d9GjQjFazrojgt1TshA/IexEvfPDjzsdYG51C7kJZLp CAb6UziQ11zQUYqDB9we5R/W6+pJOFDxqIO/7NkH0+zmTwFYuwMVHDC0d2hNnkBa cm3LZobMfsG/JQutKmim0SeTbT4wfkbMk49etotDQFagxKd6InuJUQUDg40HHxfc m2ujVS6/5Mblk62Kr05nh8V8NSEf8FYTFgH9paPldsAWiZwxUAmnQ43yFvhl9ErQ NpxLWQj18iSk9lmlaMtm5u2hW88cspB2kY29mMQD6w6nJCYBFTq5IOfPW5GKLK6g /OzdBpmLNmxVlXbzJy3lQV++DsYqJH2vAk2FxtScwLQFHqmZU5f7CScAWyh/ILk6 y5eACVhHSj2PxqRunNx9QskQJ31Q4FpVRaEbyZdYjtb/uDucDHhmbdIeTB/mwGPv VVPwQeWcHUli3iJ+ui94mm9Rhc/J/8I0w5dJ7FjiajfRl+1oZ6A= =/Ozj -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V--