# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=hdparm
pkgver=9.58
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="42fb70f494aae4cc205ca68c3e883e1f4fc33e8ced1914e280e9f3faa7233d3f839e59178ec09ddb9d32e9d2bca122ce324645ecb5ac73defa284030ac7d3cea  hdparm-9.58.tar.gz"