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

# source: post BLFS 7.8 2016-01-05
TARBALL=ghostscript-$PKGVER.tar.bz2
MD5SUM=aa125af368d89b3dbd15fc379f13375f
SRC_URL=http://downloads.ghostscript.com/public/$TARBALL
BUNDLE=

SLACKREQ='expat freetype2 libjpeg-turbo libpng libtiff lcms2 cairo fontconfig gtk2 cups libjasper libopenjpeg'
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* 
	
	# BLFS 7.8 patch to build with system-zlib
	sed -i 's/ZLIBDIR=src/ZLIBDIR=$includedir/' configure.ac configure &&
	
	# 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 &&
	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 &&
	pkg_build_slackdesc	
}
 

