git: ce0bafce922e - main - devel/magit: Add PDF option and change DOCS option

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Sun, 20 Feb 2022 23:50:41 UTC
The branch main has been updated by yasu:

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

commit ce0bafce922e4e62c3371ae7de4be696c8a11687
Author:     Yasuhiro Kimura <yasu@FreeBSD.org>
AuthorDate: 2022-02-20 18:31:48 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2022-02-20 23:30:31 +0000

    devel/magit: Add PDF option and change DOCS option
    
    * Add new option PDF. If it is enabled PDF documents are built and
      installed.
    * Change DOCS option so HTML documents and release notes are installed
      if it is enabled.
---
 devel/magit/Makefile  | 38 ++++++++++++++++++++++++++++++--------
 devel/magit/pkg-plist |  2 ++
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/devel/magit/Makefile b/devel/magit/Makefile
index d21ebb15cafa..a5fae919396b 100644
--- a/devel/magit/Makefile
+++ b/devel/magit/Makefile
@@ -3,7 +3,7 @@
 PORTNAME=	magit
 DISTVERSIONPREFIX=	v
 DISTVERSION=	3.3.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel elisp
 PKGNAMESUFFIX=	${EMACS_PKGNAMESUFFIX}
 
@@ -26,29 +26,51 @@ USE_GITHUB=	yes
 MAKE_ENV+=	docdir=${DOCSDIR} \
 		infodir=${PREFIX}/${INFO_PATH} \
 		INSTALL_INFO=install-info \
-		lispdir=${PREFIX}/${_ELISPDIR} \
+		lispdir=${PREFIX}/${ELISPDIR} \
 		LOAD_PATH="-L ${WRKSRC}/lisp -L ${PREFIX}/${EMACS_SITE_LISPDIR} -L ${PREFIX}/${EMACS_VERSION_SITE_LISPDIR} -L ${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}/ghub" \
 		VERSION=${PORTVERSION}
 # Parallel build fails if Emacs is built with native compilation enabled
 MAKE_JOBS_UNSAFE=	yes
+ALL_TARGET=	lisp info
+INSTALL_TARGET=	install-lisp install-info
 
 CONFLICTS_INSTALL=	magit-devel-emacs*
 
 NO_ARCH=	yes
 
 INFO=		magit magit-section
-PLIST_SUB+=	ELISPDIR=${_ELISPDIR}
-PORTDOCS=	AUTHORS.md
+PLIST_SUB+=	ELISPDIR=${ELISPDIR}
+PORTDOCS=	*.html *.md RelNotes/*
 
-OPTIONS_DEFINE=			DOCS LIBEGIT2
-OPTIONS_SUB=			yes
-LIBEGIT2_DESC=			Use libegit2 as backend (EXPERIMENTAL)
+OPTIONS_DEFINE=	DOCS LIBEGIT2 PDF
+OPTIONS_SUB=	yes
+
+LIBEGIT2_DESC=	Use libegit2 as backend (EXPERIMENTAL)
+PDF_DESC=	Build and install PDF document
+
+DOCS_BUILD_DEPENDS=		gsed:textproc/gsed
+DOCS_ALL_TARGET=		html
+DOCS_BINARY_ALIAS=		sed=gsed
 LIBEGIT2_BUILD_DEPENDS=		libegit2${EMACS_PKGNAMESUFFIX}>=g20200515:devel/libegit2@${EMACS_FLAVOR}
 LIBEGIT2_BUILD_DEPENDS_OFF=	git:devel/git
 LIBEGIT2_RUN_DEPENDS=		libegit2${EMACS_PKGNAMESUFFIX}>=g20200515:devel/libegit2@${EMACS_FLAVOR}
 LIBEGIT2_RUN_DEPENDS_OFF=	git:devel/git
 LIBEGIT2_VARS_OFF=		MAKE_ENV+=BUILD_MAGIT_LIBGIT=false
+PDF_BUILD_DEPENDS=		texi2pdf:print/texinfo
+PDF_USE=			TEX=dvipdfmx:build
+PDF_ALL_TARGET=			pdf
+
+ELISPDIR=	${EMACS_VERSION_SITE_LISPDIR}/${PORTNAME}
+
+do-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}/RelNotes
+	${INSTALL_DATA} ${WRKSRC}/Documentation/*.md \
+		${WRKSRC}/Documentation/*.html ${STAGEDIR}${DOCSDIR}
+	${COPYTREE_SHARE} ${WRKSRC}/Documentation/RelNotes \
+		${STAGEDIR}${DOCSDIR}/RelNotes
 
-_ELISPDIR=	${EMACS_VERSION_SITE_LISPDIR}/${PORTNAME}
+do-install-PDF-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/Documentation/*.pdf ${STAGEDIR}${DOCSDIR}
 
 .include <bsd.port.mk>
diff --git a/devel/magit/pkg-plist b/devel/magit/pkg-plist
index 3b8478a113d2..a2a37e279314 100644
--- a/devel/magit/pkg-plist
+++ b/devel/magit/pkg-plist
@@ -96,3 +96,5 @@
 %%ELISPDIR%%/magit-worktree.elc
 %%ELISPDIR%%/magit.el
 %%ELISPDIR%%/magit.elc
+%%PDF%%%%DOCSDIR%%/magit-section.pdf
+%%PDF%%%%DOCSDIR%%/magit.pdf