git: 07b536b871ab - 2022Q2 - sysutils/bhyve+: Fix build on 14-CURRENT and 13.1-RELEASE

From: Ashish SHUKLA <ashish_at_FreeBSD.org>
Date: Tue, 26 Apr 2022 13:17:23 UTC
The branch 2022Q2 has been updated by ashish:

URL: https://cgit.FreeBSD.org/ports/commit/?id=07b536b871ab054a2cc0fd6448e27d65068457f7

commit 07b536b871ab054a2cc0fd6448e27d65068457f7
Author:     PÁLI Gábor János <pali.gabor@gmail.com>
AuthorDate: 2022-04-26 01:06:08 +0000
Commit:     Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2022-04-26 13:16:46 +0000

    sysutils/bhyve+:  Fix build on 14-CURRENT and 13.1-RELEASE
    
    Reported by:    pkg-fallout
    MFH:            2022Q2
    
    (cherry picked from commit df1f981df36889224517d232228c417be13d7934)
---
 sysutils/bhyve+/Makefile                           |  9 ++++--
 .../files/freebsd-13/{ => 0}/patch-custom-libs     |  0
 .../bhyve+/files/freebsd-13/{ => 0}/patch-lib9p    |  0
 .../files/freebsd-13/{ => 0}/patch-libvmmapi       |  0
 .../files/freebsd-13/{ => 0}/patch-msi-x-mappings  |  0
 .../bhyve+/files/freebsd-13/1/patch-custom-libs    | 21 +++++++++++++
 sysutils/bhyve+/files/freebsd-13/1/patch-lib9p     | 12 ++++++++
 sysutils/bhyve+/files/freebsd-13/1/patch-libvmmapi | 34 ++++++++++++++++++++++
 8 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/sysutils/bhyve+/Makefile b/sysutils/bhyve+/Makefile
index d418e71834f0..920d250e3171 100644
--- a/sysutils/bhyve+/Makefile
+++ b/sysutils/bhyve+/Makefile
@@ -18,7 +18,8 @@ SRCS=		${SRC_BASE}/sys/modules/vmm \
 		${SRC_BASE}/usr.sbin/bhyve \
 		${SRC_BASE}/usr.sbin/bhyvectl \
 		${SRC_BASE}/usr.sbin/bhyveload \
-		${SRC_BASE}/share/mk
+		${SRC_BASE}/share/mk \
+		${SRC_BASE}/contrib/bmake/mk
 
 .for _src in ${SRCS}
 .  if !exists(${_src}) && empty(IGNORE)
@@ -35,8 +36,10 @@ USE_LDCONFIG=	yes
 
 .if 1200000 <= ${OSVERSION} && ${OSVERSION} < 1300000
 EXTRA_PATCHES=	${PATCHDIR}/freebsd-12 ${PATCHDIR}/freebsd-12/3
-.elif 1300000 <= ${OSVERSION} && ${OSVERSION} < 1400000
-EXTRA_PATCHES=	${PATCHDIR}/freebsd-13
+.elif 1300000 <= ${OSVERSION} && ${OSVERSION} < 1301000
+EXTRA_PATCHES=	${PATCHDIR}/freebsd-13/0
+.elif 1301000 <= ${OSVERSION} && ${OSVERSION} < 1400000
+EXTRA_PATCHES=	${PATCHDIR}/freebsd-13/1
 .elif 1400000 <= ${OSVERSION} && ${OSVERSION} < 1500000
 EXTRA_PATCHES=	${PATCHDIR}/freebsd-14
 .else
diff --git a/sysutils/bhyve+/files/freebsd-13/patch-custom-libs b/sysutils/bhyve+/files/freebsd-13/0/patch-custom-libs
similarity index 100%
rename from sysutils/bhyve+/files/freebsd-13/patch-custom-libs
rename to sysutils/bhyve+/files/freebsd-13/0/patch-custom-libs
diff --git a/sysutils/bhyve+/files/freebsd-13/patch-lib9p b/sysutils/bhyve+/files/freebsd-13/0/patch-lib9p
similarity index 100%
rename from sysutils/bhyve+/files/freebsd-13/patch-lib9p
rename to sysutils/bhyve+/files/freebsd-13/0/patch-lib9p
diff --git a/sysutils/bhyve+/files/freebsd-13/patch-libvmmapi b/sysutils/bhyve+/files/freebsd-13/0/patch-libvmmapi
similarity index 100%
rename from sysutils/bhyve+/files/freebsd-13/patch-libvmmapi
rename to sysutils/bhyve+/files/freebsd-13/0/patch-libvmmapi
diff --git a/sysutils/bhyve+/files/freebsd-13/patch-msi-x-mappings b/sysutils/bhyve+/files/freebsd-13/0/patch-msi-x-mappings
similarity index 100%
rename from sysutils/bhyve+/files/freebsd-13/patch-msi-x-mappings
rename to sysutils/bhyve+/files/freebsd-13/0/patch-msi-x-mappings
diff --git a/sysutils/bhyve+/files/freebsd-13/1/patch-custom-libs b/sysutils/bhyve+/files/freebsd-13/1/patch-custom-libs
new file mode 100644
index 000000000000..cee70aee6367
--- /dev/null
+++ b/sysutils/bhyve+/files/freebsd-13/1/patch-custom-libs
@@ -0,0 +1,21 @@
+--- usr.sbin/bhyve/Makefile.orig	2022-04-26 00:11:28.231312000 +0000
++++ usr.sbin/bhyve/Makefile	2022-04-26 00:12:31.807022000 +0000
+@@ -3,7 +3,7 @@
+ #
+ 
+ .include <src.opts.mk>
+-CFLAGS+=-I${.CURDIR}/../../contrib/lib9p
++CFLAGS+=-I${SRCTOP}/contrib/lib9p
+ CFLAGS+=-I${SRCTOP}/sys
+ .PATH:  ${SRCTOP}/sys/cam/ctl
+ 
+@@ -84,7 +84,8 @@
+ .PATH:  ${BHYVE_SYSDIR}/sys/amd64/vmm
+ SRCS+=	vmm_instruction_emul.c
+ 
+-LIBADD=	vmmapi md nv pthread z util sbuf cam 9p
++LIBADD=	md nv pthread z util sbuf cam
++LDADD= ../../contrib/lib9p/lib9p.so.1.1 ../../lib/libvmmapi/libvmmapi.so.5.1
+ 
+ .if ${MK_CASPER} != "no"
+ LIBADD+=	casper
diff --git a/sysutils/bhyve+/files/freebsd-13/1/patch-lib9p b/sysutils/bhyve+/files/freebsd-13/1/patch-lib9p
new file mode 100644
index 000000000000..b60692f4f5a5
--- /dev/null
+++ b/sysutils/bhyve+/files/freebsd-13/1/patch-lib9p
@@ -0,0 +1,12 @@
+--- share/mk/src.libnames.mk.orig	2022-04-26 00:33:13.464870000 +0000
++++ share/mk/src.libnames.mk	2022-04-26 00:34:36.615330000 +0000
+@@ -265,6 +265,9 @@
+ # 2nd+ order consumers.  Auto-generating this would be better.
+ _DP_80211=	sbuf bsdxml
+ _DP_9p=		sbuf
++.if ${MK_CASPER} != "no"
++_DP_9p+=       casper cap_pwd cap_grp
++.endif
+ # XXX: Not bootstrapped so uses host version on non-FreeBSD, so don't use a
+ # FreeBSD-specific dependency list
+ .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
diff --git a/sysutils/bhyve+/files/freebsd-13/1/patch-libvmmapi b/sysutils/bhyve+/files/freebsd-13/1/patch-libvmmapi
new file mode 100644
index 000000000000..5bb87bd36d46
--- /dev/null
+++ b/sysutils/bhyve+/files/freebsd-13/1/patch-libvmmapi
@@ -0,0 +1,34 @@
+--- usr.sbin/bhyvectl/Makefile.orig	2022-04-26 00:35:36.192928000 +0000
++++ usr.sbin/bhyvectl/Makefile	2022-04-26 00:36:35.181368000 +0000
+@@ -10,7 +10,8 @@
+ 
+ MAN=	bhyvectl.8
+ 
+-LIBADD=	vmmapi util
++LIBADD=	util
++LDADD= ../../lib/libvmmapi/libvmmapi.so.5.1
+ 
+ WARNS?=	3
+ 
+--- usr.sbin/bhyveload/Makefile.orig	2022-04-26 00:36:44.251099000 +0000
++++ usr.sbin/bhyveload/Makefile	2022-04-26 00:37:15.919627000 +0000
+@@ -5,7 +5,7 @@
+ MAN=	bhyveload.8
+ PACKAGE=	bhyve
+ 
+-LIBADD=	vmmapi
++LDADD= ../../lib/libvmmapi/libvmmapi.so.5.1
+ 
+ WARNS?=	3
+ 
+--- lib/libvmmapi/Makefile.orig	2022-04-26 00:37:35.557718000 +0000
++++ lib/libvmmapi/Makefile	2022-04-26 00:38:23.135897000 +0000
+@@ -5,6 +5,8 @@
+ SRCS=	vmmapi.c vmmapi_freebsd.c
+ INCS=	vmmapi.h
+ 
++SHLIB_MAJOR?=	5.1
++
+ LIBADD=	util
+ 
+ CFLAGS+= -I${.CURDIR}