# Template file for 'lockdev'
pkgname=lockdev
version=1.0.3
revision=5
short_desc="Run-time shared library for locking devices"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://packages.qa.debian.org/l/lockdev.html"
license="LGPL-2.1"
distfiles="${DEBIAN_SITE}/main/l/${pkgname}/${pkgname}_${version}.orig.tar.gz"
checksum=ccae635d7ac3fdd50897eceb250872b3d9a191d298f213e7f0c836910d869f82

do_build() {
	case "$XBPS_TARGET_MACHINE" in
		*-musl) CFLAGS+=" -D__GNU_LIBRARY__"
			;;
	esac
	make CC=$CC shared CFLAGS="${CFLAGS} -D_PATH_LOCK=\\\"/run/lock/lockdev\\\" -fPIC"
	make CC=$CC static CFLAGS="${CFLAGS} -D_PATH_LOCK=\\\"/run/lock/lockdev\\\" -fPIC"
}

do_install() {
	make basedir=${DESTDIR}/usr install
	for f in so so.1; do
		ln -sr ${DESTDIR}/usr/lib/liblockdev.${version}.so \
			${DESTDIR}/usr/lib/liblockdev.${f}
	done
}

lockdev-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove usr/share
	}
}
