diff --git a/Mk/Uses/completions.mk b/Mk/Uses/completions.mk new file mode 100644 --- /dev/null +++ b/Mk/Uses/completions.mk @@ -0,0 +1,39 @@ +# Helper for programmable shell completions. +# +# Feature: completions +# Usage: USES=completions OR USES=completions:ARGS +# Valid ARGS: env +# +# env Exposes the shell completion variables only and does +# not create the shell directories automatically. +# +# Variables for ports: +# +# BASH_COMPDIR Path to the bash completion directory. +# FISH_COMPDIR Path to the fish completion directory. +# ZSH_COMPDIR Path to the zsh completion directory. +# +# MAINTAINER: ports@FreeBSD.org + +.if !defined(_INCLUDE_USES_COMPLETIONS_MK) +_INCLUDE_USES_COMPLETIONS_MK= yes + +_valid_ARGS= env +. for _arg in ${completions_ARGS} +. if !${_valid_ARGS:M${_arg}} +IGNORE= USES=completions: invalid argument: ${_arg} +. endif +. endfor + +BASH_COMPDIR?= ${PREFIX}/etc/bash_completion.d +FISH_COMPDIR?= ${PREFIX}/share/fish/vendor_completions.d +ZSH_COMPDIR?= ${PREFIX}/share/zsh/site-functions + +. if empty(completions_ARGS) +_USES_install+= 501:shell-directories +shell-directories: + @${MKDIR} ${STAGEDIR}${BASH_COMPDIR} \ + ${STAGEDIR}${FISH_COMPDIR} \ + ${STAGEDIR}${ZSH_COMPDIR} +. endif +.endif