view Makefile @ 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 3c24b07240f2
children 1fc3b04b39fa
line wrap: on
line source

# Created by: Franz Glasner <freebsd-dev@dom66.de>

PORTNAME=	local-bsdtools
DISTVERSION=	0.18.2
CATEGORIES=	sysutils
MASTER_SITES=	# none
DISTFILES=	# none

MAINTAINER=	freebsd-dev@dom66.de
COMMENT=	Collection of private system management tools

LICENSE=	BSD3CLAUSE

EXTRACT_DEPENDS=	hg:devel/mercurial
RUN_DEPENDS=		pkg:ports-mgmt/pkg

NO_ARCH=	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
HGREVISION=	${:!hg id -R "${SRC}" -q!}
HGDATE=		${:!hg log -R "${SRC}" -r "${HGREVISION:S/+//}" --template '{date|isodatesec}'!}
HGAUTHOR=	${:!hg log -R "${SRC}" -r "${HGREVISION:S/+//}" --template '{author|person}' | ${TR} ' ' '+'!}
HGPATH=		${:!hg --config ui.paginate=never path -R "${SRC}" ${HGCANONICALPATH} || echo "file://\$$\(hg root)"!}
HGPHASE=	${:!hg phase!:[2]}

do-extract:
	${MKDIR} ${WRKSRC}/bin
	${MKDIR} ${WRKSRC}/sbin
.for _rp in sbin/check-ports sbin/fjail sbin/ftjail sbin/fzfs sbin/fpkg sbin/bsmtp2dma
	${CP} -v ${SRC}/${_rp} ${WRKSRC}/${_rp}
	${SED} -i "" -E -e "s|\\\$$Date\\\$$|\$$Date: ${HGDATE} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -E -e "s|\\\$$Revision\\\$$|\$$Revision: ${HGREVISION} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -E -e "s|\\\$$Author\\\$$|\$$Author: ${HGAUTHOR} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|\\\$$HGpath\\\$$|\$$HGpath: ${HGPATH} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|\\\$$HGsource\\\$$|\$$HGsource: ${HGPATH}/${_rp} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|\\\$$Header\\\$$|\$$Header: ${_rp} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|\\\$$HGid\\\$$|\$$HGid: ${HGPATH}/${_rp} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@VERSION@@|${PORTVERSION}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@HGREVISION@@|${HGREVISION}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@ETCDIR@@|${ETCDIR}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@PKGORIGIN@@|${PKGORIGIN}|" ${WRKSRC}/${_rp}
.endfor
	${MKDIR} ${WRKSRC}/etc/periodic/daily
.for _ef in etc/package-mapping.conf.sample etc/pkgtools.conf.sample etc/bsmtp2dma.conf.sample etc/periodic/daily/800.local-ipv6-refresh
	${CP} -v ${SRC}/${_ef} ${WRKSRC}/${_ef}
	${SED} -i "" -e "s|\\\$$HGid\\\$$|\$$HGid: ${HGPATH}/${_ef} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/${_ef}
	${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}
.endfor
	${MKDIR} ${STAGEDIR}${ETCDIR}
.for _ef in package-mapping.conf.sample pkgtools.conf.sample bsmtp2dma.conf.sample
	${INSTALL_DATA} ${WRKSRC}/etc/${_ef} ${STAGEDIR}${ETCDIR}/${_ef}
.endfor
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
.for _ps in 800.local-ipv6-refresh
	${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>