# Template file for 'xbps-git'
pkgname=xbps-git
version=20140827
revision=7
short_desc="The XBPS package system (development branch)"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.voidlinux.eu/xbps"
license="Simplified BSD"

hostmakedepends="pkg-config git"
makedepends="zlib-devel libressl-devel libarchive-devel>=3.1.2_7 atf-devel"

triggers="virtualpkg"
depends="xbps-triggers>=0.75 libxbps-git-${version}_${revision}"
provides="xbps-${version}_${revision}"
replaces="xbps>=0 xbps-devel>=0"
conf_files="/etc/xbps/xbps.conf"

do_fetch() {
	local url="git://github.com/voidlinux/xbps"
	msg_normal "Fetching source from $url ...\n"
	git clone ${url} ${pkgname}-${version}
}

do_configure() {
	HAVE_VASPRINTF=1 ./configure --prefix=/usr --sysconfdir=/etc --enable-debug --enable-tests
}

do_build() {
	make ${makejobs}
}

do_install() {
	make DESTDIR=$DESTDIR install
}

libxbps-git_package() {
	short_desc+=" - runtime library"
	provides="libxbps-${version}_${revision}"
	replaces="libxbps>=0 xbps-devel>=0"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

libxbps-devel-git_package() {
	short_desc+=" - runtime library (development files)"
	depends="zlib-devel libarchive-devel libxbps-git>=${version}_${revision}"
	provides="libxbps-devel-${version}_${revision}"
	replaces="libxbps-devel>=0"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}

xbps-tests-git_package() {
	short_desc+=" - Kyua testsuite"
	depends="libxbps-git>=${version}_${revision}"
	provides="xbps-tests-${version}_${revision}"
	replaces="xbps-tests>=0"
	pkg_install() {
		vmove usr/tests
	}
}
