# Template file for 'libcap'
pkgname=libcap
version=2.20
distfiles="${KERNEL_SITE}/libs/security/linux-privs/libcap2/$pkgname-$version.tar.bz2"
build_style=custom-install
short_desc="POSIX.1e capabilities library"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=20e7c1ea4d3d5c410efb3a6ff138dc417912fae316d883460dcd58d9803a9220
long_desc="
 libcap is a library for getting and setting POSIX.1e (formerly POSIX 6)
 draft 15 capabilities."

subpackages="$pkgname-devel $pkgname-pam $pkgname-progs"
Add_dependency run glibc
Add_dependency run attr
Add_dependency build perl
Add_dependency build pam-devel
Add_dependency build attr-devel

do_build()
{
	sed -i -e "s|LIBDIR=\$(FAKEROOT)\$(lib_prefix)\/lib|LIBDIR=\$(FAKEROOT)/\$(lib)|g" \
		${wrksrc}/Make.Rules
	make ${makejobs}
}

do_install()
{
	if [ "$xbps_machine" = "x86_64" ]; then
		mkdir -p ${DESTDIR}/usr/lib
		cd ${DESTDIR}/usr && ln -s lib lib64 && cd ${wrksrc}
	fi

	make DESTDIR=${DESTDIR} prefix=/usr RAISE_SETFCAP=no install

	install -D -m644 ${wrksrc}/pam_cap/capability.conf \
		${DESTDIR}/etc/security/capability.conf
	mkdir -p ${DESTDIR}/lib
	mv ${DESTDIR}/usr/lib/security ${DESTDIR}/lib
	rm -f ${DESTDIR}/usr/lib64
}
