# Template file for 'mupdf'
pkgname=mupdf
version=1.3
revision=1
wrksrc="${pkgname}-${version}-source"
hostmakedepends="pkg-config"
makedepends="zlib-devel libcurl-devel freetype-devel libjpeg-turbo-devel jbig2dec-devel libXext-devel desktop-file-utils"
depends="desktop-file-utils"
short_desc="Lightweight PDF and XPS viewer"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-3"
homepage="http://mupdf.com"
distfiles="https://mupdf.googlecode.com/files/mupdf-${version}-source.tar.gz"
checksum=aba8b31bee9cc0a16abedab5e31c81c65996cba5591e62a50a79bea2a63d4478

pre_build() {
	rm -rf thirdparty/{curl,freetype,jpeg,zlib,jbig2dec}
}

do_build() {
	make ${makejobs} build=release
}

do_install() {
	make build=release prefix=${DESTDIR}/usr install

	mv ${DESTDIR}/usr/bin/mupdf-x11-curl ${DESTDIR}/usr/bin/mupdf
	rm ${DESTDIR}/usr/bin/mupdf-x11

	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

	vinstall mupdf.desktop 644 usr/share/applications
	vinstall mupdf.xpm 644 usr/share/pixmaps
}

mupdf-devel_package() {
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib
	}
}
