aboutsummaryrefslogtreecommitdiffstats
path: root/main/ghostscript/APKBUILD
blob: e01a138758685c48e33b7abd5ede82b043381ed4 (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: Cameron Banta <cbanta@gmail.com>
# Maintainer: Cameron Banta <cbanta@gmail.com>
pkgname=ghostscript
pkgver=9.07
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 libiconv-dev lcms-dev gtk+3.0-dev
	libtool"
subpackages="$pkgname-doc $pkgname-dev $pkgname-gtk"
source="http://downloads.ghostscript.com/public/$pkgname-$pkgver.tar.gz
	ijs-automake.patch"

_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 -rf jpeg libpng zlib jasper expat tiff lcms cups/libs

	# 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 \
		--with-system-libtiff \
		--with-ijs \
		--with-jbig2dec \
		--without-omni \
		--enable-gtk \
		--with-drivers=FILES \
		--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..

	rm "$pkgdir"/usr/lib/*.la || return 1

	#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="57ebf17c5abcf0fc95a386bfff08c1a4  ghostscript-9.07.tar.gz
859759dbc83ac035ee5ee23e212d3f5a  ijs-automake.patch"
sha256sums="44800d004c53f13192d1b5db413119198ddfc8a11c4d2a030aac2f2fda822ebf  ghostscript-9.07.tar.gz
974fe579aa96290cd85e70552aef7e80159f304686e11c8eb3b701a108dfcc6c  ijs-automake.patch"
sha512sums="32935ecd1f0dd6faaa1568bce26c1f24a7e19f169ea586ec50039c616f1555b01324261e139ed1910dea1055b0fb548888d230c202d5d7b7fd8d44ae9f001b58  ghostscript-9.07.tar.gz
4ba7f19015d6f4a668188abb9b872585141a9ebc95792378d09853ee52983d1fb2c9e5e2b0a3d7bd8ea5cf85724881c5db81c8f01aa0b64d93cf82755701ad36  ijs-automake.patch"