summaryrefslogtreecommitdiffstats
path: root/abs/core/ghostscript/PKGBUILD
blob: 7d3a8692dff09bac522b53accf323b86f265c850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# $Id$
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgbase=ghostscript
pkgname=(ghostscript ghostxps ghostpcl)
pkgver=9.22
pkgrel=7
pkgdesc="An interpreter for the PostScript language"
url="https://www.ghostscript.com/"
arch=('x86_64')
license=('AGPL3' 'custom')
depends=('libxt' 'libcups' 'fontconfig' 'zlib' 'libpng' 'libjpeg' 'jbig2dec'
         'libtiff' 'lcms2' 'dbus' 'libpaper' 'ijs' 'openjpeg2')
makedepends=('gtk3' 'gnutls' 'glu' 'freeglut')
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases
source=(https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver/./}/ghostpdl-${pkgver}.tar.xz
        ghostscript-9.22-restore-flushpage.patch)
sha256sums=('f4e46bc1f8285a61ab036007705fc2b532cc40f4448fe6bc156bd130733f306b'
            '22156c892ea27572386f5211f51a10a17079a9974ded9ec9af3f37a93a1bb8ca')

prepare() {
  cd ghostpdl-${pkgver}

  # http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=19ebb5f1f497b6f2d50fe13d17d3e627dfb6c868
  patch -Np1 --no-backup-if-mismatch -i ../ghostscript-9.22-restore-flushpage.patch

  # force it to use system-libs
  rm -r cups/libs expat ijs jbig2dec jpeg lcms2 libpng openjpeg tiff zlib
  # using tree freetype because of https://bugs.archlinux.org/task/56849

  autoreconf -fvi
}

build() {
  cd ghostpdl-${pkgver}

  ./configure --prefix=/usr \
              --enable-dynamic \
              --with-ijs \
              --with-jbig2dec \
              --with-x \
              --with-drivers=ALL \
              --with-fontpath=/usr/share/fonts/gsfonts \
              --enable-fontconfig \
              --enable-freetype \
              --enable-openjpeg \
              --without-luratech \
              --with-system-libtiff \
              --with-libpaper \
              --disable-compile-inits #--help # needed for linking with system-zlib

  make so-only
}

package_ghostscript() {
  optdepends=('texlive-core:      needed for dvipdf'
              'gtk3:              needed for gsx')

  cd ghostpdl-${pkgver}

  make DESTDIR="${pkgdir}" \
       CUPSSERVERROOT="${pkgdir}$(cups-config --serverroot)" \
       CUPSSERVERBIN="${pkgdir}$(cups-config --serverbin)" \
       soinstall
  ln -s gsc "${pkgdir}"/usr/bin/gs

  # install missing doc files # http://bugs.archlinux.org/task/18023
  install -Dt "${pkgdir}"/usr/share/ghostscript/${pkgver}/doc \
    -m644 doc/{VectorDevices.htm,gs-vms.hlp,gsdoc.el,pscet_status.txt}

  # remove unwanted localized manpages
  rm -r "${pkgdir}"/usr/share/man/de

  install -Dt "${pkgdir}"/usr/share/licenses/${pkgname} -m644 LICENSE
}

package_ghostxps() {
  pkgdesc="${pkgdesc/PostScript/XPS document}"
  depends=("ghostscript=${pkgver}-${pkgrel}")

  cd ghostpdl-${pkgver}

  install -Dt "${pkgdir}"/usr/bin sobin/gxpsc
  ln -s gxpsc "${pkgdir}"/usr/bin/gxps

  install -Dt "${pkgdir}"/usr/lib sobin/libgxps.so.${pkgver}
  ln -s libgxps.so.${pkgver} "${pkgdir}"/usr/lib/libgxps.so.${pkgver%.*}

  install -Dt "${pkgdir}"/usr/share/licenses/${pkgname} -m644 LICENSE
}

package_ghostpcl() {
  pkgdesc="${pkgdesc/PostScript/PCL 6}"
  depends=("ghostscript=${pkgver}-${pkgrel}")

  cd ghostpdl-${pkgver}

  install -Dt "${pkgdir}"/usr/bin sobin/gpcl6c
  ln -sf gpcl6c "${pkgdir}"/usr/bin/gpcl6

  install -Dt "${pkgdir}"/usr/lib sobin/libgpcl6.so.${pkgver}
  ln -s libgpcl6.so.${pkgver} "${pkgdir}"/usr/lib/libgpcl6.so.${pkgver%.*}

  install -Dt "${pkgdir}"/usr/share/licenses/${pkgname} -m644 LICENSE
}