app=dmraid
version=1.0.0
build=1sml
homepage="https://people.redhat.com/~heinzm/sw/dmraid/"
download="https://people.redhat.com/~heinzm/sw/dmraid/src/dmiraid-$version.rc16-3.tar.bz2"
desc="Tool and a library to discover, configure and activate ATA RAID devices"
requires="lvm"

build() {
  mkandenterbuilddir
  rm -rf $app

  tar xf $srcdir/$app"-"$version".rc16-3".tar.?z*
  cd $app/$version".rc16-3"/dmraid
  fixbuilddirpermissions

  applypatch $srcdir/001-do_not_use_p_for_partition.patch
  applypatch $srcdir/002-support_virtio_devices.patch
  applypatch $srcdir/003-isw-probe-hpa.patch
  applypatch $srcdir/004-activate_multiple_raid_sets.patch
  applypatch $srcdir/005-fix_isw_sectors_calculation.patch
  applypatch $srcdir/006-musl-libc.patch
  applypatch $srcdir/007-fix-loff_t-musl.patch

  ./configure \
    --prefix="" \
    --sysconfdir=/etc \
    --sbindir=/bin \
    --enable-led \
    --enable-intel_led \
    --enable-shared_lib \
    --disable-static_link \
    $builddist

  unset MAKEFLAGS CFLAGS CXXFLAGS
  make -j1
  make install DESTDIR=$pkg 

  mkfinalpkg
}

sha512sums="
7c45e5117adc52fc2094b1b2bad4f4c518a46317a2196611966d72085ba3587c4ac8d1080f9d934888c01788f2b2d3d621c6f0d3e2a023c0fb1f9f3fa7fc127e  dmraid-1.0.0.rc16-3.tar.bz2
df1e285f404da61f9d15c9be3fae905599fb5d03203d3cd0551421b89913361d36524f9d2ee899eac9088c35daad9e8d6280a621c6a5832eec1a9be21bd05b12  001-do_not_use_p_for_partition.patch
1486aa76066e959d800506030f37392560e4953eb23fbcb65899ce76ef8e646639d5bd7abed8d9328e9a7f8dcc005fac4312528a8afcc806d228828a5d9b3fb9  002-support_virtio_devices.patch
b679ef5ff2671a8c8aa1a12feb54cfdfa6a40cbb0aef23e49b1ea5a8f97563061f9b207eeaf06da9fbb33837d9d04a4972869adc87eb89eb459aeb1c1e7bc5ee  003-isw-probe-hpa.patch
ce120d7313f7f1b563e95fd9b81e4eb5353edf416a521d2955b0bd7a0c08ec4c0a5da4402aa1690f65d2b4464d1f5fc534ec7819b07ee8791046b25f0209a21b  004-activate_multiple_raid_sets.patch
702cb4cf0edf79dbde9185cada12462681b52bffd5f8c4eab1b594ef754c964fb6c7f711ce77e4074167d920755fe0466d284f94fb272d60ea2314f2a45ef366  005-fix_isw_sectors_calculation.patch
1335297528df24faa292e4d80a57e23e3f910b669a92370e57a97bd4df443092323a91489c2cc1f17e3b280a3a7f0386bb7fed3a157cdab7ab55686e9d5e1ae4  006-musl-libc.patch
3fe66677b7bb3a314cabcab32d35192ddd5ec70e50398a37916197eb2818debf919fe48337fe9befb3a7d7ab727cbeed976413db89585f66fed7375cf9b36ac8  007-fix-loff_t-musl.patch
"
