# Template file for 'open-vm-tools'
pkgname=open-vm-tools
version=10.2.5
revision=3
_build=8068406
wrksrc=$pkgname-$version-$_build
configure_args="--sbindir=/usr/bin --with-udev-rules-dir=/usr/lib/udev/rules.d
 --without-xmlsecurity --without-kernel-modules
 $(vopt_with x11 x) $(vopt_with pam)"
build_style=gnu-configure
hostmakedepends="automake libtool pkg-config rpcgen"
makedepends="fuse-devel glib-devel icu-devel libdnet-devel libmspack-devel
 libressl-devel libxerces-c-devel procps-ng-devel $(vopt_if pam 'pam-devel')
 $(vopt_if x11 'gtkmm-devel libXtst-devel xmlsec1-devel')"
short_desc="The open source implementation of VMware Tools"
maintainer="Carson Page <pagem.carson@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://github.com/vmware/open-vm-tools"
distfiles="$homepage/releases/download/stable-$version/$pkgname-$version-$_build.tar.gz"
checksum=d53be10cfa48bc4853e5fa8e16b416b11d01487d7bade226e8f79da7e9d1c2f3

build_options="pam x11"
build_options_default="pam x11"

case "$XBPS_TARGET_MACHINE" in
	*-musl) broken="Musl requires addl. patches";;
	"arm"*|"aarch"*) broken=yes;;
esac

pre_configure() {
	autoreconf -vfi
}

post_install() {
	# Get rid of unwanted symlinks
	rm ${DESTDIR}/sbin/mount.vmhgfs
	rm -r ${DESTDIR}/sbin
	# If X11 enabled, copy extra files
	if [ $build_option_x11 ]; then
		vmkdir /etc/xdg/autostart
		vinstall vmware-user-suid-wrapper/vmware-user.desktop 0644 /etc/xdg/autostart/
		vbin scripts/common/vmware-xdg-detect-de
		chmod 07755 ${DESTDIR}/usr/bin/vmware-user-suid-wrapper
	fi
	# Install service
	vsv vmtoolsd
}

