blob: 4cdb6e00d818a5900800ee7b6dfb10d3edba2b05 [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"
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
Andrew Geissler4b740dc2020-05-05 08:54:39 -050022def gs_verdir(v):
23 return "".join(v.split("."))
24
25
26SRC_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 -050027 file://ghostscript-9.15-parallel-make.patch \
28 file://ghostscript-9.16-Werror-return-type.patch \
29 file://do-not-check-local-libpng-source.patch \
30 file://avoid-host-contamination.patch \
31 file://mkdir-p.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050032"
33
34SRC_URI = "${SRC_URI_BASE} \
35 file://ghostscript-9.21-prevent_recompiling.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050036 file://cups-no-gcrypt.patch \
37 "
38
39SRC_URI_class-native = "${SRC_URI_BASE} \
40 file://ghostscript-9.21-native-fix-disable-system-libtiff.patch \
41 file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \
42 "
43
Andrew Geissler4b740dc2020-05-05 08:54:39 -050044SRC_URI[md5sum] = "0f6964ab9b83a63b7e373f136243f901"
45SRC_URI[sha256sum] = "c2501d8e8e0814c4a5aa7e443e230e73d7af7f70287546f7b697e5ef49e32176"
Andrew Geissler82c905d2020-04-13 13:39:40 -050046
47# Put something like
48#
49# PACKAGECONFIG_append_pn-ghostscript = " x11"
50#
51# in local.conf to enable building with X11. Be careful. The order
52# of the overrides matters!
53#
54#PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
55PACKAGECONFIG_class-native = ""
56
57PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR}, \
58 --without-x, virtual/libx11 libxext libxt gtk+3\
59 "
60
61EXTRA_OECONF = "--without-libpaper --with-system-libtiff --without-jbig2dec \
62 --with-fontpath=${datadir}/fonts \
63 --without-libidn --with-cups-serverbin=${exec_prefix}/lib/cups \
64 --with-cups-datadir=${datadir}/cups \
65 CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \
66 "
67
68EXTRA_OECONF_append_mipsarcho32 = " --with-large_color_index=0"
69
70# Explicity disable libtiff, fontconfig,
71# freetype, cups for ghostscript-native
72EXTRA_OECONF_class-native = "--without-x --with-system-libtiff=no \
73 --without-jbig2dec --without-libpaper \
74 --with-fontpath=${datadir}/fonts \
75 --without-libidn --disable-fontconfig \
Andrew Geissler4b740dc2020-05-05 08:54:39 -050076 --enable-freetype --disable-cups "
Andrew Geissler82c905d2020-04-13 13:39:40 -050077
78# This has been fixed upstream but for now we need to subvert the check for time.h
79# http://bugs.ghostscript.com/show_bug.cgi?id=692443
80# http://bugs.ghostscript.com/show_bug.cgi?id=692426
81CFLAGS += "-DHAVE_SYS_TIME_H=1"
82BUILD_CFLAGS += "-DHAVE_SYS_TIME_H=1"
83
Andrew Geissler4b740dc2020-05-05 08:54:39 -050084inherit autotools-brokensep
Andrew Geissler82c905d2020-04-13 13:39:40 -050085
86do_configure_append () {
87 # copy tools from the native ghostscript build
88 if [ "${PN}" != "ghostscript-native" ]; then
89 mkdir -p obj/aux soobj
90 for i in genarch genconf mkromfs echogs gendev genht packps; do
91 cp ${STAGING_BINDIR_NATIVE}/ghostscript-${PV}/$i obj/aux/$i
92 done
93 fi
94}
95
96do_install_append () {
97 mkdir -p ${D}${datadir}/ghostscript/${PV}/
98 cp -r ${S}/Resource ${D}${datadir}/ghostscript/${PV}/
99 cp -r ${S}/iccprofiles ${D}${datadir}/ghostscript/${PV}/
100}
101
102do_compile_class-native () {
103 mkdir -p obj
104 for i in genarch genconf mkromfs echogs gendev genht packps; do
105 oe_runmake obj/aux/$i
106 done
107}
108
109do_install_class-native () {
110 install -d ${D}${bindir}/ghostscript-${PV}
111 for i in genarch genconf mkromfs echogs gendev genht packps; do
112 install -m 755 obj/aux/$i ${D}${bindir}/ghostscript-${PV}/$i
113 done
114}
115
116BBCLASSEXTEND = "native"
117
118# ghostscript does not supports "arc"
119COMPATIBLE_HOST = "^(?!arc).*"
120
121# some entries in NVD uses gpl_ghostscript
122CVE_PRODUCT = "ghostscript gpl_ghostscript"