blob: 59cc560cf8915995a3026db4a321125a63a89703 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "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 = "GPLv3"
14LIC_FILES_CHKSUM = "file://LICENSE;md5=70dc2bac4d0ce4448da873cd86b123fc"
15
16DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng"
Patrick Williams213cb262021-08-07 19:21:33 -050017DEPENDS:class-native = "libpng-native"
Andrew Geissler82c905d2020-04-13 13:39:40 -050018
19UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases"
20UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.tar"
21
William A. Kennington IIIac69b482021-06-02 12:28:27 -070022# 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_WHITELIST += "CVE-2013-6629"
25
Andrew Geissler4b740dc2020-05-05 08:54:39 -050026def 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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050031 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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050036"
37
38SRC_URI = "${SRC_URI_BASE} \
39 file://ghostscript-9.21-prevent_recompiling.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050040 file://cups-no-gcrypt.patch \
41 "
42
Patrick Williams213cb262021-08-07 19:21:33 -050043SRC_URI:class-native = "${SRC_URI_BASE} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050044 file://ghostscript-9.21-native-fix-disable-system-libtiff.patch \
45 file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \
46 "
47
Andrew Geisslerc926e172021-05-07 16:11:35 -050048SRC_URI[sha256sum] = "0646bb97f6f4d10a763f4919c54fa28b4fbdd3dff8e7de3410431c81762cade0"
Andrew Geissler82c905d2020-04-13 13:39:40 -050049
50# Put something like
51#
Patrick Williams213cb262021-08-07 19:21:33 -050052# PACKAGECONFIG:append:pn-ghostscript = " x11"
Andrew Geissler82c905d2020-04-13 13:39:40 -050053#
54# in local.conf to enable building with X11. Be careful. The order
55# of the overrides matters!
56#
57#PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -050058PACKAGECONFIG:class-native = ""
Andrew Geissler82c905d2020-04-13 13:39:40 -050059
60PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR}, \
61 --without-x, virtual/libx11 libxext libxt gtk+3\
62 "
63
64EXTRA_OECONF = "--without-libpaper --with-system-libtiff --without-jbig2dec \
65 --with-fontpath=${datadir}/fonts \
66 --without-libidn --with-cups-serverbin=${exec_prefix}/lib/cups \
67 --with-cups-datadir=${datadir}/cups \
68 CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \
69 "
70
Patrick Williams213cb262021-08-07 19:21:33 -050071EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0"
Andrew Geissler82c905d2020-04-13 13:39:40 -050072
73# Explicity disable libtiff, fontconfig,
74# freetype, cups for ghostscript-native
Patrick Williams213cb262021-08-07 19:21:33 -050075EXTRA_OECONF:class-native = "--without-x --with-system-libtiff=no \
Andrew Geissler82c905d2020-04-13 13:39:40 -050076 --without-jbig2dec --without-libpaper \
77 --with-fontpath=${datadir}/fonts \
78 --without-libidn --disable-fontconfig \
Andrew Geissler4b740dc2020-05-05 08:54:39 -050079 --enable-freetype --disable-cups "
Andrew Geissler82c905d2020-04-13 13:39:40 -050080
81# This has been fixed upstream but for now we need to subvert the check for time.h
82# http://bugs.ghostscript.com/show_bug.cgi?id=692443
83# http://bugs.ghostscript.com/show_bug.cgi?id=692426
84CFLAGS += "-DHAVE_SYS_TIME_H=1"
85BUILD_CFLAGS += "-DHAVE_SYS_TIME_H=1"
86
Andrew Geissler4b740dc2020-05-05 08:54:39 -050087inherit autotools-brokensep
Andrew Geissler82c905d2020-04-13 13:39:40 -050088
Patrick Williams213cb262021-08-07 19:21:33 -050089do_configure:prepend:class-target () {
Andrew Geissler6ce62a22020-11-30 19:58:47 -060090 rm -rf ${S}/jpeg/
91}
92
Patrick Williams213cb262021-08-07 19:21:33 -050093do_configure:append () {
Andrew Geissler82c905d2020-04-13 13:39:40 -050094 # copy tools from the native ghostscript build
95 if [ "${PN}" != "ghostscript-native" ]; then
96 mkdir -p obj/aux soobj
97 for i in genarch genconf mkromfs echogs gendev genht packps; do
98 cp ${STAGING_BINDIR_NATIVE}/ghostscript-${PV}/$i obj/aux/$i
99 done
100 fi
101}
102
Patrick Williams213cb262021-08-07 19:21:33 -0500103do_install:append () {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500104 mkdir -p ${D}${datadir}/ghostscript/${PV}/
105 cp -r ${S}/Resource ${D}${datadir}/ghostscript/${PV}/
106 cp -r ${S}/iccprofiles ${D}${datadir}/ghostscript/${PV}/
107}
108
Patrick Williams213cb262021-08-07 19:21:33 -0500109do_compile:class-native () {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500110 mkdir -p obj
111 for i in genarch genconf mkromfs echogs gendev genht packps; do
112 oe_runmake obj/aux/$i
113 done
114}
115
Patrick Williams213cb262021-08-07 19:21:33 -0500116do_install:class-native () {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500117 install -d ${D}${bindir}/ghostscript-${PV}
118 for i in genarch genconf mkromfs echogs gendev genht packps; do
119 install -m 755 obj/aux/$i ${D}${bindir}/ghostscript-${PV}/$i
120 done
121}
122
123BBCLASSEXTEND = "native"
124
125# ghostscript does not supports "arc"
126COMPATIBLE_HOST = "^(?!arc).*"
127
128# some entries in NVD uses gpl_ghostscript
129CVE_PRODUCT = "ghostscript gpl_ghostscript"