git: 42780ffaeecd - main - emulators/qemu: Add tools FLAVOR

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sun, 12 Dec 2021 03:19:54 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=42780ffaeecd7e3ed19ddc2bdece509e1c297ca1

commit 42780ffaeecd7e3ed19ddc2bdece509e1c297ca1
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2021-12-12 03:18:49 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2021-12-12 03:19:43 +0000

    emulators/qemu: Add tools FLAVOR
---
 emulators/qemu/Makefile        | 83 ++++++++++++++++++++++++++++++------------
 emulators/qemu/pkg-descr-tools |  7 ++++
 emulators/qemu/pkg-plist-tools | 50 +++++++++++++++++++++++++
 3 files changed, 117 insertions(+), 23 deletions(-)

diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile
index ba3fcef9bdec..9abea5cf1def 100644
--- a/emulators/qemu/Makefile
+++ b/emulators/qemu/Makefile
@@ -2,37 +2,46 @@
 
 PORTNAME=	qemu
 PORTVERSION=	6.1.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.qemu.org/
 DIST_SUBDIR=	qemu/${PORTVERSION}
 
-MAINTAINER?=	bofh@FreeBSD.org
-COMMENT?=	QEMU CPU Emulator
+MAINTAINER=	bofh@FreeBSD.org
+COMMENT=	QEMU CPU Emulator
 
 LICENSE=	GPLv2
 
 BUILD_DEPENDS=	bash:shells/bash
-LIB_DEPENDS?=	libepoxy.so:graphics/libepoxy \
+.if ${FLAVOR:U} != tools
+LIB_DEPENDS=	libepoxy.so:graphics/libepoxy \
 		libfdt.so:sysutils/dtc \
 		libfontconfig.so:x11-fonts/fontconfig \
 		libfreetype.so:print/freetype2 \
 		libnettle.so:security/nettle \
 		libpcre2-8.so:devel/pcre2 \
 		libzstd.so:archivers/zstd
+.endif
 
-FLAVORS=	default nox11
-default_CONFLICTS_INSTALL=	qemu5* qemu42 qemu-devel
+FLAVORS=	default nox11 tools
+FLAVOR?=	${FLAVORS:[1]}
+default_CONFLICTS_INSTALL=	qemu5* qemu42 qemu-devel qemu-nox11 qemu-tools qemu-utils
 nox11_PKGNAMESUFFIX=		-nox11
-nox11_CONFLICTS_INSTALL=	qemu5* qemu42 qemu-devel
+nox11_CONFLICTS_INSTALL=	qemu5* qemu42 qemu-devel qemu
 nox11_COMMENT=				(without X11)
-
-.if !defined(PKGNAMESUFFIX) || (${PKGNAMESUFFIX} != "-utils" && ${PKGNAMESUFFIX} != "-guest-agent")
-ONLY_FOR_ARCHS=	amd64 powerpc powerpc64 powerpc64 powerpc64le
-USES=		bison compiler:c11 cpe gmake gnome iconv:wchar_t ninja perl5 \
-		pkgconfig python:build tar:xz xorg
-USE_GNOME=	cairo glib20 libxml2
+tools_PKGNAMESUFFIX=		-tools
+tools_COMMENT=				(tools only)
+tools_CONFLICTS_INSTALL=	qemu5* qemu42 qemu-devel qemu-nox11 qemu qemu-utils
+tools_DESCR=	${.CURDIR}/pkg-descr-tools
+tools_PLIST=	${.CURDIR}/pkg-plist-tools
+
+USES=	cpe gmake gnome ninja perl5 pkgconfig python:build tar:xz
+USE_GNOME=	glib20
 USE_PERL5=	build
+.if (empty(FLAVOR) || ${FLAVOR:U} == nox11) && (${FLAVOR:U} != tools || ${PKGNAMESUFFIX} != "-guest-agent")
+ONLY_FOR_ARCHS=	amd64 powerpc powerpc64 powerpc64 powerpc64le
+USES+=		bison compiler:c11 iconv:wchar_t xorg
+USE_GNOME=	cairo libxml2
 USE_PYTHON=	distutils noflavors
 USE_XORG=	pixman
 .endif
@@ -42,11 +51,17 @@ HAS_CONFIGURE=	yes
 OPTIONS_SINGLE=	NCURSES
 OPTIONS_SINGLE_NCURSES=	NCURSES_DEFAULT NCURSES_BASE NCURSES_PORT
 OPTIONS_DEFINE=	SAMBA X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CURL VDE \
-		CDROM_DMA USBREDIR X86_TARGETS STATIC_LINK DOCS ISCSI CAPSTONE DEBUG
+		CDROM_DMA USBREDIR X86_TARGETS STATIC_LINK DOCS ISCSI CAPSTONE DEBUG \
+		STRIP
 OPTIONS_DEFAULT=X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CDROM_DMA CURL NCURSES_DEFAULT VDE
 .if ${FLAVOR:U} == nox11
 OPTIONS_EXCLUDE:=	GTK3 X11
 .endif
+.if ${FLAVOR:U} == tools
+OPTIONS_EXCLUDE:=	SAMBA X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CURL VDE \
+		CDROM_DMA USBREDIR X86_TARGETS STATIC_LINK ISCSI CAPSTONE DEBUG \
+		NCURSES_DEFAULT NCURSES_BASE NCURSES_PORT NCURSES
+.endif
 OPTIONS_SUB=	yes
 CAPSTONE_DESC=		Disassembly framework support
 CDROM_DMA_DESC=		IDE CDROM DMA
@@ -97,6 +112,7 @@ SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
 STATIC_LINK_CONFIGURE_ON=	--static
 STATIC_LINK_PREVENTS=		GTK3 X11
 STATIC_LINK_PREVENTS_MSG=	X11 ui cannot be built static
+STRIP_CONFIGURE_OFF=	--disable-strip
 USBREDIR_BUILD_DEPENDS=	usbredir>=0.6:net/usbredir
 USBREDIR_CONFIGURE_OFF=	--disable-usb-redir
 USBREDIR_RUN_DEPENDS=	usbredir>=0.6:net/usbredir
@@ -105,31 +121,49 @@ VDE_LIB_DEPENDS=	libvdeplug.so:net/vde2
 X11_CONFIGURE_ENABLE=	sdl
 X11_USE=	SDL=sdl2 XORG=x11,xext GNOME=gdkpixbuf2
 X11_USES=	sdl
-.if !defined(PKGNAMESUFFIX) || (${PKGNAMESUFFIX} != "-utils" && ${PKGNAMESUFFIX} != "-guest-agent")
+.if (empty(FLAVOR) || ${FLAVOR:U} == nox11) && (${FLAVOR:U} != tools || ${PKGNAMESUFFIX} != "-guest-agent")
 X86_TARGETS_USE_OFF=	XORG=pixman,x11
 X86_TARGETS_USES_OFF=	xorg
 X86_TARGETS_CONFIGURE_ON=	--target-list='i386-softmmu i386-bsd-user x86_64-softmmu x86_64-bsd-user'
 .endif
 
-PORTDOCS?=	.buildinfo _static/* about/* devel/* docs genindex.html \
+PORTDOCS=	.buildinfo _static/* about/* devel/* docs genindex.html \
 		index.html interop/* objects.inv search.html searchindex.js \
 		specs/* system/* tools/* user/*
 
 WITHOUT_CPU_CFLAGS=yes	#to avoid problems with register allocation
 CFLAGS:=	${CFLAGS:C/-fno-tree-vrp//}
-CONFIGURE_ARGS?=--localstatedir=/var --extra-ldflags=-L/usr/lib \
+CONFIGURE_ARGS+=--localstatedir=/var --extra-ldflags=-L/usr/lib \
 		--extra-ldflags=-L${LOCALBASE}/lib \
-		--prefix=${PREFIX} --cc=${CC} --enable-netmap --disable-kvm \
+		--prefix=${PREFIX} --cc=${CC} --disable-kvm \
 		--disable-linux-user --disable-linux-aio --disable-xen \
-		--python=${PYTHON_CMD} --enable-fdt=system \
+		--python=${PYTHON_CMD} \
 		--extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"\"${PREFIX}\\\"\"
 
-.include <bsd.port.options.mk>
-
-.if !defined(STRIP) || ${STRIP} == ""
-CONFIGURE_ARGS+=--disable-strip
+.if ${FLAVOR:U} != tools
+CONFIGURE_ARGS+=--enable-netmap --enable-fdt=system
+.endif
+.if ${FLAVOR:U} == tools
+CONFIGURE_ARGS+=--disable-netmap --disable-system \
+			--disable-user --disable-guest-agent \
+			--disable-nettle --disable-gcrypt \
+			--disable-curses --disable-vnc \
+			--disable-virtfs --disable-brlapi \
+			--disable-fdt --disable-rdma \
+			--disable-cap-ng --disable-attr \
+			--disable-vhost-net --disable-spice \
+			--disable-rbd --disable-libnfs \
+			--disable-smartcard --disable-libusb \
+			--disable-lzo --disable-snappy \
+			--disable-bzip2 --disable-seccomp \
+			--disable-coroutine-pool --disable-glusterfs \
+			--disable-tpm --disable-numa \
+			--disable-blobs --enable-tools
 .endif
 
+.include <bsd.port.options.mk>
+
+.if (empty(FLAVOR) || ${FLAVOR:U} == nox11) && (${FLAVOR:U} != tools || ${PKGNAMESUFFIX} != "-guest-agent")
 .if ${ARCH} == "amd64"
 MAKE_ARGS+=	ARCH=x86_64
 .endif
@@ -149,6 +183,7 @@ CONFIGURE_ARGS+=	--sparc_cpu=v9
 .endif
 
 PLIST_SUB+=	LINUXBOOT_DMA=""
+.endif
 
 post-patch-CDROM_DMA-off:
 	@${REINPLACE_CMD} -e '/USE_DMA_CDROM/d' ${WRKSRC}/include/hw/ide/internal.h
@@ -161,9 +196,11 @@ do-install:
 
 .if !target(post-install)
 post-install:
+.if ${FLAVOR:U} != tools
 	${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${STAGEDIR}${PREFIX}/etc
 	${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${STAGEDIR}${PREFIX}/etc
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
+.endif
 
 post-install-DOCS-on:
 	@(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR}/)
diff --git a/emulators/qemu/pkg-descr-tools b/emulators/qemu/pkg-descr-tools
new file mode 100644
index 000000000000..f1914609c286
--- /dev/null
+++ b/emulators/qemu/pkg-descr-tools
@@ -0,0 +1,7 @@
+Miscellaneous tools that can be used without the rest of QEMU
+
+* qemu-img: QEMU disk image utility
+* qemu-io:  QEMU disk exerciser
+* qemu-nbd: QEMU disk network block device server
+
+WWW: http://wiki.qemu.org/Main_Page
diff --git a/emulators/qemu/pkg-plist-tools b/emulators/qemu/pkg-plist-tools
new file mode 100644
index 000000000000..42b2a0ee3aeb
--- /dev/null
+++ b/emulators/qemu/pkg-plist-tools
@@ -0,0 +1,50 @@
+bin/qemu-edid
+bin/qemu-img
+bin/qemu-io
+bin/qemu-nbd
+bin/qemu-storage-daemon
+include/qemu-plugin.h
+%%PORTDOCS%%man/man1/qemu.1.gz
+%%PORTDOCS%%man/man1/qemu-img.1.gz
+%%PORTDOCS%%man/man7/qemu-block-drivers.7.gz
+%%PORTDOCS%%man/man7/qemu-cpu-models.7.gz
+%%PORTDOCS%%man/man8/qemu-nbd.8.gz
+%%PORTDOCS%%man/man8/qemu-pr-helper.8.gz
+%%PORTDOCS%%man/man7/qemu-qmp-ref.7.gz
+%%PORTDOCS%%man/man1/qemu-storage-daemon.1.gz
+%%PORTDOCS%%man/man7/qemu-storage-daemon-qmp-ref.7.gz
+%%DATADIR%%/keymaps/ar
+%%DATADIR%%/keymaps/bepo
+%%DATADIR%%/keymaps/cz
+%%DATADIR%%/keymaps/da
+%%DATADIR%%/keymaps/de
+%%DATADIR%%/keymaps/de-ch
+%%DATADIR%%/keymaps/en-gb
+%%DATADIR%%/keymaps/en-us
+%%DATADIR%%/keymaps/es
+%%DATADIR%%/keymaps/et
+%%DATADIR%%/keymaps/fi
+%%DATADIR%%/keymaps/fo
+%%DATADIR%%/keymaps/fr
+%%DATADIR%%/keymaps/fr-be
+%%DATADIR%%/keymaps/fr-ca
+%%DATADIR%%/keymaps/fr-ch
+%%DATADIR%%/keymaps/hr
+%%DATADIR%%/keymaps/hu
+%%DATADIR%%/keymaps/is
+%%DATADIR%%/keymaps/it
+%%DATADIR%%/keymaps/ja
+%%DATADIR%%/keymaps/lt
+%%DATADIR%%/keymaps/lv
+%%DATADIR%%/keymaps/mk
+%%DATADIR%%/keymaps/nl
+%%DATADIR%%/keymaps/no
+%%DATADIR%%/keymaps/pl
+%%DATADIR%%/keymaps/pt
+%%DATADIR%%/keymaps/pt-br
+%%DATADIR%%/keymaps/ru
+%%DATADIR%%/keymaps/sl
+%%DATADIR%%/keymaps/sv
+%%DATADIR%%/keymaps/th
+%%DATADIR%%/keymaps/tr
+%%DATADIR%%/trace-events-all