qemu-guest-agent: New doc option.
authorTaylor R Campbell <riastradh@NetBSD.org>
Mon, 10 Mar 2025 17:54:08 +0000 (17:54 +0000)
committerTaylor R Campbell <riastradh@NetBSD.org>
Mon, 10 Mar 2025 19:44:54 +0000 (19:44 +0000)
Avoids pulling in the whole python sphinx toolchain just for one
little tool.

No functional change intended unless you specify
PLIST_OPTIONS.qemu-guest-agent+= -doc.

qemu-guest-agent/Makefile
qemu-guest-agent/PLIST
qemu-guest-agent/options.mk [new file with mode: 0644]

index 87a62ffbc3af34e245f44925f20cac939ab3d6f4..54859dca919c57c5c6c998a1c923851b6664ba40 100644 (file)
@@ -13,8 +13,6 @@ LICENSE=      gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd
 
 TOOL_DEPENDS+= meson-[0-9]*:../../devel/meson
 TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
-TOOL_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
-TOOL_DEPENDS+= ${PYPKGPREFIX}-sphinx-rtd-theme>=1.2.0:../../textproc/py-sphinx-rtd-theme
 
 PYTHON_VERSIONS_INCOMPATIBLE=  39 310 # py-sphinx
 
@@ -30,6 +28,8 @@ RCD_SCRIPTS=          qemu-guest-agent
 # https://github.com/qemu/qemu/commit/56208a0d473c6db263cc333c787ca48b502d72ab
 GCC_REQD+=             7
 
+.include "options.mk"
+
 .include "../../mk/bsd.prefs.mk"
 
 CONFIGURE_ARGS+=       --prefix=${PREFIX}
@@ -50,7 +50,6 @@ CONFIGURE_ARGS+=      --disable-bzip2
 CONFIGURE_ARGS+=       --disable-cap-ng
 CONFIGURE_ARGS+=       --disable-coroutine-pool
 CONFIGURE_ARGS+=       --disable-curses
-#CONFIGURE_ARGS+=      --disable-docs
 CONFIGURE_ARGS+=       --disable-fdt
 CONFIGURE_ARGS+=       --disable-gcrypt
 CONFIGURE_ARGS+=       --disable-glusterfs
@@ -89,14 +88,14 @@ do-install:
        cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
                ninja -j ${_MAKE_JOBS_N:U1} -C build install
        # not needed for guest agent
-       ${RM} -r ${DESTDIR}${PREFIX}/include/qemu-plugin.h
-       ${RM} -r ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/qemu.1
-       ${RM} -r ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-block-drivers.7
-       ${RM} -r ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-cpu-models.7
-       ${RM} -r ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-qmp-ref.7
-       ${RM} -r ${DESTDIR}${PREFIX}/share/doc/qemu
-       ${RM} -r ${DESTDIR}${PREFIX}/share/qemu/keymaps
-       ${RM} -r ${DESTDIR}${PREFIX}/share/qemu/trace-events-all
+       ${RM} -f ${DESTDIR}${PREFIX}/include/qemu-plugin.h
+       ${RM} -f ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/qemu.1
+       ${RM} -f ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-block-drivers.7
+       ${RM} -f ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-cpu-models.7
+       ${RM} -f ${DESTDIR}${PREFIX}/${PKGMANDIR}/man7/qemu-qmp-ref.7
+       ${RM} -rf ${DESTDIR}${PREFIX}/share/doc/qemu
+       ${RM} -rf ${DESTDIR}${PREFIX}/share/qemu/keymaps
+       ${RM} -rf ${DESTDIR}${PREFIX}/share/qemu/trace-events-all
 
 # Some dependencies aren't correct and this tries to be re-made on install,
 # failing due to configure bugs.
index 4745c04d0361a21f24ef1a4e942d6a4267130aa6..bd8cca89907791d9744b5b4995a80dff3e62b7b0 100644 (file)
@@ -1,4 +1,4 @@
 @comment $NetBSD$
 bin/qemu-ga
-man/man7/qemu-ga-ref.7
-man/man8/qemu-ga.8
+${PLIST.doc}man/man7/qemu-ga-ref.7
+${PLIST.doc}man/man8/qemu-ga.8
diff --git a/qemu-guest-agent/options.mk b/qemu-guest-agent/options.mk
new file mode 100644 (file)
index 0000000..7287469
--- /dev/null
@@ -0,0 +1,18 @@
+#      $NetBSD$
+
+PKG_OPTIONS_VAR=       PKG_OPTIONS.qemu-guest-agent
+PKG_SUPPORTED_OPTIONS+=        doc
+PKG_SUGGESTED_OPTIONS+=        doc
+
+PLIST_VARS+=           doc
+
+.include "../../mk/bsd.options.mk"
+
+.if ${PKG_OPTIONS:Mdoc}
+PLIST.doc=             yes
+CONFIGURE_ARGS+=       --enable-docs
+TOOL_DEPENDS+=         ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
+TOOL_DEPENDS+=         ${PYPKGPREFIX}-sphinx-rtd-theme>=1.2.0:../../textproc/py-sphinx-rtd-theme
+.else
+CONFIGURE_ARGS+=       --disable-docs
+.endif