Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Improve and amend bash completion feature #1973

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
build: Amend path handling for bash completion
Adjusted the `configure` script for improved quoting and proper handling of
bash completion directory based on `pkg-config` detection.

The recommended directory is completionsdir,
which can be obtained like below [1]:

  $ pkg-config --variable=completionsdir bash-completion

[1] https://github.com/scop/bash-completion#faq

Signed-off-by: Kang Minchul <[email protected]>
kangtegong committed Sep 23, 2024
commit 7a26665fb217be836f477e7eeb58eeff6353beff
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ libdir = $(prefix)/lib/uftrace
etcdir = $(prefix)/etc
mandir = $(prefix)/share/man
docdir = $(srcdir)/doc
completiondir = $(etcdir)/bash_completion.d
completiondir = $(compldir)

ifeq ($(DOCLANG), ko)
docdir = $(srcdir)/doc/ko
12 changes: 12 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -146,6 +146,17 @@ libdir=${libdir:-${prefix}/lib/uftrace}
etcdir=${etcdir:-${prefix}/etc}
mandir=${mandir:-${prefix}/share/man}

if [ -z "$compldir" ]; then
if command -v pkg-config >/dev/null 2>&1 && pkg-config --exists bash-completion; then
compldir=$(pkg-config --variable=completionsdir bash-completion)
if [[ "$compldir" == /usr/share/* ]] && [ "$prefix" != "/usr" ]; then
compldir="${prefix}/share/bash-completion/completions"
fi
else
compldir=${prefix}/share/bash-completion/completions
fi
fi

if [ "$etcdir" = /usr/etc ]; then
etcdir=/etc
fi
@@ -280,6 +291,7 @@ override bindir := $bindir
override libdir := $libdir
override mandir := $mandir
override etcdir := $etcdir
override compldir := $compldir
EOF

if [ ! -z $with_elfutils ]; then