# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lsyncd
pkgver=2.2.2
pkgrel=0
pkgdesc="Live Syncing (Mirror) Daemon"
url="https://github.com/axkibe/lsyncd"
arch="all"
license="GPL-2.0-or-later"
depends="rsync"
makedepends="$depends_dev cmake lua lua-dev"
options="!check"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/axkibe/lsyncd/archive/release-$pkgver.tar.gz
	fix-realpath.patch
	fix-mandir.patch
	lpostcmd.patch
	$pkgname.initd"
builddir="$srcdir"/lsyncd-release-$pkgver

build() {
	cd "$builddir"
	cmake -DCMAKE_INSTALL_PREFIX=/usr \
		-DINSTALL_MANDIR=/usr/share
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir/etc/lsyncd"
	cp "$builddir"/examples/*.lua \
		"$pkgdir"/etc/lsyncd/
	install -Dm755 "$srcdir/$pkgname.initd" \
		"$pkgdir/etc/init.d/$pkgname"

}

sha512sums="489d4fc91787a53f1480749fce6a281406aedb7e3617cd5f383b30c47870b2a8a912317a3faee5ad5f6358c10a136a69e07ee854f753846be1e11023cea5fed0  lsyncd-2.2.2.tar.gz
2cebaf59d960321c2eda4ef1e0d850f62eb7eedb7ba8922a5db33a7f78c769d1a52839fbb597ae06ba576632e2abc7b92a6ba2eaf58b71b93bc877db83e25576  fix-realpath.patch
00508996b83297fd069bd4580581859d5ef696ec906a2011d62f2582630c7d98188a851490f5503ba1302ef34f56e6b36780a1ce00806dbeeb62421e2ef8283d  fix-mandir.patch
d0f971e99726fd5b7157928f4c790b9aeaf05becd23a2898101b89567297816c866b13cddb8b91cbe87cf3e0c05e3a613896c28f2926269c21f4f857ce1de189  lpostcmd.patch
441b76ec944d9d74100dfca55efe871e9092b37cd49ec79a2a94e281dc0326b4def1645a827f7d3edcddc95d6e74c99621b62991396fb3693b1832c42fd86cdc  lsyncd.initd"
