Add a libexec/ directory and use it to find the kak command

Add that libexec directory to the PATH instead of the current kak
binary directory to avoid impacting other commands.

The libexec directory currently only contains a symlink back to
the Kakoune binary.
This commit is contained in:
Maxime Coste 2020-12-09 09:13:45 +11:00
parent ce97c0dd17
commit 74c337df5d
3 changed files with 5 additions and 1 deletions

1
libexec/kak Symbolic link
View File

@ -0,0 +1 @@
../src/kak

View File

@ -55,6 +55,7 @@ PREFIX ?= /usr/local
DESTDIR ?= # root dir DESTDIR ?= # root dir
bindir := $(DESTDIR)$(PREFIX)/bin bindir := $(DESTDIR)$(PREFIX)/bin
libexecdir := $(DESTDIR)$(PREFIX)/libexec/kak
sharedir := $(DESTDIR)$(PREFIX)/share/kak sharedir := $(DESTDIR)$(PREFIX)/share/kak
docdir := $(DESTDIR)$(PREFIX)/share/doc/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak
mandir := $(DESTDIR)$(PREFIX)/share/man/man1 mandir := $(DESTDIR)$(PREFIX)/share/man/man1
@ -162,6 +163,7 @@ distclean: clean
installdirs: installdirs:
install -d $(bindir) \ install -d $(bindir) \
$(libexecdir) \
$(sharedir)/rc \ $(sharedir)/rc \
$(sharedir)/colors \ $(sharedir)/colors \
$(sharedir)/doc \ $(sharedir)/doc \
@ -170,6 +172,7 @@ installdirs:
install: kak man installdirs install: kak man installdirs
install -m 0755 kak $(bindir) install -m 0755 kak $(bindir)
ln -rsf $(bindir)/kak $(libexecdir)/kak
install -m 0644 ../share/kak/kakrc $(sharedir) install -m 0644 ../share/kak/kakrc $(sharedir)
install -m 0644 ../doc/pages/*.asciidoc $(sharedir)/doc install -m 0644 ../doc/pages/*.asciidoc $(sharedir)/doc
cp -r ../rc/* $(sharedir)/rc cp -r ../rc/* $(sharedir)/rc

View File

@ -72,7 +72,7 @@ ShellManager::ShellManager(ConstArrayView<EnvVarDesc> builtin_env_vars)
// have access to the kak command regardless of if the user installed it // have access to the kak command regardless of if the user installed it
{ {
const char* path = getenv("PATH"); const char* path = getenv("PATH");
auto new_path = format("{}:{}", path, split_path(get_kak_binary_path()).first); auto new_path = format("{}../libexec/kak:{}", split_path(get_kak_binary_path()).first, path);
setenv("PATH", new_path.c_str(), 1); setenv("PATH", new_path.c_str(), 1);
} }
} }