# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=parted
pkgver=3.2
pkgrel=7
pkgdesc="Utility to create, destroy, resize, check and copy partitions"
url="http://www.gnu.org/software/parted/parted.html"
arch="all"
license="GPL3"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
depends=
makedepends="readline-dev ncurses-dev lvm2-dev bash util-linux-dev gettext-dev autoconf automake"
checkdepends="check-dev python3"
options="!checkroot"
source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
	disable-two-tests.patch
	fix-includes.patch
	fix-libintl-header-s390x.patch
	tests-call-name-correctly.patch
	tests-python3.patch
	"

builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd "$builddir"
	default_prepare
	autoreconf
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-debug \
		--disable-static \
		--enable-shared \
		--enable-device-mapper \
		--with-readline
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}
sha512sums="4e37dbdd6f5032c9ebfec43704f6882379597d038167b9c4d04053efa083c68a705196713864451fa9e11d32777e16c68982877945c5efd9ea5f8252cb20e1c4  parted-3.2.tar.xz
b49eb0211c405a4ef69e1bb0079621c22fec4adf0309f0a58b5d881540913de01d05ccd3eb521f35c3cf6f4eb8aa0f4c5270ce3dea47270a5c3fe8fae635c6f0  disable-two-tests.patch
55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd  fix-includes.patch
444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc  fix-libintl-header-s390x.patch
8bd86d2b0401566e7757c43d849b7f913cc4ec1bf50d5641dc72d7e278ca38db2ac746cd8dcc756b245021ea1f9738875b6a831f05185b9217d3f1c287944748  tests-call-name-correctly.patch
7486f98d535380a9e6598b9ac6153564319d5effa25456dc393cf3540ea47ac5b462be79cbd7d8efbd1fc2d2ef240a00873a2e2b138d4b4b0bb1494893de1eac  tests-python3.patch"