# Obarun        : 66 init/supervisor
# Maintainer    : Eric Vidal <eric@obarun.org>
# Maintainer    : Jean-Michel T.Dydak <jean-michel@obarun.org>
# Obarun PkgSrc : https://git.obarun.org/pkg/obcore/dmraid/
#----------------
# Maintainer    : Tobias Powalowski <tpowa@archlinux.org>
# Contributor   : Urs Wolfer <uwolfer @ fwo.ch>
# Arch PkrSrc   : https://www.archlinux.org/packages/core/x86_64/dmraid/
#-----------------------------------------------------------------------
# Website       : http://people.redhat.com/~heinzm/sw/dmraid/
#-----------------------------------------------------------------------

pkgname=dmraid
pkgver=1.0.0.rc16.3
pkgrel=13
pkgdesc="Device mapper RAID interface"
arch=('x86_64')
url="https://people.redhat.com/~heinzm/sw/dmraid/src"
license=('GPL')

source=($url/$pkgname-${pkgver/%.3/-3}.tar.bz2
        'dmraid_install'
        'dmraid_hook')

install=$pkgname.install

conflicts=(
    'mkinitcpio<0.7')

depends=(
    'device-mapper>=2.0.54')

#--BUILD CONTROL--------------------------------------------------------

path=(
    prefix=/usr
    sbindir=/usr/bin
    libdir=/usr/lib
    mandir=/usr/share/man
    includedir=/usr/include
)

flags=(
    --enable-led
    --enable-intel_led
)
 
#-----------------------------------------------------------------------
build() {
    cd $pkgname/${pkgver/%.3/-3}/$pkgname

    ./configure "${flags[@]}"
    make
}

package() {
    cd $pkgname/${pkgver/%.3/-3}/$pkgname

    make DESTDIR="$pkgdir" "${path[@]}" install

    install -D -m0644 "$srcdir"/dmraid_install "$pkgdir"/usr/lib/initcpio/install/dmraid
    install -D -m0644 "$srcdir"/dmraid_hook "$pkgdir"/usr/lib/initcpio/hooks/dmraid

    ## fix permissions
    chmod 644 "$pkgdir"/usr/include/dmraid/* "$pkgdir"/usr/lib/libdmraid.a
}

#-----------------------------------------------------------------------
sha512sums=('7c45e5117adc52fc2094b1b2bad4f4c518a46317a2196611966d72085ba3587c4ac8d1080f9d934888c01788f2b2d3d621c6f0d3e2a023c0fb1f9f3fa7fc127e'
            '072a146ef843ab3835f4476db5d7891bd718d477b22cbea6dc563487711f91cad227051a25e67528924cd247b0873f4726e33504bc42967344b575972d944a11'
            '47dee44d1ad80ed24209e3a39fa58bdf1363a691b160e17586da7034ecf71b03e992955fb24b286898f226948db3198a5fbdb71b5f3bf242bd71a114bcca76ed')
