# Description: Postscript interpreter
# URL:         http://www.ghostscript.com
# Maintainer:  Juergen Daubert, jue at crux dot nu
# Depends on:  util-linux, cups, fontconfig, xorg-libxt, xorg-libxext

name=ghostscript
version=9.23
release=1
source=(https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${version/./}/$name-$version.tar.xz
        http://downloads.sourceforge.net/sourceforge/gs-fonts/$name-fonts-std-8.11.tar.gz)

build () {
    cd $name-$version

    ./configure --prefix=/usr \
                --enable-cups \
                --disable-gtk \
                --disable-dbus \
                --with-drivers=ALL \
                --with-ijs \
                --with-fontpath=/usr/share/ghostscript/fonts:/usr/share/fonts

    make so all 
    make DESTDIR=$PKG install-so install

    cd ijs
    
    ./autogen.sh
    ./configure --prefix=/usr --enable-shared
    make
    make DESTDIR=$PKG install

    cp -r $SRC/fonts $PKG/usr/share/ghostscript

    rm -r $PKG/usr/share/ghostscript/$version/doc
    rm -r $PKG/usr/share/{doc,man/de}
    rm $PKG/usr/share/ghostscript/fonts/[CRT]*
    rm $PKG/usr/bin/ijs_{client,server}_example
}
