# Inspired by linuxfromscratch:
# http://www.linuxfromscratch.org/blfs/view/svn/pst/gs.html
define GHOSTSCRIPT_REMOVE_LIBS
- rm -rf $(@D)/freetype $(@D)/ijs $(@D)/jpeg $(@D)/lcms2mt \
- $(@D)/libpng $(@D)/tiff $(@D)/zlib
+ rm -rf $(@D)/freetype $(@D)/ijs $(@D)/jbig2dec $(@D)/jpeg \
+ $(@D)/lcms2mt $(@D)/libpng $(@D)/tiff $(@D)/zlib
endef
GHOSTSCRIPT_POST_PATCH_HOOKS += GHOSTSCRIPT_REMOVE_LIBS
--with-fontpath=/usr/share/fonts \
--enable-freetype \
--disable-gtk \
- --without-jbig2dec \
--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