aboutsummaryrefslogtreecommitdiffstats
path: root/main/mupdf/APKBUILD
blob: d6c76afd88e5ea1e97169766d62bf2e725e0c38c (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
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Michael Zhou <zhoumichaely@gmail.com>
# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=mupdf
pkgver=1.11
pkgrel=1
pkgdesc="A lightweight PDF and XPS viewer"
url="http://mupdf.com"
arch="all"
license="AGPL3+"
depends=""
makedepends="freetype-dev jpeg-dev jbig2dec-dev libx11-dev libxext-dev
	openjpeg-dev harfbuzz-dev glfw-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-x11:_x11
	$pkgname-gl:_gl $pkgname-tools:_tools"
options="!check"
source="http://mupdf.com/downloads/archive/$pkgname-$pkgver-source.tar.gz
	shared-lib.patch
	openjpeg-2.1.patch
	CVE-2017-6060.patch
	"

# secfixes:
#   1.11-r1:
#   - CVE-2017-6060
#   1.10a-r2:
#   - CVE-2017-5991
#   1.10a-r1:
#   - CVE-2017-5896

builddir="$srcdir/$pkgname-$pkgver-source"
prepare() {
	default_prepare || return 1

	cd "$builddir"
	for file in thirdparty/*; do
		[ "${file##*/}" != "mujs" ] && rm -rf "$file"
	done

	sed '/^JBIG2DEC_CFLAGS :=/s|$| -I./include/mupdf|' \
		-i Makethird || return 1
}

build() {
	make HAVE_GLFW=yes SYS_GLFW_LIBS="$(pkgconf --libs glfw3 gl)" \
		prefix=/usr -C "$builddir" || return 1
}

package() {
	make HAVE_GLFW=yes \
		prefix=/usr DESTDIR="$pkgdir" \
		-C "$builddir" install || return 1

	ln -s libmupdf.so.0 "$pkgdir"/usr/lib/libmupdf.so
	ln -s libmupdfthird.so.0 "$pkgdir"/usr/lib/libmupdfthird.so
}

_x11() {
	pkgdesc="A lightweight PDF and XPS viewer with X11 backend"
	depends=""

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mupdf-x11 \
		"$subpkgdir"/usr/bin/ || return 1
	ln -s /usr/bin/mupdf-x11 "$subpkgdir"/usr/bin/mupdf
}

_gl() {
	pkgdesc="A lightweight PDF and XPS viewer with OpenGL backend"
	depends=""

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mupdf-gl \
		"$subpkgdir"/usr/bin/ || return 1
}

_tools() {
	pkgdesc="Tools for a lightweight PDF and XPS viewer"
	depends=""

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mutool \
		"$pkgdir"/usr/bin/mujstest \
		"$pkgdir"/usr/bin/muraster \
		"$subpkgdir"/usr/bin/ || return 1
}

sha512sums="501670f540e298a8126806ebbd9db8b29866f663b7bbf26c9ade1933e42f0c00ad410b9d93f3ddbfb3e45c38722869095de28d832fe3fb3703c55cc9a01dbf63  mupdf-1.11-source.tar.gz
b3ddbc22da894a8b9a0fa0c93711e2052b5d2ca29497473b6e15ffbae52faaafff9238619680de474c455ebd073c2d29ead4ff5d962fddb99f7ced27057fa77f  shared-lib.patch
f8283db9a510527e84afeeb6eea89948161899c149a559c4a699c533445b42f30e5bf520616ca69d7feb554529ad494a60c276a1eecc915723ec0f264bbc0ed0  openjpeg-2.1.patch
3e3f34e448967acb7772365065234c313cb014ebe6e3c3b3bcdbed2242b32ee5589ecd749d06fb4cd5f406eb37ca431e369c96b9adb3b5367d2e5296f1ca983e  CVE-2017-6060.patch"