# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=thin-provisioning-tools
pkgver=0.7.1
pkgrel=0
pkgdesc="A suite of tools for manipulating the metadata of the dm-thin device-mapper target"
url="https://github.com/jthornber/thin-provisioning-tools"
arch="all"
license="GPL-3.0"
depends="expat boost libaio"
makedepends="expat-dev boost-dev libaio-dev linux-headers autoconf automake libtool"
install=""
subpackages="$pkgname-doc"
_realpkgver=${pkgver/_/-}
options="!check" # no production testsuite, only development tests
source="thin-provisioning-tools-${_realpkgver}.tar.gz::https://github.com/jthornber/thin-provisioning-tools/archive/v${_realpkgver}.tar.gz
	page-size.patch"

builddir="$srcdir"/thin-provisioning-tools-$_realpkgver
prepare() {
	default_prepare || return 1
	update_config_guess || return 1
}

build() {
	cd "$builddir"
	autoreconf || return 1
	export CXXFLAGS="$CXXFLAGS -fpermissive"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-optimisation='' \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" \
		BINDIR="${pkgdir}"/sbin \
		MANDIR=/usr/share/man \
		install || return 1
}

sha512sums="47ce2f0699e3bc21fa5bb1175e12fa8f545d2abfbed4529b144bd4812a4a0021635713c3e71228f20b30cbe067c77fb93db20b65075b2689ec2aa5b0385854b9  thin-provisioning-tools-0.7.1.tar.gz
c914f7b318555b68c4d1aceffd3b571afe9570aaa2fcd9739fab1e8d85bdbe6902dc3e63d9af356feb1388e5a79474ee8d3e2bb9e501d8f673e52b9ae5e27987  page-size.patch"
