# Template file for 'libarchive'
pkgname=libarchive
version=3.1.2
revision=3
build_style=gnu-configure
configure_args="--without-xml2 --without-nettle --disable-rpath --with-lzo2"
makedepends="zlib-devel lzo-devel bzip2-devel acl-devel openssl-devel liblzma-devel expat-devel"
short_desc="Library to read/write several different streaming archive formats"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.libarchive.org/"
license="BSD"
distfiles="http://www.libarchive.org/downloads/libarchive-${version}.tar.gz"
checksum=eb87eacd8fe49e8d90c8fdc189813023ccc319c5e752b01fb6ad0cc7b2c53d5e

if [ "$CROSS_BUILD" ]; then
	hostmakedepends="libtool automake"
	pre_configure() {
		./build/autogen.sh
	}
fi

bsdtar_package() {
	short_desc="BSD tar(1) using libarchive"
	pkg_install() {
		vmove usr/bin/bsdtar
		vmove usr/share/man/man1/bsdtar.1
		vmove usr/share/man/man5/tar.5
	}
}

bsdcpio_package() {
	short_desc="BSD cpio(1) using libarchive"
	pkg_install() {
		vmove usr/bin/bsdcpio
		vmove usr/share/man/man1/bsdcpio.1
		vmove usr/share/man/man5/cpio.5
	}
}

libarchive-devel_package() {
	depends="acl-devel zlib-devel lzo-devel bzip2-devel liblzma-devel
		openssl-devel expat-devel libarchive>=${version}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove usr/lib/pkgconfig
		vmove usr/share
	}
}

libarchive_package() {
	pkg_install() {
		vmove usr
	}
}
