# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=hdparm
pkgver=9.65
pkgrel=2
pkgdesc="A shell utility for manipulating Linux IDE drive/driver parameters"
arch=(x86_64)
depends=('glibc')
source=(https://downloads.sourceforge.net/sourceforge/hdparm/${pkgname}-${pkgver}.tar.gz
        pass-ldflags.patch)
license=('LicenseRef-BSD')
url="https://sourceforge.net/projects/hdparm/"
sha512sums=('4ffc8902b90cee10d68af8ddb9f3b9454d523ecd49cdaaed254b4d7a999462a8ad5ec1bb5d7684b09fefa41b5941ab533b167dad290003b51c795a633ca88913'
            '4103276304a858a9540ce173f22c5eb64cadac36b5cd38d9396d63fa721a579e16d4d0f84e3c627d0620c42815c437abf14c9657fdb1a28e8263a52a0bb26c4f')

prepare() {
  cd ${pkgname}-${pkgver}
  # Enable FULL RELRO
  patch -Np1 -i "$srcdir"/pass-ldflags.patch
}

build() {
  cd ${pkgname}-${pkgver}
  make
}

package() {
  cd ${pkgname}-${pkgver}
  # install
  mkdir -p "${pkgdir}"/usr/bin
  make DESTDIR="${pkgdir}" sbindir=/usr/bin install
  install -m755 contrib/idectl "${pkgdir}"/usr/bin
  install -m755 contrib/ultrabayd "${pkgdir}"/usr/bin

  install -D -m 0644 $srcdir/$pkgname-$pkgver/wiper/README.txt "$pkgdir"/usr/share/doc/wiper/README.txt
  install -D -m 0755 $srcdir/$pkgname-$pkgver/wiper/wiper.sh "$pkgdir"/usr/bin/wiper.sh

  #install license file
  install -D -m 644 LICENSE.TXT "$pkgdir"/usr/share/licenses/hdparm/LICENSE.TXT
}
