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