SUMMARY="Tools for using Haiku in a VMware virtual machine"
DESCRIPTION="VMware add-ons are a set of tools to enhance interaction \
between Haiku, running in a virtual machine, and the host operating system. \
It is like the official VMware tools on Windows or Linux.

It currently provides:
 * Clipboard sharing between Haiku and the host OS. Use the VMware add-ons \
desktop applet to enable or disable the sharing.
 * Mouse sharing: the mouse can seamlessly enter and leave the VM window.
 * Disk compacting: starts the VMware \"shrink\" process, which reduces the \
size of \"auto-expanding\" virtual disks attached to the virtual machine. \
The free space on disks is cleaned up previously, in order to get better \
results.
 * Graphics driver for VMware: you can choose your preferred resolution \
using the Screen preflet in Haiku.
 * Graphics driver for VirtualBox: change the graphics controller in the \
VM settings to VMSVGA, and set the video memory size to 64 MB to be able \
to use higher resolutions.
 * Shared folders: folders from the host OS can be mounted in Haiku: \
mount -t vmwfs ~/Shared
   "

HOMEPAGE="https://github.com/HaikuArchives/VMwareAddons"
COPYRIGHT="1999 Be, Inc.
	2007 Haiku, Inc.
	2009 Vincent Duvert"
LICENSE="MIT"
REVISION="2"
srcGitRev="0ad9c858e914dae1b784cfdccf20f7ba458c0a74"
SOURCE_URI="https://github.com/HaikuArchives/VMwareAddons/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="2b4869301c53d94a3f74bdc119e1e9caeb5ba94f5f389f840b4232e879cd09eb"
SOURCE_FILENAME="VMwareAddons-$srcGitRev.tar.gz"
SOURCE_DIR="VMwareAddons-$srcGitRev"

ARCHITECTURES="x86_64 x86_gcc2"

PROVIDES="
	vmware_addons = $portVersion
	cmd:run_backdoor = $portVersion
	cmd:vmware_tray = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:gcc
	cmd:make
	"

BUILD()
{
	make all $jobArgs OBJ_DIR=objects
}

INSTALL()
{
	mkdir -p $prefix/add-ons/kernel/file_systems
	cp vmware_fs/objects/vmwfs $prefix/add-ons/kernel/file_systems

	mkdir -p $prefix/add-ons/input_server/filters
	cp vmware_mouse/objects/vmware_mouse $prefix/add-ons/input_server/filters

	mkdir -p $binDir
	cp vmware_tray/objects/vmware_tray $binDir
	cp enhanced_backdoor/run_backdoor $binDir

	mkdir -p $prefix/add-ons/accelerants
	cp vmware_video/accelerant/objects/vmware.accelerant $prefix/add-ons/accelerants

	mkdir -p $prefix/add-ons/kernel/drivers/bin
	cp vmware_video/kernel/objects/vmware $prefix/add-ons/kernel/drivers/bin

	mkdir -p $prefix/add-ons/kernel/drivers/dev/graphics
	cd $prefix/add-ons/kernel/drivers/dev/graphics
	ln -s ../../bin/vmware .

	# Add a symlink to the Desktop applets directory in Deskbar
	desktopAppletsDir="$dataDir/deskbar/menu/Desktop applets"
	mkdir -p "$desktopAppletsDir"
	ln -r -s $binDir/vmware_tray "$desktopAppletsDir/VMware add-ons"
}
