summaryrefslogtreecommitdiff
path: root/community/mupdf/PKGBUILD
blob: 6f736631eaa0416fa6667c875730ddd1cb5612fc (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
# $Id: PKGBUILD 105051 2014-01-30 18:29:49Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Pierre-Paul Paquin <pierrepaulpaquin@gmail.com>
# Contributor: xduugu

pkgname=mupdf
pkgver=1.3
pkgrel=8
pkgdesc='Lightweight PDF and XPS viewer'
arch=('i686' 'x86_64')
url='http://mupdf.com'
license=('GPL3')
depends=('curl' 'desktop-file-utils' 'freetype2' 'jbig2dec' 'libjpeg' 'libxext'
         'openssl')
install=mupdf.install
options=('staticlibs')
source=(https://mupdf.googlecode.com/files/$pkgname-$pkgver-source.tar.gz
        mupdf-1.3-system-libcurl.patch
        mupdf-1.3-stack-buffer-overflow-in-xps_parse_color.patch)
md5sums=('fe53c2a56ebd7759f5f965bc4ff66359'
         '6d11387e9bb9897f6f1ecc3956f8e2d4'
         'f4d785b28f711e12d4a078ce9b3ed8f5')

prepare() {
  cd $pkgname-$pkgver-source
  rm -rf thirdparty/{curl,freetype,jpeg,zlib,jbig2dec}
  patch -p1 -i ../mupdf-1.3-system-libcurl.patch
  patch -p1 -i ../mupdf-1.3-stack-buffer-overflow-in-xps_parse_color.patch

  cd platform/debian
  sed -i -e 's/mupdf.xpm/mupdf/' \
    -e 's/application\/x-pdf/application\/x-pdf/' \
    -e 's/mupdf-select-file/mupdf/' \
    -e 's/^$/NoDisplay=true/' \
    mupdf.desktop
}

build() {
  CFLAGS+=' -fPIC'
  CXXFLAGS+=' -fPIC'

  cd $pkgname-$pkgver-source
  make build=release CURL_LIBS='-lcurl -lpthread'
}

package() {
  cd $pkgname-$pkgver-source
  make build=release prefix="$pkgdir"/usr install

  mv "$pkgdir"/usr/bin/mupdf-x11-curl "$pkgdir"/usr/bin/mupdf
  rm "$pkgdir"/usr/bin/mupdf-x11

  cd platform/debian
  install -Dm644 mupdf.desktop "$pkgdir"/usr/share/applications/mupdf.desktop
  install -Dm644 mupdf.xpm "$pkgdir"/usr/share/pixmaps/mupdf.xpm

  find "$pkgdir"/usr/include \
    "$pkgdir"/usr/share \
    "$pkgdir"/usr/lib -type f | xargs chmod -v 0644
}