changeset 281:490aed463971

Implement a DOCS make option to build manual pages. BUGS: Just the by default generated local-bsdtools(1) page is included yet. No other manpage ist implemented yet.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 17 Sep 2022 23:19:20 +0200
parents d9f0c8e00019
children 7811505d68d4
files .hgignore Makefile pkg-plist
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sat Sep 17 23:18:02 2022 +0200
+++ b/.hgignore	Sat Sep 17 23:19:20 2022 +0200
@@ -1,3 +1,4 @@
 syntax: regexp
 
 ^work/
+^docs/_build/
\ No newline at end of file
--- a/Makefile	Sat Sep 17 23:18:02 2022 +0200
+++ b/Makefile	Sat Sep 17 23:19:20 2022 +0200
@@ -15,9 +15,16 @@
 RUN_DEPENDS=		pkg:ports-mgmt/pkg
 
 NO_ARCH=	yes
-NO_BUILD=	yes
 WRKSRC=		${WRKDIR}/local-bsdtools
 
+OPTIONS_DEFINE=	DOCS
+OPTIONS_SUB=	yes
+
+DOCS_BUILD_DEPENDS=	sphinx-build:textproc/py-sphinx
+DOCS_VARS_OFF=		NO_BUILD=yes
+
+.include <bsd.port.options.mk>
+
 SRC=		${.CURDIR}
 
 HGCANONICALPATH?=	default
@@ -51,6 +58,15 @@
 	${SED} -i "" -e "s|@@PKGORIGIN@@|${PKGORIGIN}|" ${WRKSRC}/${_ef}
 .endfor
 
+post-extract-DOCS-on:
+	${MKDIR} ${WRKSRC}/docs
+	(${TAR} -C ${.CURDIR}/docs -c --exclude ./_build -f - . | ${TAR} -C ${WRKSRC}/docs -x -f - )
+
+.if ${PORT_OPTIONS:MDOCS}
+do-build:
+	(cd ${WRKSRC}/docs && sphinx-build -M man . _build)
+.endif
+
 do-install:
 .for _rp in sbin/check-ports sbin/fjail sbin/ftjail sbin/fzfs sbin/fpkg sbin/bsmtp2dma
 	${INSTALL_SCRIPT} ${WRKSRC}/${_rp} ${STAGEDIR}${PREFIX}/${_rp}
@@ -64,4 +80,7 @@
 	${INSTALL_SCRIPT} ${WRKSRC}/etc/periodic/daily/${_ps} ${STAGEDIR}${PREFIX}/etc/periodic/daily
 .endfor
 
+post-install-DOCS-on:
+	${INSTALL_DATA} ${WRKSRC}/docs/_build/man/local-bsdtools.1 ${STAGEDIR}${LOCALBASE}/man/man1/local-bsdtools.1
+
 .include <bsd.port.mk>
--- a/pkg-plist	Sat Sep 17 23:18:02 2022 +0200
+++ b/pkg-plist	Sat Sep 17 23:19:20 2022 +0200
@@ -6,6 +6,7 @@
 sbin/ftjail
 sbin/fpkg
 sbin/fzfs
+%%DOCS%%man/man1/local-bsdtools.1.gz
 @sample %%ETCDIR%%/bsmtp2dma.conf.sample
 @sample %%ETCDIR%%/package-mapping.conf.sample
 @sample %%ETCDIR%%/pkgtools.conf.sample