diff mbox

[pacman-dev] scripts/completion: derive the bash completion directory from pkg-config

Message ID 20180529040838.8360-1-eschwartz@archlinux.org
State Accepted, archived
Headers show

Commit Message

Eli Schwartz May 29, 2018, 4:08 a.m. UTC
Default to the standard completionsdir, which is lazy-loaded, rather
than hardcoding the compatdir which is not.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 configure.ac        |  3 +++
 scripts/Makefile.am | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

Comments

Allan McRae May 29, 2018, 4:44 a.m. UTC | #1
On 29/05/18 14:08, Eli Schwartz wrote:
> Default to the standard completionsdir, which is lazy-loaded, rather
> than hardcoding the compatdir which is not.
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>

Thanks.  Confirmed working and passes "make distcheck"

A
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index a820b6de..80aa2d3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,6 +215,9 @@  AM_GNU_GETTEXT_VERSION(0.13.1)
 AC_CHECK_LIB([m], [fabs], ,
 	AC_MSG_ERROR([libm is needed to compile pacman!]))
 
+PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
+	bashcompdir="${prefix}/share/bash-completion/completions")
+
 # Check for libarchive
 PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 3.0.0], ,
 	AC_MSG_ERROR([*** libarchive >= 3.0.0 is needed to compile pacman!]))
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index f759e149..f83e16c0 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -246,13 +246,18 @@  $(WRAPPER): \
 	$(AM_V_at)$(LN_S) $@ $(subst -wrapper,,$@)
 
 install-data-local:
-	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
-	$(INSTALL_DATA) completion/bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+	$(MKDIR_P) $(DESTDIR)$(bashcompdir)
+	$(INSTALL_DATA) completion/bash_completion $(DESTDIR)/$(bashcompdir)/pacman
+	for completion in makepkg pacman-key; do \
+	    $(LN_S) pacman $(DESTDIR)/$(bashcompdir)/$$completion; \
+	done
 	$(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
 	$(INSTALL_DATA) completion/zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
 
 uninstall-local:
-	$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+	$(RM) $(DESTDIR)$(bashcompdir)/makepkg
+	$(RM) $(DESTDIR)$(bashcompdir)/pacman
+	$(RM) $(DESTDIR)$(bashcompdir)/pacman-key
 	$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
 
 install-exec-hook: