[Surfraw-devel] [PATCH] add autoconf options to install the bash-completions

ng0 ng0 at infotropique.org
Sat Oct 14 11:33:31 UTC 2017


ng0 transcribed 5.1K bytes:
> Hi,
> 
> this patch adds some changes to configur.in + Makefile.am
> to install the bash-completions.
> 
> This addresses a report by downstream Archlinux I have read,
> and I noticed the same in Guix.
> 
> I have tested it on GNU Guix with a file I can send for
> inclusion into a new 'contrib' directory aswell later on.
> It is pretty common to use files like these in projects,
> I do it for GNUnet. gnURL, etc.

In addition to normal test building, I can confirm that installing
from recent source provides at the very least functional 'TAB' completion
of 'surfraw' commands.

I find the @sysconfdir@ in the finished file odd… I didn't spend much time
reading the sources recently, but I think this should be replaced before
final installation.
Unless there is something special about bash-completions I don't know?

> -- 
> ng0
> GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
> GnuPG: https://dist.ng0.infotropique.org/dist/keys/
> https://www.infotropique.org https://ng0.infotropique.org

> From 738ceeb3c513dc6670034f441704071b3d359ef5 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0 at infotropique.org>
> Date: Sat, 14 Oct 2017 10:50:38 +0000
> Subject: [PATCH] Add autoconf parts to enable or disable bash-completions,
>  defaults to 'yes'.
> 
> ---
>  Makefile.am  | 16 +++++++++++++---
>  configure.in |  7 +++++++
>  2 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index e0a3e22..ffd469a 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -5,7 +5,11 @@ if OPENSEARCH
>  dist_bin_SCRIPTS = opensearch-discover opensearch-genquery
>  endif
>  devel_extra	= banner prebuild
> -noinst_DATA	= surfraw-bash-completion surfraw.bookmarks
> +if BASHCOMPLETIONS
> +noinst_DATA	= surfraw.bookmarks
> +else
> +noinst_DATA	= surfraw.bookmarks surfraw-bash-completion
> +endif
>  man_MANS = surfraw-update-path.1 surfraw.1 elvi.1sr
>  if OPENSEARCH
>  man_MANS += opensearch-discover.1 opensearch-genquery.1
> @@ -90,7 +94,7 @@ opensearch-genquery.1: opensearch-genquery
>  	-rm -f $@
>  	pod2man $? > $@
>  
> -install-data-hook: links
> +install-data-hook: links surfraw-bash-completion
>  	chmod -x surfraw.conf elvi.1sr surfraw.1
>  	mkdir -p $(DESTDIR)@sysconfdir@/xdg/surfraw
>  	cp surfraw.conf $(DESTDIR)@sysconfdir@/xdg/surfraw/conf
> @@ -103,6 +107,10 @@ if INSTALLSR
>  	ln -sf surfraw $(DESTDIR)/@bindir@/sr
>  	ln -sf surfraw.1.gz $(DESTDIR)/@mandir@/man1/sr.1.gz
>  endif
> +if BASHCOMPLETIONS
> +	mkdir -p $(DESTDIR)@sysconfdir@/bash_completion.d
> +	@cp $(top_srcdir)/surfraw-bash-completion $(DESTDIR)@sysconfdir@/bash_completion.d/surfraw
> +endif
>  
>  uninstall-local: links
>  	-rm -f $(DESTDIR)@sysconfdir@/xdg/surfraw/conf
> @@ -117,7 +125,9 @@ if INSTALLSR
>  	rm -f $(DESTDIR)/@bindir@/sr
>  	rm -f $(DESTDIR)/@mandir@/man1/sr.1.gz
>  endif
> -
> +if BASHCOMPLETIONS
> +	-rm -f $(DESTDIR)@sysconfdir@/bash_completion.d/surfraw
> +endif
>  
>  submit-lsm: surfraw.lsm
>  	mail -s add LSM at qqx.org < $?
> diff --git a/configure.in b/configure.in
> index 5101510..d457430 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -18,6 +18,13 @@ AC_ARG_ENABLE([opensearch],
>  AC_MSG_RESULT([$enable_opensearch])
>  AM_CONDITIONAL(OPENSEARCH, test "$enable_opensearch" = "yes")
>  
> +AC_MSG_CHECKING([wether to install Bash completions])
> +AC_ARG_ENABLE([bash-completions],
> +        [AS_HELP_STRING([--disable-bash-completions], [disable Bash completions support])],,
> +        [enable_bashcompletions=yes])
> +AC_MSG_RESULT([$enable_bashcompletions])
> +AM_CONDITIONAL(BASHCOMPLETIONS, test "$enable_bashcompletions" = "yes")
> +
>  AC_MSG_CHECKING([whether to install sr alias])
>  AC_ARG_ENABLE([sr],
>  	[AS_HELP_STRING([--disable-sr], [disable sr alias])],,
> -- 
> 2.14.2
> 




> _______________________________________________
> Surfraw-devel mailing list
> Surfraw-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/surfraw-devel


-- 
ng0
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://dist.ng0.infotropique.org/dist/keys/
https://www.infotropique.org https://ng0.infotropique.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/surfraw-devel/attachments/20171014/0937a6e3/attachment.sig>


More information about the Surfraw-devel mailing list