# Contributor: Cameron Banta # Maintainer: Cameron Banta pkgname=ghostscript pkgver=9.21 pkgrel=0 pkgdesc="An interpreter for the PostScript language and for PDF" url="http://ghostscript.com/" arch="all" license="GPL3" makedepends="autoconf automake libjpeg-turbo-dev libpng-dev jasper-dev expat-dev zlib-dev tiff-dev freetype-dev lcms2-dev gtk+3.0-dev cups-dev libtool jbig2dec-dev openjpeg-dev" subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-gtk" source="https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver/./}/ghostscript-$pkgver.tar.gz ghostscript-system-zlib.patch fix-sprintf.patch " builddir="$srcdir/$pkgname-$pkgver" prepare() { cd "$builddir" default_prepare || return 1 # apply patches # force it to use system-libs rm -r jpeg libpng zlib tiff lcms2 cups/libs jbig2dec \ freetype || return 1 # fix parallel builds sed -i -e 's/ECHO_XE/ECHOGS_XE/g' \ -e 's/^\($(GLOBJ)md5.$(OBJ) :.*\)/\1 $(ECHOGS_XE)/' \ base/lib.mak || return 1 aclocal && autoconf --force || return 1 cd $builddir/ijs libtoolize --force && aclocal && autoconf && automake --add-missing } build(){ # build ijs cd "$builddir"/ijs ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --enable-shared \ --disable-static \ || return 1 make || return 1 cd "$builddir" # --disable-compile-inits is needed to link with system-zlib ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --docdir=/usr/share/doc/"$pkgname" \ --enable-dynamic \ --disable-static \ --with-system-libtiff \ --with-ijs \ --with-jbig2dec \ --without-omni \ --enable-gtk \ --with-drivers=ALL \ --with-fontpath=/usr/share/fonts/Type1:/usr/share/fonts \ --disable-compile-inits \ || return 1 make so all || return 1 } package() { cd "$builddir" make -j1 DESTDIR="$pkgdir" install soinstall || return 1 cd "$builddir"/ijs make -j1 DESTDIR="$pkgdir" install || return 1 cd .. # create empty dir for future fonts mkdir -p "${pkgdir}"/usr/share/fonts/Type1 # license and copying install -m644 -D "$srcdir/$pkgname-$pkgver/LICENSE" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -m644 -D "$srcdir/$pkgname-$pkgver/doc/COPYING" \ "$pkgdir/usr/share/licenses/$pkgname/COPYING" # make the doc and examples more alpine like # (the --docdir above doesn't seem to work so good) mkdir -p "$pkgdir/usr/share/doc/$pkgname" mv "$pkgdir/usr/share/$pkgname/$pkgver/doc" \ "$pkgdir/usr/share/doc/$pkgname" || return 1 mv "$pkgdir/usr/share/$pkgname/$pkgver/examples" \ "$pkgdir/usr/share/doc/$pkgname" || return 1 } gtk() { pkgdesc="A GTK-enabled PostScript interpreter and renderer" install -d "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/gsx "$subpkgdir"/usr/bin/ } sha512sums="c5ff632dc9b418ebeecaae796cecbaf9ffcb84d7a1b62c1af2e6c9082f7b9f24fe9dd9f6a57bde3640f54c3036f0b99b32aac9f8ca1f489c012369ab2b72ae92 ghostscript-9.21.tar.gz 70721e3a335afa5e21d4e6cf919119010bd4544a03ab8f53f5325c173902221ad9b88c118b4bfeee80b3e1956bcdbaf4c53f64ae7fb81f5ba57dbc956750c482 ghostscript-system-zlib.patch beefcf395f7f828e1b81c088022c08a506e218f27535b9de01e0f0edf7979b435316c318fa676771630f6ad16ff1ab059cd68aa128ed97e5a9f2f3fa840200c4 fix-sprintf.patch"