git: d7308cf12f20 - main - devel/golangci-lint: Simplify shell completion installation

From: Lewis Cook <lcook_at_FreeBSD.org>
Date: Tue, 13 Dec 2022 21:15:41 UTC
The branch main has been updated by lcook:

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

commit d7308cf12f20097644244c8b6e7fd32d743acbc4
Author:     Lewis Cook <lcook@FreeBSD.org>
AuthorDate: 2022-12-13 20:34:32 +0000
Commit:     Lewis Cook <lcook@FreeBSD.org>
CommitDate: 2022-12-13 21:11:44 +0000

    devel/golangci-lint: Simplify shell completion installation
---
 devel/golangci-lint/Makefile  | 27 +++++++++------------------
 devel/golangci-lint/pkg-plist |  4 ----
 2 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/devel/golangci-lint/Makefile b/devel/golangci-lint/Makefile
index d3711fc176d8..906bcd29e77a 100644
--- a/devel/golangci-lint/Makefile
+++ b/devel/golangci-lint/Makefile
@@ -24,32 +24,23 @@ GO_BUILDFLAGS=	-ldflags "\
 		-X main.commit=${_BUILD_COMMIT} \
 		-X main.date=${_BUILD_DATE}"
 
+PLIST_FILES=	bin/${PORTNAME}
 PORTDOCS=	CHANGELOG.md README.md
 PORTEXAMPLES=	.golangci.reference.yml
 
 OPTIONS_DEFINE=		COMPLETIONS DOCS EXAMPLES
 OPTIONS_DEFAULT=	COMPLETIONS
-OPTIONS_SUB=		yes
 
-COMPLETIONS_DESC=	Build and install shell completions
-
-do-build-COMPLETIONS-on:
-.for SHELL in bash fish zsh
-	${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_WRKDIR_BIN}/${PORTNAME} completion \
-		${SHELL} > ${WRKSRC}/${SHELL}
-.endfor
+COMPLETIONS_DESC=		Build and install bash, fish and zsh shell completions
+COMPLETIONS_PLIST_FILES=	share/bash-completion/completions/${PORTNAME} \
+				share/fish/vendor_completions.d/${PORTNAME}.fish \
+				share/zsh/site-functions/_${PORTNAME}
 
 post-install-COMPLETIONS-on:
-	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d \
-		${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d \
-		${STAGEDIR}${PREFIX}/share/zsh/site-functions
-
-	${INSTALL_DATA} ${WRKSRC}/bash \
-		${STAGEDIR}${PREFIX}/etc/bash_completion.d/${PORTNAME}
-	${INSTALL_DATA} ${WRKSRC}/fish \
-		${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/${PORTNAME}.fish
-	${INSTALL_DATA} ${WRKSRC}/zsh \
-		${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
+.for _shell in bash fish zsh
+	${GO_WRKDIR_BIN}/${PORTNAME} completion ${_shell} \
+		>${STAGEDIR}${PREFIX}/${COMPLETIONS_PLIST_FILES:M*${_shell}*}
+.endfor
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff --git a/devel/golangci-lint/pkg-plist b/devel/golangci-lint/pkg-plist
deleted file mode 100644
index 8942fc26095e..000000000000
--- a/devel/golangci-lint/pkg-plist
+++ /dev/null
@@ -1,4 +0,0 @@
-bin/golangci-lint
-%%COMPLETIONS%%etc/bash_completion.d/golangci-lint
-%%COMPLETIONS%%share/fish/vendor_completions.d/golangci-lint.fish
-%%COMPLETIONS%%share/zsh/site-functions/_golangci-lint