# Maintainer: Sébastien Luttringer
# Contributor: Andrea Zucchelli <zukka77@gmail.com>

pkgname=keepalived
pkgver=2.2.4
pkgrel=1
pkgdesc='Failover and monitoring daemon for LVS clusters'
arch=('x86_64')
url='https://www.keepalived.org/'
license=('GPL2')
backup=('etc/keepalived/keepalived.conf' 'etc/sysconfig/keepalived')
makedepends=('ipset')
depends=('glibc' 'libnl' 'openssl' 'file' 'iptables' 'systemd-libs')
optdepends=('ipset: ipset support')
makedepends=('libnfnetlink' 'ipset' 'systemd')
options=('!emptydirs')
source=("https://www.keepalived.org/software/$pkgname-$pkgver.tar.gz")
sha256sums=('0138d69087d44beaaa589527f0cfa6885958b320a837147d02b6b7df73ebc1df')

build() {
  # trick broken ./configure systemctl test
  printf "#!/bin/sh\necho -.mount\n" > systemctl
  chmod +x systemctl
  PATH=$PWD:$PATH

  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --sbindir=/usr/bin \
    --localstatedir=/var \
    --runstatedir=/run
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  # move examples to /usr/share
  install -d -m 755 "$pkgdir/usr/share/$pkgname"
  mv "$pkgdir/etc/keepalived/samples" "$pkgdir/usr/share/$pkgname/samples"
}

# vim:set ts=2 sw=2 et:
