# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=hdparm
pkgver=9.56
pkgrel=0
pkgdesc="Utility for manipulating IDE device parameters"
url="https://sourceforge.net/projects/hdparm"
arch="all"
license="BSD-2-clause OR GPL-2.0-or-later"
makedepends="linux-headers"
options="!check"  # this application has no tests
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz"

prepare() {
	default_prepare
	sed -i '/^LDFLAGS/d' "$builddir"/Makefile 
}

build() {
	cd "$builddir"
	export CFLAGS="$CFLAGS -D_GNU_SOURCE"
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -D -m755 contrib/idectl "$pkgdir"/sbin
	install -D -m755 contrib/ultrabayd "$pkgdir"/sbin
	install -D -m644 LICENSE.TXT "$pkgdir"/usr/share/licenses/hdparm/LICENSE.TXT
}

sha512sums="5dee7211a2528920bd197d45217a7b58df933c2500d224d39a8bb89c4d3f340962953e17b7b5f66fd52205a3a3b225d5bc0b75fc7af0f064f8ea092b55090b03  hdparm-9.56.tar.gz"