zsh-workers
 help / color / mirror / code / Atom feed
* [feature] Provide a pkg-config file
@ 2023-07-14 17:34 Wu Zhenyu
  2023-07-14 18:08 ` Johan Grande
  2023-07-15  1:52 ` Oliver Kiddle
  0 siblings, 2 replies; 4+ messages in thread
From: Wu Zhenyu @ 2023-07-14 17:34 UTC (permalink / raw)
  To: zsh-workers

bash-completion has a pkg-config file, developers who want to provide completions can get the directory by

    pkg-config --variable=completionsdir bash-completion

Can zsh provide one?

    pkg-config --variable=completionsdir zsh

-- 
Best Regards
Wu Zhenyu


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [feature] Provide a pkg-config file
  2023-07-14 17:34 [feature] Provide a pkg-config file Wu Zhenyu
@ 2023-07-14 18:08 ` Johan Grande
  2023-07-15  1:52 ` Oliver Kiddle
  1 sibling, 0 replies; 4+ messages in thread
From: Johan Grande @ 2023-07-14 18:08 UTC (permalink / raw)
  To: zsh-workers

Le 14/07/2023 à 19:34, Wu Zhenyu a écrit :
> bash-completion has a pkg-config file, developers who want to provide completions can get the directory by

I recently had the same problem of determining where to install the 
completion function for my program.

Here's what I did, should this be useful to anyone. I'd be happy to hear 
if there is a better solution.

Note: I believe I read somewhere that /usr/share/zsh/site-functions is 
always in fpath so forcing the user to install it there could be an option.

Note2: For my personal use, this made me add 
~/.local/share/zsh/site-functions to my fpath and I realized that 
another program had just assumed that this was the directory for 
completions and put its there and I was missing out on it.

Makefile
```
...
ZSH_FUNCTIONS_DIR=$(PREFIX)/share/zsh/site-functions

install:
	...
	install -Dm644 "$(SRC_DIR)/_tss.zsh" "$(ZSH_FUNCTIONS_DIR)/_tss"
	# (tss is the name of my program)
	zsh postinstall.zsh "$(ZSH_FUNCTIONS_DIR)"
```

postinstall.zsh
```
...
local functions_dir=$1
if ! ((fpath[(Ie)$functions_dir])); then
	cat <<EOF
###
###  ${(qqq)functions_dir} doesn't seem to be in your
###  fpath, at least in non-interactive mode. You need to add it, which 
###  you can do by running:
###
###      print -r ${(qq):-fpath+=(${(qqq)functions_dir})} 
 >>${(q-)ZDOTDIR:-$HOME}/.zshenv
###
EOF
fi
```

-- 
Johan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [feature] Provide a pkg-config file
  2023-07-14 17:34 [feature] Provide a pkg-config file Wu Zhenyu
  2023-07-14 18:08 ` Johan Grande
@ 2023-07-15  1:52 ` Oliver Kiddle
  2023-07-15 10:28   ` install paths (was: Re: [feature] Provide a pkg-config file) zeurkous
  1 sibling, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2023-07-15  1:52 UTC (permalink / raw)
  To: Wu Zhenyu; +Cc: zsh-workers

Wu Zhenyu wrote:
> bash-completion has a pkg-config file, developers who want to provide completions can get the directory by

Developers who want to provide completions with their software should
install them below the install prefix of their software. So where their
software installs to $PREFIX/bin, $PREFIX/man, $PREFIX/lib etc, they
should drop a completion function in $PREFIX/share/zsh/site-functions

This is consistent with how things operate for other things such as man
pages, GNU info pages and even pkg-config files. The system
administrator needs to ensure that variables such as MANPATH are set
accordingly. It may be the case that this causes completion functions to
be installed in a directory that isn't in zsh's default $fpath but
that's the responsibility of the system administrator to configure.

Software dumping files outside of it's designated installation prefix is
something that should be avoided.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* install paths (was: Re: [feature] Provide a pkg-config file)
  2023-07-15  1:52 ` Oliver Kiddle
@ 2023-07-15 10:28   ` zeurkous
  0 siblings, 0 replies; 4+ messages in thread
From: zeurkous @ 2023-07-15 10:28 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers, Wu Zhenyu

On Sat, 15 Jul 2023 03:52:34 +0200, Oliver Kiddle <opk@zsh.org> wrote:
> It may be the case that this causes completion functions to
> be installed in a directory that isn't in zsh's default $fpath but
> that's the responsibility of the system administrator to configure.

Me's long been in favour of a general PREFICES variable to replace (or,
probably more realistically: amend) the various *PATH vars (and, in this
case: the fpath var).

In fact, on me machines, me even initializes the *PATH variables from
that var (it's also necessary to have a SUFFICES var 'cause of exisiting
{{,s}bin,libexec,...} divergence). Me's only been using site-functions
relatively recently, but me should then initialize the fpath var from
the PREFICES one as well -- thanks for pointing this out.

> Software dumping files outside of it's designated installation prefix is
> something that should be avoided.

Keep in mind though, that there appear to be some general (but not
universal!) exceptions, such as /{etc,var}/.

And then, as a "driving it too far" example, there's the horrible lunix
/opt/...

        --zeurkous.

-- 
Friggin' Machines!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-15 10:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 17:34 [feature] Provide a pkg-config file Wu Zhenyu
2023-07-14 18:08 ` Johan Grande
2023-07-15  1:52 ` Oliver Kiddle
2023-07-15 10:28   ` install paths (was: Re: [feature] Provide a pkg-config file) zeurkous

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).