### this file is sourced not run
PKGVER=9.50
PKGBUILD=1
PKGARCH=x86_64

# source: post BLFS 8.2 2018-06-08 updated to 9.50
TARBALL=ghostscript-$PKGVER.tar.xz
MD5SUM=6cea6bae4a7cdfac6ccb09f07f0caf8c
SRC_URL=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs950/$TARBALL
BUNDLE=

SLACKREQ='expat freetype2 libjpeg-turbo libpng libtiff lcms2 cairo fontconfig cups libjasper'
SLACKDESC="ghostscript: ghostscript $PKGVER (Postscript renderer)  
ghostscript:  
ghostscript: Ghostscript is a versatile processor for PostScript data with the 
ghostscript: ability to render PostScript to different targets.  
ghostscript: 
ghostscript: 
ghostscript: 
ghostscript: 
ghostscript: 
ghostscript: 
ghostscript:
"
SLACKSUG=ghostscript-std-fonts

### default pkg_download
### default pkg_prepare
### package
pkg_package() {
	# add our extra stuff: pdf-writer (cups-pdf) backend and its ppd
	mkdir -p usr/$LIBDIR/cups/backend &&
	install -m500 $CHROOT_DIR/tmp/pkg/pdf-writer usr/$LIBDIR/cups/backend &&
	mkdir -p etc/cups/ppd &&
	install -m644 $CHROOT_DIR/tmp/pkg/CUPS-PDF.ppd etc/cups/ppd
}

### build
pkg_build() {
	cd /tmp/ghostscript* 

	# this will prevent installation to complete, so clean it out first
	rm -rf /usr/share/ghostscript &&
	
	# delete obsolete library
	rm -rf expat freetype lcms2 jpeg libpng zlib tiff jasper lcms &&

	# start build
	./configure --prefix=/usr --libdir=/usr/$LIBDIR --disable-compile-inits \
	--enable-dynamic --with-system-libtiff  &&

	{ make $MAKEFLAGS    || make ;    } && 
	{ make $MAKEFLAGS so || make so ; } &&

	make install &&
	rm -f /usr/share/ghostscript/$PKGVER/doc && # avoid stall
	make soinstall &&
	
	install -v -m644 base/*.h /usr/include/ghostscript &&
	ln -v -s ghostscript /usr/include/ps &&
	ln -sfvn ../ghostscript/$PKGVER/doc /usr/share/doc/ghostscript-$PKGVER &&
	cp -a examples/ /usr/share/ghostscript/$PKGVER &&
	pkg_build_slackdesc	
}
  

