# Template file for 'incron'
pkgname=incron
version=0.5.12
revision=3
short_desc="Daemon that executes commands due to inotify events"
maintainer="Orphaned <orphan@voidlinux.org>"
license="X11"
homepage="https://github.com/ar-/incron"
distfiles="https://github.com/ar-/incron/archive/${version}.tar.gz"
checksum=cce80bd723bafce59f35464f2f851d02707e32efa102e2b941ed0e42bdd38f91

make_dirs="/var/spool/incron 0755 root root
 /etc/incron.d 0755 root root"

case "$XBPS_TARGET_MACHINE" in
	*-musl) makedepends="argp-standalone";;
esac

export CXXFLAGS="--std=c++14"

do_build() {
	sed -i 's,sbin,bin,g' Makefile
	sed -i '1,1i#include <unistd.h>' inotify-cxx.cpp icd-main.cpp
	sed -i '1,1i#include <stdio.h>' icd-main.cpp inotify-cxx.cpp \
		usertable.cpp appargs.cpp
	sed -i 's|strchr(s,|(char*)strchr(s,|' incroncfg.cpp
	make CC=$CC ${makejobs}
}

do_install() {
	make PREFIX=/usr DESTDIR=${DESTDIR} install
	vsv incron
	vlicense LICENSE-X11

	# thefuck?
	rm ${DESTDIR}/etc/init
}
