# Template file for 'hfsprogs'
pkgname=hfsprogs
_distver=332.25
_patchver=11
version=${_distver}debian${_patchver}
create_wrksrc=yes
revision=1
makedepends="libbsd-devel openssl-devel"
short_desc="mkfs and fsck for HFS and HFS+ file systems"
maintainer="Juan RP <xtraeme@gmail.com>"
license="APSL-2.0"
homepage="http://www.opensource.apple.com/"
distfiles="
 ${DEBIAN_SITE}/main/h/${pkgname}/${pkgname}_${_distver}.orig.tar.gz
 ${DEBIAN_SITE}/main/h/${pkgname}/${pkgname}_${_distver}-${_patchver}.debian.tar.gz"
checksum="
 74c9aeca899ed7f4bf155c65fc45bf0f250c0f6d57360ea953b1d536d9aa45e6
 62d9b8599c66ebffbc57ce5d776e20b41341130d9b27341d63bda08460ebde7c"

post_extract() {
	cd ${wrksrc}/diskdev*
	for f in ${wrksrc}/debian/patches/*.patch; do
		patch -Np1 -i ${f}
	done
}

do_build() {
	cd ${wrksrc}/diskdev*
	make -f Makefile.lnx CC=$CC ${makejobs}
}

do_install() {
	cd ${wrksrc}/diskdev*
	vinstall newfs_hfs.tproj/hfsbootdata.img 644 usr/share/hfsprogs hfsbootdata
	vinstall newfs_hfs.tproj/newfs_hfs 755 usr/bin mkfs.hfsplus
	vinstall fsck_hfs.tproj/fsck_hfs 755 usr/bin fsck.hfsplus
	vinstall newfs_hfs.tproj/newfs_hfs.8 644 usr/share/man/man8 mkfs.hfsplus.8
	vinstall fsck_hfs.tproj/fsck_hfs.8 644 usr/share/man/man8 fsck.hfsplus.8
	vinstall ${FILESDIR}/APSL-2.0 644 usr/share/licenses/${pkgname}
}