aboutsummaryrefslogtreecommitdiffstats
path: root/main/mupdf/APKBUILD
blob: 95eb7de7a3945f90e394e1dede4784a9a4b64771 (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
106
107
108
109
110
111
112
# 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.13.0
pkgrel=2
pkgdesc="Lightweight PDF and XPS viewer"
url="https://mupdf.com"
arch="all"
license="AGPL-3.0-or-later"
depends=""
makedepends="freetype-dev
	harfbuzz-dev
	jbig2dec-dev
	jpeg-dev
	openjpeg-dev
	zlib-dev
	libx11-dev
	libxext-dev
	libxrandr-dev
	libxi-dev
	mesa-dev
	glu-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-x11:_x11
	$pkgname-gl:_gl $pkgname-tools:_tools"
options="!check"
source="https://mupdf.com/downloads/archive/$pkgname-$pkgver-source.tar.xz
	shared-lib.patch
	0001-fix-build-on-big-endian.patch
	"

# secfixes:
#   1.13-r0:
#   - CVE-2018-1000051
#   - CVE-2018-6544
#   - CVE-2018-6192
#   - CVE-2018-6187
#   - CVE-2018-5686
#   - CVE-2017-17858
#   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

	# freeglut and lcms2 are mupdf-specific forks:
	# https://src.fedoraproject.org/rpms/mupdf/blob/master/f/mupdf.spec#_15
	local file; for file in thirdparty/*; do
		[ "${file##*/}" != "freeglut" ] && \
		[ "${file##*/}" != "lcms2" ] && \
		[ "${file##*/}" != "mujs" ] && \
			rm -rf "$file"
	done
}

build() {
	cd "$builddir"
	make prefix=/usr build=release all extra-apps
}

package() {
	cd "$builddir"
	make prefix=/usr DESTDIR="$pkgdir" install

	cd build/release
	local app; for app in mjsgen mujstest muraster; do
		install -Dm755 $app "$pkgdir"/usr/bin/$app
	done

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

_x11() {
	pkgdesc="$pkgdesc with X11 backend"
	depends=""

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

_gl() {
	pkgdesc="$pkgdesc with OpenGL backend"
	depends=""

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

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

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

sha512sums="c40694d907bb44f18ccf276b3014867f5e0031259064d6f5f4c2bb17bcf1c6773ea0b12b5b99bc3d88bbe69b574e323c490e387e8199f796b44b76bae01f8924  mupdf-1.13.0-source.tar.xz
8d3f22908060351e8bb171c7c8248662dd6ac3fb5c765ad0ce33f33c418f6bcfb1982ea8e97b4fefee067c675cac03f76e8b715640dfd3689e8d7738384b6536  shared-lib.patch
420057d091ac810e077ebe77c631670c4a21ad7a817ffabe9a453192b3165d86dcb52f23fa8b36e98dfea6ea895db85cb5049557de89decb94b466311c417430  0001-fix-build-on-big-endian.patch"