# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>

pkgname=mdadm
pkgver=4.3
pkgrel=2.1
pkgdesc='A tool for managing/monitoring Linux md device arrays, also known as Software RAID'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL-2.0-or-later')
url='https://git.kernel.org/pub/scm/utils/mdadm'
makedepends=('git')
depends=('glibc' 'systemd')
conflicts=('mkinitcpio<38')
optdepends=('bash: mdcheck')
replaces=('raidtools')
backup=('etc/mdadm.conf')
validpgpkeys=('6A86B80E1D22F21D0B26BA75397D82E0531A9C91' # Jes Sorensen
              'EED84966493AEEAF4B466F696F9E3E9D4EDEBB11' # Mariusz Tkaczyk
	      )
source=("git+https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git#tag=${pkgname}-${pkgver}?signed"
	'mdadm.conf')
sha256sums=('SKIP'
            '4ce1e90690282f98e4828e11576fbd61be65e97a2cdae6c7eac7035ea5ee53e5')

build() {
  cd mdadm

  make CXFLAGS="$CFLAGS" BINDIR=/usr/bin UDEVDIR=/usr/lib/udev 
}

package() {
  cd mdadm

  make INSTALL=/usr/bin/install BINDIR=/usr/bin DESTDIR="$pkgdir" UDEVDIR=/usr/lib/udev install
  make SYSTEMD_DIR="$pkgdir"/usr/lib/systemd/system install-systemd
  install -D -m644 ../mdadm.conf "$pkgdir"/etc/mdadm.conf
  install -D -m755 misc/mdcheck "$pkgdir"/usr/share/mdadm/mdcheck
}
