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