# Template file for 'virtualbox-ose-guest'.
#
short_desc="${short_desc} - guest utilities"
long_desc="${long_desc}

 This package provides the guest utilities of the Open Source Edition of
 VirtualBox. These utilities are meant to be run inside the virtual machine.
 They provide closer integration and allow to share data through shared folders
 between the host system and the virtual machine."

Add_dependency run libgcc
Add_dependency run glibc
Add_dependency run libX11
Add_dependency run libXrandr
Add_dependency run libXt
Add_dependency run libXext
Add_dependency run libXmu
Add_dependency run libXcomposite
Add_dependency run libXdamage
Add_dependency run libXfixes
Add_dependency run pam
Add_dependency run MesaLib
Add_dependency run ${pkgname}-dkms ">=${version}"

do_install()
{
	cd ${wrksrc}
	source ./env.sh

	cd ${wrksrc}/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions
	install -d ${DESTDIR}/usr/bin ${DESTDIR}/sbin

	install -m755 VBoxClient VBoxControl VBoxService ${DESTDIR}/usr/bin
	install -m755 mount.vboxsf ${DESTDIR}/sbin
	install -m644 -D ${wrksrc}/src/VBox/Additions/x11/Installer/50-vboxmouse.conf \
		${DESTDIR}/usr/share/X11/xorg.conf.d/50-vboxmouse.conf
	install -m644 -D ${wrksrc}/src/VBox/Additions/linux/installer/70-xorg-vboxmouse.rules \
		${DESTDIR}/lib/udev/rules.d/70-xorg-vboxmouse.rules
	install -m755 -D ${wrksrc}/src/VBox/Additions/x11/Installer/98vboxadd-xclient \
		${DESTDIR}/etc/X11/Xsession.d/98vboxadd-xclient
	install -m755 -D ${wrksrc}/src/VBox/Additions/x11/Installer/vboxclient.desktop \
		${DESTDIR}/etc/xdg/autostart/vboxclient.desktop
	install -D vboxmouse_drv_19.so \
		${DESTDIR}/usr/lib/xorg/modules/input/vboxmouse.so
	install -D vboxvideo_drv_19.so \
		${DESTDIR}/usr/lib/xorg/modules/drivers/vboxvideo.so
	install -d ${DESTDIR}/usr/lib/xorg/modules/dri
	install -m755 VBoxOGL*.so ${DESTDIR}/usr/lib
	cd ${DESTDIR}/usr/lib && ln -s VBoxOGL.so \
		${DESTDIR}/usr/lib/xorg/modules/dri/vboxvideo_dri.so
	cd ${wrksrc}/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions
	install -m755 -D pam_vbox.so ${DESTDIR}/lib/security/pam_vbox.so
}
