[tracker/tracker-1.4] build: Fix bash completion dir problem with make install, distcheck



commit 4f1ded48e8c9eb66db16c47ad02c1ffa56acc742
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Jul 31 17:49:37 2015 +0100

    build: Fix bash completion dir problem with make install, distcheck
    
    - Support JHBuild too
    - Allow disabling altogether
    - Fix DISTCHECK flags

 Makefile.am             |    1 +
 autogen.sh              |    2 +-
 configure.ac            |   30 +++++++++++++++++++++---------
 src/tracker/Makefile.am |    4 +++-
 4 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d297672..5d2f089 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,6 +98,7 @@ DISTCLEANFILES +=                                      \
 
 DISTCHECK_CONFIGURE_FLAGS =                            \
        --with-session-bus-services-dir="\$(datadir)"/dbus-1/services \
+       --with-bash-completion-dir=$$dc_install_base/share/bash-completion/completions \
        --disable-nautilus-extension                   \
        --enable-unit-tests                            \
        --enable-functional-tests                      \
diff --git a/autogen.sh b/autogen.sh
index d1aaf36..380e4a0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -29,7 +29,7 @@ if [ $# -eq 0 ] ; then
 
   if test -n "$JHBUILD_PREFIX" ; then
     echo "Using JHBuild prefix ('$JHBUILD_PREFIX')"
-    NEW_PREFIX="--prefix $JHBUILD_PREFIX"
+    NEW_PREFIX="--prefix $JHBUILD_PREFIX 
--with-bash-completion-dir=$JHBUILD_PREFIX/share/bash-completion/completions"
   fi
 
   NEW_ARGS="\
diff --git a/configure.ac b/configure.ac
index b2e3ae8..7007cbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -850,15 +850,25 @@ AM_CONDITIONAL(HAVE_TRACKER_FTS, test "$have_tracker_fts" = "yes")
 ####################################################################
 # bash-completion
 ####################################################################
-AC_ARG_WITH([bashcompletiondir],
-        AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
-        [],
-        [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
-                with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
-        ] , [
-                with_bashcompletiondir=${datadir}/bash-completion/completions
-        ])])
-AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
+
+AC_ARG_WITH([bash-completion-dir],
+    AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
+        [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
+    [],
+    [with_bash_completion_dir=yes])
+
+if test "x$with_bash_completion_dir" = "xyes"; then
+   PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
+       [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)],
+       [BASH_COMPLETION_DIR="${datadir}/bash-completion/completions"])
+elif test "x$with_bash_completion_dir" != "xno"; then
+   # Set with_bash_completions_dir to avoid printing path twice below
+   BASH_COMPLETION_DIR="$with_bash_completion_dir"
+   with_bash_completion_dir="yes"
+fi
+
+AC_SUBST([BASH_COMPLETION_DIR])
+AM_CONDITIONAL([WITH_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
 
 ####################################################################
 # Check for D-Bus requirements
@@ -2783,6 +2793,8 @@ Feature Support:
        Cache media art                         $have_libmediaart (libmediaart)
        Install artwork                         $have_artwork
 
+       Bash completion support:                $with_bash_completion_dir ($BASH_COMPLETION_DIR)
+
 Data Miners / Writebacks:
 
        FS (File System):                       $have_tracker_miner_fs (MeeGo support: $have_meegotouch)
diff --git a/src/tracker/Makefile.am b/src/tracker/Makefile.am
index 27e6e96..3b06fa1 100644
--- a/src/tracker/Makefile.am
+++ b/src/tracker/Makefile.am
@@ -76,8 +76,10 @@ uninstall-hook:
        $(RM) "$(DESTDIR)$(bindir)/tracker-tag"
 
 # Bash completion
-bashcompletiondir = @bashcompletiondir@
+if WITH_BASH_COMPLETION
+bashcompletiondir = $(BASH_COMPLETION_DIR)
 bashcompletion_DATA = bash-completion/tracker
+endif
 
 tracker-compat: tracker-compat.in
        $(AM_V_at)sed -e "s|@bindir[ ]|${bindir}|" $< > $@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]