# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=parted
pkgver=3.2
pkgrel=6
pkgdesc="Utility to create, destroy, resize, check and copy partitions"
url="https://www.gnu.org/software/parted/parted.html"
arch="all"
license="GPL-3.0"
subpackages="$pkgname-dev $pkgname-doc"
depends=
makedepends="readline-dev ncurses-dev lvm2-dev bash util-linux-dev"
source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
	fix-includes.patch
	fix-libintl-header-s390x.patch
	"

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

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-debug \
		--disable-nls \
		--disable-static \
		--enable-shared \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}
md5sums="0247b6a7b314f8edeb618159fa95f9cb  parted-3.2.tar.xz
e87ffa1171acbebfa9d2475a093e7e64  fix-includes.patch"
sha256sums="858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4  parted-3.2.tar.xz
f87c9290e861b969f4520a1af84ebf4b8f5f1437c1d78ee235d5ffcda3bffe84  fix-includes.patch"
sha512sums="4e37dbdd6f5032c9ebfec43704f6882379597d038167b9c4d04053efa083c68a705196713864451fa9e11d32777e16c68982877945c5efd9ea5f8252cb20e1c4  parted-3.2.tar.xz
444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc  fix-libintl-header-s390x.patch
55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd  fix-includes.patch"
