git: 6b0def58e213 - main - emulators/open-vm-tools: Add DEPLOYPKG option

From: Renato Botelho <garga_at_FreeBSD.org>
Date: Wed, 19 Jul 2023 15:38:49 UTC
The branch main has been updated by garga:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6b0def58e21327b708a50ad5afd7d8ddc77438d1

commit 6b0def58e21327b708a50ad5afd7d8ddc77438d1
Author:     Renato Botelho <garga@FreeBSD.org>
AuthorDate: 2023-07-19 15:34:29 +0000
Commit:     Renato Botelho <garga@FreeBSD.org>
CommitDate: 2023-07-19 15:38:44 +0000

    emulators/open-vm-tools: Add DEPLOYPKG option
    
    Before this change, open-vm-tools port used to depend inconditionally of
    libmspack, which is a requirement of DeployPkg plugin.  It turns out
    that configure script only enable this plugin automatically on linux, so
    it was not being built and dependency was not supposed to be there.
    
    Instead of removing bogus dependency, I decided to add DEPLOYPKG option,
    used to enable that plugin and left it off by default in order to
    preserve previous default behavior.
    
    Some changes on source code were needed to make DeployPkg to build on
    FreeBSD and are done by new patches, which I intend to submit upstream.
    
    Reported by:    vangyzen
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 emulators/open-vm-tools/Makefile                         | 10 +++++++---
 .../files/patch-libDeployPkg_processPosix.c              | 11 +++++++++++
 emulators/open-vm-tools/files/patch-lib_panic_panic.c    | 11 +++++++++++
 .../open-vm-tools/files/patch-lib_procMgr_procMgrPosix.c | 11 +++++++++++
 emulators/open-vm-tools/pkg-plist                        | 16 ++++++++++++++++
 5 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/emulators/open-vm-tools/Makefile b/emulators/open-vm-tools/Makefile
index d90505341720..436a464e4965 100644
--- a/emulators/open-vm-tools/Makefile
+++ b/emulators/open-vm-tools/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	open-vm-tools
 PORTVERSION=	12.2.5
 DISTVERSIONPREFIX=	stable-
+PORTREVISION=	1
 PORTEPOCH=	2
 CATEGORIES=	emulators
 
@@ -13,8 +14,7 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 ONLY_FOR_ARCHS=	aarch64 amd64 i386
 
-LIB_DEPENDS=	libdnet.so:net/libdnet \
-		libmspack.so:archivers/libmspack
+LIB_DEPENDS=	libdnet.so:net/libdnet
 
 FLAVORS=			default nox11
 default_CONFLICTS_INSTALL=	open-vm-tools-nox11
@@ -34,6 +34,7 @@ USE_RC_SUBR=	vmware-guestd vmware-kmod
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS+=--disable-vgauth \
 		--enable-containerinfo=no \
+		--enable-deploypkg \
 		--sysconfdir=${PREFIX}/etc \
 		--without-icu
 CONFIGURE_ENV+=	SYSDIR=${SRC_BASE}/sys
@@ -47,15 +48,18 @@ WRKSRC_SUBDIR=	open-vm-tools
 
 PORTDOCS=	*
 
-OPTIONS_DEFINE=	DOCS FUSE LIBNOTIFY OPENSSL X11
+OPTIONS_DEFINE=	DOCS DEPLOYPKG FUSE LIBNOTIFY OPENSSL X11
 OPTIONS_DEFAULT=DOCS FUSE LIBNOTIFY OPENSSL X11
 .if ${FLAVOR:U} == nox11
 OPTIONS_EXCLUDE:=	LIBNOTIFY X11
 .endif
 OPTIONS_SUB=
 
+DEPLOYPKG_DESC=		DeployPkg plugin
 LIBNOTIFY_DESC=		Desktop notification support
 
+DEPLOYPKG_LIB_DEPENDS=	libmspack.so:archivers/libmspack
+DEPLOYPKG_CONFIGURE_ENABLE=	deploypkg
 DOCS_BUILD_DEPENDS=	doxygen:devel/doxygen
 DOCS_CONFIGURE_ENABLE=	docs
 FUSE_USES=		fuse
diff --git a/emulators/open-vm-tools/files/patch-libDeployPkg_processPosix.c b/emulators/open-vm-tools/files/patch-libDeployPkg_processPosix.c
new file mode 100644
index 000000000000..966cfa5827fe
--- /dev/null
+++ b/emulators/open-vm-tools/files/patch-libDeployPkg_processPosix.c
@@ -0,0 +1,11 @@
+--- libDeployPkg/processPosix.c.orig	2023-07-18 17:10:48 UTC
++++ libDeployPkg/processPosix.c
+@@ -28,6 +28,8 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/wait.h>
++#include <sys/types.h>
++#include <signal.h>
+ #include <stdlib.h>
+ 
+ #include "util.h"
diff --git a/emulators/open-vm-tools/files/patch-lib_panic_panic.c b/emulators/open-vm-tools/files/patch-lib_panic_panic.c
new file mode 100644
index 000000000000..555962fa2039
--- /dev/null
+++ b/emulators/open-vm-tools/files/patch-lib_panic_panic.c
@@ -0,0 +1,11 @@
+--- lib/panic/panic.c.orig	2023-06-12 23:13:35 UTC
++++ lib/panic/panic.c
+@@ -34,6 +34,8 @@
+ #  include <signal.h>
+ #  ifdef __APPLE__
+ #    include <TargetConditionals.h>
++#  endif
++#  if defined (__APPLE__) || defined (__FreeBSD__)
+ #    include <sys/types.h>
+ #    include <sys/sysctl.h>
+ #  endif
diff --git a/emulators/open-vm-tools/files/patch-lib_procMgr_procMgrPosix.c b/emulators/open-vm-tools/files/patch-lib_procMgr_procMgrPosix.c
new file mode 100644
index 000000000000..a4088489e16a
--- /dev/null
+++ b/emulators/open-vm-tools/files/patch-lib_procMgr_procMgrPosix.c
@@ -0,0 +1,11 @@
+--- lib/procMgr/procMgrPosix.c.orig	2023-07-18 17:10:48 UTC
++++ lib/procMgr/procMgrPosix.c
+@@ -58,6 +58,8 @@
+ #include <limits.h>
+ #include <paths.h>
+ #include <sys/sysctl.h>
++#include <sys/types.h>
++#include <signal.h>
+ #endif
+ #if defined(__APPLE__)
+ #include <sys/sysctl.h>
diff --git a/emulators/open-vm-tools/pkg-plist b/emulators/open-vm-tools/pkg-plist
index ae96eabc1925..7ae249592b27 100644
--- a/emulators/open-vm-tools/pkg-plist
+++ b/emulators/open-vm-tools/pkg-plist
@@ -13,10 +13,24 @@ bin/vmware-toolbox-cmd
 bin/vmware-xferlogs
 etc/pam.d/vmtoolsd
 %%X11%%etc/xdg/autostart/vmware-user.desktop
+%%DEPLOYPKG%%include/libDeployPkg/deployPkgFormat.h
+%%DEPLOYPKG%%include/libDeployPkg/deploypkg.h
+%%DEPLOYPKG%%include/libDeployPkg/guestcust-events.h
+%%DEPLOYPKG%%include/libDeployPkg/guestrpc.h
+%%DEPLOYPKG%%include/libDeployPkg/imgcust-api.h
+%%DEPLOYPKG%%include/libDeployPkg/includeCheck.h
+%%DEPLOYPKG%%include/libDeployPkg/linuxDeployment.h
+%%DEPLOYPKG%%include/libDeployPkg/log.h
+%%DEPLOYPKG%%include/libDeployPkg/process.h
+%%DEPLOYPKG%%include/libDeployPkg/vm_basic_types.h
 include/vmGuestLib/includeCheck.h
 include/vmGuestLib/vmGuestLib.h
 include/vmGuestLib/vmSessionId.h
 include/vmGuestLib/vm_basic_types.h
+%%DEPLOYPKG%%lib/libDeployPkg.a
+%%DEPLOYPKG%%lib/libDeployPkg.so
+%%DEPLOYPKG%%lib/libDeployPkg.so.0
+%%DEPLOYPKG%%lib/libDeployPkg.so.0.0.0
 lib/libguestlib.a
 lib/libguestlib.so
 lib/libguestlib.so.0
@@ -31,6 +45,7 @@ lib/libvmtools.so.0
 lib/libvmtools.so.0.0.0
 lib/open-vm-tools/plugins/common/libhgfsServer.so
 lib/open-vm-tools/plugins/common/libvix.so
+%%DEPLOYPKG%%lib/open-vm-tools/plugins/vmsvc/libdeployPkgPlugin.so
 lib/open-vm-tools/plugins/vmsvc/libguestInfo.so
 lib/open-vm-tools/plugins/vmsvc/libpowerOps.so
 lib/open-vm-tools/plugins/vmsvc/libtimeSync.so
@@ -40,6 +55,7 @@ lib/open-vm-tools/plugins/vmsvc/libvmbackup.so
 %%X11%%lib/open-vm-tools/plugins/vmusr/libresolutionSet.so
 lib/vmware-tools/modules/drivers/vmblock.ko
 lib/vmware-tools/modules/drivers/vmmemctl.ko
+%%DEPLOYPKG%%libdata/pkgconfig/libDeployPkg.pc
 libdata/pkgconfig/vmguestlib.pc
 sbin/mount_vmblock
 %%DATADIR%%/messages/de/toolboxcmd.vmsg