aboutsummaryrefslogtreecommitdiffstats
path: root/main/ghostscript/APKBUILD
blob: a34b04fef745722da874471db3146cd95342da77 (plain) (blame)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Contributor: Cameron Banta <cbanta@gmail.com>
# Maintainer: Cameron Banta <cbanta@gmail.com>
pkgname=ghostscript
pkgver=9.21
pkgrel=0
pkgdesc="An interpreter for the PostScript language and for PDF"
url="http://ghostscript.com/"
arch="all"
license="GPL3"
makedepends="autoconf automake libjpeg-turbo-dev libpng-dev jasper-dev expat-dev
	zlib-dev tiff-dev freetype-dev lcms2-dev gtk+3.0-dev
	cups-dev libtool jbig2dec-dev openjpeg-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-gtk"
source="https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver/./}/ghostscript-$pkgver.tar.gz
	ghostscript-system-zlib.patch
	fix-sprintf.patch
	fix-alignment.patch
	CVE-2017-8291.patch
	CVE-2017-7207.patch
	CVE-2017-5951.patch
	"
# secfixes:
#   9.21-r0:
#     - CVE-2017-8291
#     - CVE-2017-7207
#     - CVE-2017-5951

_builddir="$srcdir/ghostscript-$pkgver"
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# force it to use system-libs
	rm -r jpeg libpng zlib tiff lcms2 cups/libs jbig2dec \
		freetype || return 1

	# fix parallel builds
	sed -i -e 's/ECHO_XE/ECHOGS_XE/g' \
		-e 's/^\($(GLOBJ)md5.$(OBJ) :.*\)/\1 $(ECHOGS_XE)/' \
		base/lib.mak || return 1
	aclocal && autoconf --force

	cd $_builddir/ijs
	libtoolize --force && aclocal && autoconf && automake --add-missing
}

build(){
	# build ijs
	cd "$_builddir"/ijs
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-shared \
		--disable-static \
		|| return 1
	make

	cd "$_builddir"

	# --disable-compile-inits is needed to link with system-zlib
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--docdir=/usr/share/doc/"$pkgname" \
		--enable-dynamic \
		--disable-static \
		--with-system-libtiff \
		--with-ijs \
		--with-jbig2dec \
		--without-omni \
		--enable-gtk \
		--with-drivers=ALL \
		--with-fontpath=/usr/share/fonts/Type1:/usr/share/fonts \
		--disable-compile-inits \
		|| return 1
	make so all || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="${pkgdir}" install soinstall || return 1

	cd "$_builddir"/ijs
	make -j1 DESTDIR="${pkgdir}" install || return 1
	cd..


	#create empty dir for future fonts
	mkdir -p "${pkgdir}"/usr/share/fonts/Type1

	# license and copying
	install -m644 -D "$srcdir/$pkgname-$pkgver/LICENSE" \
		"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	install -m644 -D "$srcdir/$pkgname-$pkgver/doc/COPYING" \
		"$pkgdir/usr/share/licenses/$pkgname/COPYING"

	# make the doc and examples more alpine like
	#	(the --docdir above doesn't seem to work so good)
	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
	mv "$pkgdir/usr/share/$pkgname/$pkgver/doc" "$pkgdir/usr/share/doc/$pkgname"
	mv "$pkgdir/usr/share/$pkgname/$pkgver/examples" "$pkgdir/usr/share/doc/$pkgname"
}

gtk() {
	pkgdesc="A GTK-enabled PostScript interpreter and renderer"
	install -d "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/gsx "$subpkgdir"/usr/bin/
}

md5sums="5f213281761d2750fcf27476c404d17f  ghostscript-9.21.tar.gz
ae582371ec56fd8f73349773f23dcc94  ghostscript-system-zlib.patch
ee7da55d7a714db1de0fa78253cdacf3  fix-sprintf.patch
5ebdebe1e22a6eb1b7ebbf3e89c55314  fix-alignment.patch
e5256008d310f555b82bfaff807664b0  CVE-2017-8291.patch
0cea86a2d25001619e071e5d00b6925e  CVE-2017-7207.patch
a5e14e9089a52307f02a58f994817903  CVE-2017-5951.patch"
sha256sums="02bceadbc4dddeb6f2eec9c8b1623d945d355ca11b8b4df035332b217d58ce85  ghostscript-9.21.tar.gz
56662fae7956e741059ef9c2b5a7e883ab04d78acf5dae4fddf4a661f47f8b67  ghostscript-system-zlib.patch
6e01bd26ade307414f86a5d8f00c97719830d8afd49ffe84224ae47498de7a54  fix-sprintf.patch
22262be45ba77db5508e60cb2eef7f78178b9a38bfbfbb85d4082d4d7a2c1710  fix-alignment.patch
366bf4ded600fc7b0a8e2b0d4c877cc3ad5a0ccc192cb660d81f729575a47259  CVE-2017-8291.patch
641007b64e047cd20e439a77d16b9425f229b564fb5520875a4f0a03d53154e5  CVE-2017-7207.patch
2dd876cd8c97c52b098dbb36bbdcb761476d9d8c4fb75b177f1a3f63de4533a2  CVE-2017-5951.patch"
sha512sums="c5ff632dc9b418ebeecaae796cecbaf9ffcb84d7a1b62c1af2e6c9082f7b9f24fe9dd9f6a57bde3640f54c3036f0b99b32aac9f8ca1f489c012369ab2b72ae92  ghostscript-9.21.tar.gz
70721e3a335afa5e21d4e6cf919119010bd4544a03ab8f53f5325c173902221ad9b88c118b4bfeee80b3e1956bcdbaf4c53f64ae7fb81f5ba57dbc956750c482  ghostscript-system-zlib.patch
beefcf395f7f828e1b81c088022c08a506e218f27535b9de01e0f0edf7979b435316c318fa676771630f6ad16ff1ab059cd68aa128ed97e5a9f2f3fa840200c4  fix-sprintf.patch
7c6f40217dc687df27ee6d33351fba12a737c2ae06d1c35208dc943776d8efa66c3e882f0b1b9aec566fad69fd28ce360cc243f1c1aa20834467e769889194f2  fix-alignment.patch
c17121e564dd26033508199f3e587bfcee5589fec6e45e822c79f648c3a3b70363f04ad33538070c4d24c96e5795b277345359b66d2f360b996fca77239102b5  CVE-2017-8291.patch
11ece0df5d5d5ae6d654033c42531a82db57a92aed462659d177e18234cf6d61719625368eb4448a2235bca9d6b3901696b30099642c57df57966def5850da9d  CVE-2017-7207.patch
252d826bdf1e22c372312589e9b19067332c432eae748f2eb644bf32384925e8095ea7c218ca7bbf04bf384db42cca6b418cb6622a74d411da446776490516d8  CVE-2017-5951.patch"