# Template file for 'xplugd'
pkgname=xplugd
version=1.3
revision=1
build_style=gnu-configure
hostmakedepends="automake pkg-config"
makedepends="libXi-devel libXrandr-devel"
short_desc="Daemon that executes a script on X input and RandR changes"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="MIT"
homepage="https://github.com/troglobit/xplugd"
distfiles="https://github.com/troglobit/xplugd/archive/v${version}.tar.gz"
checksum=540345853aa02f7a6e2d39f3437cedcaa1367a9e3c318a4b4ba640a859aebc52

case "$XBPS_TARGET_MACHINE" in
*-musl) makedepends+=" libglob-devel";;
esac

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)
		sed -e '/include/s,glob.h,libglob/glob.h,g' \
			-e '/GLOB_TILDE/s/glob(/g_glob(/g' \
			-e 's/globfree(/g_globfree(/g' \
			-i xplugd.c
		export LIBS="$XBPS_CROSS_BASE/usr/lib/libglob.a"
		;;
	esac

	./autogen.sh
}

post_install() {
	vlicense LICENSE
	rm -f ${DESTDIR}/usr/share/doc/xplugd/LICENSE
}
