# Template file for 'dcraw'
pkgname=dcraw
version=9.28.0
revision=1
wrksrc=dcraw
hostmakedepends="gettext"
makedepends="jasper-devel lcms2-devel"
short_desc="Convert raw photos"
maintainer="Felix Hanley <felix@userspace.com.au>"
license="GPL-2.0-or-later"
homepage="https://www.dechifro.org/dcraw/"
distfiles="https://www.dechifro.org/dcraw/archive/${pkgname}-${version}.tar.gz"
checksum=2890c3da2642cd44c5f3bfed2c9b2c1db83da5cec09cc17e0fa72e17541fb4b9

do_build() {
	$CC $CFLAGS $LDFLAGS \
		-o dcraw dcraw.c \
		-lm -ljasper -ljpeg -llcms2 \
		-DLOCALEDIR=\"/usr/share/locale/\"
}

do_install() {
	vbin dcraw
	vman dcraw.1

	for i in dcraw_*.po; do j=${i#dcraw_}; k=${j%.po}
		install -d "${DESTDIR}"/usr/share/locale/$k/LC_MESSAGES
		msgfmt -o "${DESTDIR}"/usr/share/locale/$k/LC_MESSAGES/dcraw.mo $i
	done
}
