# Template file for 'libpaper'
pkgname=libpaper
version=1.1.24+nmu5
revision=1
build_style=gnu-configure
hostmakedepends="automake libtool"
conf_files="/etc/papersize"
short_desc="Library for handling paper characteristics"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://packages.debian.org/unstable/source/libpaper"
distfiles="${DEBIAN_SITE}/main/libp/${pkgname}/${pkgname}_${version}.tar.gz"
checksum=e29deda4cd7350189c71af0925cbf4a4473f9841d1419a922e1e8ff1954db1f2

pre_configure() {
	autoreconf -fi
}

post_install() {
	# add systemwide default papersize read by many office applications
	vmkdir etc
	echo '# Simply write the paper name. See papersize(5) for possible values' > ${DESTDIR}/etc/papersize

	# add libpaper.d directory other packages can use to store files
	vmkdir etc/libpaper.d
	touch ${DESTDIR}/etc/libpaper.d/.empty

	# add localisation
	cd debian/po
	for i in $(ls *.po); do
		install -dm755 ${DESTDIR}/usr/share/locale/${i%.po}/LC_MESSAGES/;
		msgfmt $i -o ${DESTDIR}/usr/share/locale/${i%.po}/LC_MESSAGES/${pkgname}.mo;
	done
}

libpaper-devel_package() {
	depends="${sourcepkg}-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.a
		vmove usr/lib/*.so
		vmove usr/share/man/man3
	}
}
