# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gptfdisk
pkgver=1.0.3
pkgrel=0
pkgdesc="A text-mode partitioning tool that works on Globally Unique Identifier (GUID) Partition Table (GPT) disks"
arch="all"
url="http://www.rodsbooks.com/gdisk/"
license='GPL2'
makedepends="ncurses-dev e2fsprogs-dev popt-dev linux-headers"
subpackages="$pkgname-doc sgdisk"
source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz"

_builddir="$srcdir"/gptfdisk-$pkgver
build() {
	cd "$_builddir"
	make CXX="${CXX:-g++}" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
}

package () {
	cd "$_builddir"

	mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/share/man/man8
	for i in gdisk cgdisk sgdisk fixparts; do
		install $i "$pkgdir"/usr/bin/ || return 1
		install $i.8 "$pkgdir"/usr/share/man/man8/ || return 1
	done
}

sgdisk() {
	pkgdesc="Command-line GUID partition table (GPT) manipulator"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/sgdisk "$subpkgdir"/usr/bin/
}

sha512sums="80d437bfa2365abfffbd4812ea928fcebd52c5421de321cf190d395549e32c5ebdbb2d060cc4b95f77fe13cdd719f4d2bb3d0ed5d97792b100325f92d7c852d7  gptfdisk-1.0.3.tar.gz"
