Files
rpi-buildroot/package/ghostscript/ghostscript.mk
Thomas Perale 2b930c0fab package/ghostscript: fix xlib dependency
Since the package bump to v10.05.0 the xlib libraries detection has been
improved to error missing x libraries (see [2]).

The following error is happening on the autobuilder when building
ghostscript with xlib_libX11:

```
checking for XOpenDisplay in -lX11... yes
checking for XdbeQueryExtension in -lXext... yes
checking for XtAppCreateShell in -lXt... no
configure: error: X11 libraries (libX11, libXt, libXext) not available, either install them, or rerun configure with "--without-x"
make: *** [package/pkg-generic.mk:263: /home/buildroot/instance-0/output-1/build/ghostscript-10.05.1/.stamp_configured] Error 1
```

This error can be reproduced with the following config:

```
cat <<EOF >.config
BR2_arm=y
BR2_cortex_a7=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XLIB_LIBX11=y
BR2_PACKAGE_GHOSTSCRIPT=y
EOF
make olddefconfig
make
```

This patch fixes the xlib dependencies of the ghostscript package to
correctly build with X support:

- The 'XtAppCreateShell' function is provided by the package
  'xlib_libXt'.
- The 'XdbeQueryExtension' function is provided by the package
  'xlib_libXext'.

They both select the 'xlib_libX11' package.

[1] 9abf662cfd package/ghostscript: security bump to version 10.05.0
[2] 37eede31e1

Fixes: https://autobuild.buildroot.org/results/45d/45d0414f341feb2354478b145396fe137f9cc6a6
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
(cherry picked from commit 9adc8a0570)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2025-08-14 09:26:54 +02:00

100 lines
2.6 KiB
Makefile

################################################################################
#
# ghostscript
#
################################################################################
GHOSTSCRIPT_VERSION = 10.05.1
GHOSTSCRIPT_SOURCE = ghostscript-$(GHOSTSCRIPT_VERSION).tar.xz
GHOSTSCRIPT_SITE = https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$(subst .,,$(GHOSTSCRIPT_VERSION))
GHOSTSCRIPT_LICENSE = AGPL-3.0
GHOSTSCRIPT_LICENSE_FILES = LICENSE
GHOSTSCRIPT_CPE_ID_VENDOR = artifex
GHOSTSCRIPT_DEPENDENCIES = \
host-lcms2 \
host-libjpeg \
host-pkgconf \
host-zlib \
fontconfig \
ghostscript-fonts \
jpeg \
lcms2 \
libpng \
tiff
# Ghostscript includes (old) copies of several libraries, delete them.
# Inspired by linuxfromscratch:
# http://www.linuxfromscratch.org/blfs/view/svn/pst/gs.html
define GHOSTSCRIPT_REMOVE_LIBS
rm -rf $(@D)/freetype $(@D)/ijs $(@D)/jbig2dec $(@D)/jpeg \
$(@D)/lcms2mt $(@D)/libpng $(@D)/openjpeg $(@D)/tiff \
$(@D)/zlib
endef
GHOSTSCRIPT_POST_PATCH_HOOKS += GHOSTSCRIPT_REMOVE_LIBS
GHOSTSCRIPT_CONF_ENV = \
CCAUX="$(HOSTCC)" \
CFLAGSAUX="$(HOST_CFLAGS) $(HOST_LDFLAGS)" \
PKGCONFIG="$(PKG_CONFIG_HOST_BINARY)"
GHOSTSCRIPT_CONF_OPTS = \
--disable-compile-inits \
--enable-fontconfig \
--with-fontpath=/usr/share/fonts \
--enable-freetype \
--disable-gtk \
--without-libpaper \
--with-system-libtiff
ifeq ($(BR2_PACKAGE_JBIG2DEC),y)
GHOSTSCRIPT_DEPENDENCIES += jbig2dec
GHOSTSCRIPT_CONF_OPTS += --with-jbig2dec
else
GHOSTSCRIPT_CONF_OPTS += --without-jbig2dec
endif
ifeq ($(BR2_PACKAGE_LIBIDN),y)
GHOSTSCRIPT_DEPENDENCIES += libidn
GHOSTSCRIPT_CONF_OPTS += --with-libidn
else
GHOSTSCRIPT_CONF_OPTS += --without-libidn
endif
ifeq ($(BR2_PACKAGE_OPENJPEG),y)
GHOSTSCRIPT_DEPENDENCIES += openjpeg
GHOSTSCRIPT_CONF_OPTS += --enable-openjpeg
else
GHOSTSCRIPT_CONF_OPTS += --disable-openjpeg
endif
ifeq ($(BR2_PACKAGE_OPENJPEG)$(BR2_PACKAGE_JBIG2DEC),yy)
# Dependencies already handle on per-package basis above,
# but duplicated here for consistency.
GHOSTSCRIPT_DEPENDENCIES += openjpeg jbig2dec
GHOSTSCRIPT_CONF_OPTS += --with-pdf
else
GHOSTSCRIPT_CONF_OPTS += --without-pdf
endif
ifeq ($(BR2_PACKAGE_CUPS),y)
GHOSTSCRIPT_DEPENDENCIES += cups
GHOSTSCRIPT_CONF_OPTS += \
CUPSCONFIG=$(STAGING_DIR)/usr/bin/cups-config \
--enable-cups
else
GHOSTSCRIPT_CONF_OPTS += --disable-cups
endif
ifeq ($(BR2_PACKAGE_XLIB_LIBXT)$(BR2_PACKAGE_XLIB_LIBXEXT),yy)
GHOSTSCRIPT_DEPENDENCIES += xlib_libXt xlib_libXext
GHOSTSCRIPT_CONF_OPTS += --with-x
else
GHOSTSCRIPT_CONF_OPTS += --without-x
endif
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
GHOSTSCRIPT_CONF_OPTS += --without-tesseract
endif
$(eval $(autotools-package))