git: 22952612f3df - main - devel/gum: Add fish completion and port improvements

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Tue, 25 Jul 2023 07:12:35 UTC
The branch main has been updated by eduardo:

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

commit 22952612f3df2a7f1b2dd983b88544365a5e06fc
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2023-07-25 06:59:56 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2023-07-25 07:12:25 +0000

    devel/gum: Add fish completion and port improvements
    
    - gum binary is installed by default, so no need to use INSTALL_PROGRAM
      (or wrongly INSTALL_SCRIPT)
    - add fish completion
    - do generation of man and completions in post-build
    - use correct go variable to execute cmd on post-build
    - install stuff on post-install
    - move man page to a valid location (${PREFIX}/man being considered as
      deprecated.)
    
    PR:             272668
---
 devel/gum/Makefile | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/devel/gum/Makefile b/devel/gum/Makefile
index 24df8c10d37d..a79ec711e177 100644
--- a/devel/gum/Makefile
+++ b/devel/gum/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	gum
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.11.0
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	dave@bitboss.ca
@@ -14,20 +15,27 @@ USES=		go:modules
 GO_MODULE=	github.com/charmbracelet/gum
 
 PLIST_FILES=	bin/gum \
-		etc/bash_completion.d/gum \
-		man/man1/gum.1.gz \
+		etc/bash_completion.d/gum.bash \
+		share/fish/completions/gum.fish \
+		share/man/man1/gum.1.gz \
 		share/zsh/site-functions/_gum
 
 post-build:
-	${MKDIR} ${WRKDIR}/manpages
-	${WRKDIR}/bin/gum man > ${WRKDIR}/manpages/gum.1
+	${GO_WRKDIR_BIN}/${PORTNAME} man > ${WRKSRC}/${PORTNAME}.1
+.for SHELL in bash fish zsh
+	${GO_WRKDIR_BIN}/${PORTNAME} completion ${SHELL} > ${WRKSRC}/${SHELL}
+.endfor
 
-do-install:
-	${INSTALL_SCRIPT} ${WRKDIR}/bin/gum ${STAGEDIR}${PREFIX}/bin/
-	${INSTALL_MAN} ${WRKDIR}/manpages/gum.1 ${STAGEDIR}${PREFIX}/man/man1/
-	${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
-	${WRKDIR}/bin/gum completion bash > ${STAGEDIR}${PREFIX}/etc/bash_completion.d/gum
-	${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
-	${WRKDIR}/bin/gum completion zsh > ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_gum
+post-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
+	${INSTALL_DATA} ${WRKSRC}/bash \
+		${STAGEDIR}${PREFIX}/etc/bash_completion.d/${PORTNAME}.bash
+	@${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/completions
+	${INSTALL_DATA} ${WRKSRC}/fish \
+		${STAGEDIR}${PREFIX}/share/fish/completions/${PORTNAME}.fish
+	@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
+	${INSTALL_DATA} ${WRKSRC}/zsh \
+		${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
+	${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${PREFIX}/share/man/man1
 
 .include <bsd.port.mk>