# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>

pkgname=znapzend
pkgver=0.21.1
pkgrel=1
pkgdesc="ZnapZend is a ZFS centric backup tool."
arch='all'
url="http://www.znapzend.org/"
license='GPL'
depends='perl zfs mbuffer'
makedepends='perl-dev wget'
source="https://github.com/oetiker/znapzend/releases/download/v$pkgver/znapzend-$pkgver.tar.gz"
subpackages="$pkgname-doc $pkgname-openrc"
options=!check

prepare() {
	default_prepare
	sed -i 's:@BINDIR@:/usr/bin:' "init/znapzend.sysv.in"
}

build() {
	./configure --prefix="/usr/share/$pkgname"
	make
}

package() {
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir/usr/bin" "$pkgdir/etc/init.d" "$pkgdir/usr/share/man/man1"
	ln -s "/usr/share/$pkgname/bin/znapzend" "$pkgdir/usr/bin/znapzend"
	ln -s "/usr/share/$pkgname/bin/znapzendzetup" "$pkgdir/usr/bin/znapzendzetup"
	ln -s "/usr/share/$pkgname/bin/znapzendztatz" "$pkgdir/usr/bin/znapzendztatz"
	install -m 644 "init/znapzend.sysv" "$pkgdir/etc/init.d/znapzend"
	install -m 644 "man/znapzend.1" "man/znapzendzetup.1" "man/znapzendztatz.1" "$pkgdir/usr/share/man/man1"
	#chmod 777 "$pkgdir.usr/share/znapzend/lib/x86_64-linux-thread-multi/auto/List/Util/Util.so"
}
sha512sums="
2fd39109d6967d8dc434c346f7ba6d912519d71294dcc017a90727e56250298d753671986ed34e72fb45eb20fb17aa62945af055df17f2cc1ab04cd28369c649  znapzend-0.21.1.tar.gz
"
