# Template file for 'libgudev'

. ${XBPS_SRCPKGDIR}/udev/template
unset revision run_depends openrc_services conf_files subpackages
unset keep_empty_dirs post_install

pkgname=libgudev
wrksrc="udev-${version}"
build_style=custom-install
short_desc="/dev/ and hotplug management daemon (glib bindings)"
long_desc="
 udev is a daemon which dynamically creates and removes device nodes from
 /dev/, handles hotplug events and loads drivers at boot time.

 This package contains libgudev, a library to interact with udev through
 the GLib bindings."

subpackages="libgudev-devel"

Add_dependency run glibc
Add_dependency run libudev
Add_dependency run glib
Add_dependency build gobject-introspection

do_build()
{
	./configure ${configure_args} --enable-gudev --enable-introspection
	make ${makejobs}
}

do_install()
{
	make DESTDIR=${DESTDIR} install

	mkdir -p ${wrksrc}/tmp/lib ${wrksrc}/tmp/usr/lib/pkgconfig \
		${wrksrc}/tmp/usr/share/gtk-doc/html ${wrksrc}/tmp/usr/include

	mv ${DESTDIR}/lib/libgudev* ${wrksrc}/tmp/lib
	mv ${DESTDIR}/usr/lib/libgudev* ${wrksrc}/tmp/usr/lib
	mv ${DESTDIR}/usr/lib/girepository* ${wrksrc}/tmp/usr/lib
	mv ${DESTDIR}/usr/include/gudev* ${wrksrc}/tmp/usr/include
	mv ${DESTDIR}/usr/lib/pkgconfig/gudev* \
		${wrksrc}/tmp/usr/lib/pkgconfig
	mv ${DESTDIR}/usr/share/gtk-doc/html/gudev \
		${wrksrc}/tmp/usr/share/gtk-doc/html
	mv ${DESTDIR}/usr/share/gir* ${wrksrc}/tmp/usr/share
	rm -rf ${DESTDIR}/*
	mv ${wrksrc}/tmp/* ${DESTDIR}
}
