1SUMMARY = "The GPL Ghostscript PostScript/PDF interpreter" 2DESCRIPTION = "Ghostscript is used for PostScript/PDF preview and printing. Usually as \ 3a back-end to a program such as ghostview, it can display PostScript and PDF \ 4documents in an X11 environment. \ 5\ 6Furthermore, it can render PostScript and PDF files as graphics to be printed \ 7on non-PostScript printers. Supported printers include common \ 8dot-matrix, inkjet and laser models. \ 9" 10HOMEPAGE = "http://www.ghostscript.com" 11SECTION = "console/utils" 12 13LICENSE = "GPL-3.0-only" 14LIC_FILES_CHKSUM = "file://LICENSE;md5=f98ffa763e50cded76f49bce73aade16" 15 16DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng" 17DEPENDS:class-native = "libpng-native" 18 19UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases" 20UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.tar" 21 22# As of ghostscript 9.54.0 the jpeg issue in the CVE is present in the gs jpeg sources 23# however we use an external jpeg which doesn't have the issue. 24CVE_CHECK_IGNORE += "CVE-2013-6629" 25 26def gs_verdir(v): 27 return "".join(v.split(".")) 28 29 30SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \ 31 file://ghostscript-9.15-parallel-make.patch \ 32 file://ghostscript-9.16-Werror-return-type.patch \ 33 file://do-not-check-local-libpng-source.patch \ 34 file://avoid-host-contamination.patch \ 35 file://mkdir-p.patch \ 36 file://CVE-2022-2085.patch \ 37" 38 39SRC_URI = "${SRC_URI_BASE} \ 40 file://ghostscript-9.21-prevent_recompiling.patch \ 41 file://cups-no-gcrypt.patch \ 42 " 43 44SRC_URI:class-native = "${SRC_URI_BASE} \ 45 file://ghostscript-9.21-native-fix-disable-system-libtiff.patch \ 46 file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \ 47 " 48 49SRC_URI[sha256sum] = "31e2064be67e15b478a8da007d96d6cd4d2bee253e5be220703a225f7f79a70b" 50 51# Put something like 52# 53# PACKAGECONFIG:append:pn-ghostscript = " x11" 54# 55# in local.conf to enable building with X11. Be careful. The order 56# of the overrides matters! 57# 58#PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" 59PACKAGECONFIG:class-native = "" 60 61PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR}, \ 62 --without-x, virtual/libx11 libxext libxt gtk+3\ 63 " 64 65EXTRA_OECONF = "--without-libpaper --with-system-libtiff --with-jbig2dec \ 66 --with-fontpath=${datadir}/fonts \ 67 --without-libidn --with-cups-serverbin=${exec_prefix}/lib/cups \ 68 --with-cups-datadir=${datadir}/cups \ 69 CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \ 70 " 71 72EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0" 73 74# Explicity disable libtiff, fontconfig, 75# freetype, cups for ghostscript-native 76EXTRA_OECONF:class-native = "--without-x --with-system-libtiff=no \ 77 --without-jbig2dec --without-libpaper \ 78 --with-fontpath=${datadir}/fonts \ 79 --without-libidn --disable-fontconfig \ 80 --enable-freetype --disable-cups " 81 82# This has been fixed upstream but for now we need to subvert the check for time.h 83# http://bugs.ghostscript.com/show_bug.cgi?id=692443 84# http://bugs.ghostscript.com/show_bug.cgi?id=692426 85CFLAGS += "-DHAVE_SYS_TIME_H=1" 86BUILD_CFLAGS += "-DHAVE_SYS_TIME_H=1" 87 88inherit autotools-brokensep 89 90do_configure:prepend:class-target () { 91 rm -rf ${S}/jpeg/ 92} 93 94do_configure:append () { 95 # copy tools from the native ghostscript build 96 if [ "${PN}" != "ghostscript-native" ]; then 97 mkdir -p obj/aux soobj 98 for i in genarch genconf mkromfs echogs gendev genht packps; do 99 cp ${STAGING_BINDIR_NATIVE}/ghostscript-${PV}/$i obj/aux/$i 100 done 101 fi 102} 103 104do_install:append () { 105 mkdir -p ${D}${datadir}/ghostscript/${PV}/ 106 cp -r ${S}/Resource ${D}${datadir}/ghostscript/${PV}/ 107 cp -r ${S}/iccprofiles ${D}${datadir}/ghostscript/${PV}/ 108} 109 110do_compile:class-native () { 111 mkdir -p obj 112 for i in genarch genconf mkromfs echogs gendev genht packps; do 113 oe_runmake obj/aux/$i 114 done 115} 116 117do_install:class-native () { 118 install -d ${D}${bindir}/ghostscript-${PV} 119 for i in genarch genconf mkromfs echogs gendev genht packps; do 120 install -m 755 obj/aux/$i ${D}${bindir}/ghostscript-${PV}/$i 121 done 122} 123 124BBCLASSEXTEND = "native" 125 126# ghostscript does not supports "arc" 127COMPATIBLE_HOST = "^(?!arc).*" 128 129# some entries in NVD uses gpl_ghostscript 130CVE_PRODUCT = "ghostscript gpl_ghostscript" 131