On Mon, Nov 21 2016, Jani Nikula <j...@nikula.org> wrote:

> There is really no need to have a separate install target for the
> desktop file. Just install the desktop file with emacs, with a
> configure option to opt out.

This and the following patch could check with something like

if command -v desktop-file-install >/dev/null && 
   command -v update-desktop-database >/dev/null; then
        WITH_DESKTOP=1
else
        WITH_DESKTOP=0
fi

So that poor n00b users (relatively speaking) installing notmuch-emacs
e.g. on server systems (or on any other system that does not have these
magic commands) don't get install failure.

Alternatively errors of these could be silently ignored, but then
one is left with extra "$(DESTDIR)$(desktop_dir)" directory.

Tomi

> ---
>  configure            | 13 +++++++++++++
>  emacs/Makefile.local |  5 ++---
>  2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index f0fc466eead5..27afc8076c81 100755
> --- a/configure
> +++ b/configure
> @@ -70,6 +70,7 @@ LIBDIR=
>  WITH_DOCS=1
>  WITH_API_DOCS=1
>  WITH_EMACS=1
> +WITH_DESKTOP=1
>  WITH_BASH=1
>  WITH_RUBY=1
>  WITH_ZSH=1
> @@ -141,6 +142,7 @@ Some features can be disabled (--with-feature=no is 
> equivalent to
>       --without-docs                  Do not install documentation
>       --without-api-docs              Do not install API man page
>       --without-emacs                 Do not install lisp file
> +     --without-desktop               Do not install desktop file
>       --without-ruby                  Do not install ruby bindings
>       --without-zsh-completion        Do not install zsh completions files
>       --without-retry-lock            Do not use blocking xapian opens, even 
> if available
> @@ -209,6 +211,14 @@ for option; do
>       fi
>      elif [ "${option}" = '--without-emacs' ] ; then
>       WITH_EMACS=0
> +    elif [ "${option%%=*}" = '--with-desktop' ]; then
> +     if [ "${option#*=}" = 'no' ]; then
> +         WITH_DESKTOP=0
> +     else
> +         WITH_DESKTOP=1
> +     fi
> +    elif [ "${option}" = '--without-desktop' ] ; then
> +     WITH_DESKTOP=0
>      elif [ "${option%%=*}" = '--with-bash-completion' ]; then
>       if [ "${option#*=}" = 'no' ]; then
>           WITH_BASH=0
> @@ -1123,6 +1133,9 @@ VALGRIND_CFLAGS = ${valgrind_cflags}
>  # Support for emacs
>  WITH_EMACS = ${WITH_EMACS}
>  
> +# Support for desktop file
> +WITH_DESKTOP = ${WITH_DESKTOP}
> +
>  # Support for bash completion
>  WITH_BASH = ${WITH_BASH}
>  
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index b47577ac1110..ffa8421ebd45 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -96,10 +96,9 @@ endif
>       install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
>       mkdir -p "$(DESTDIR)$(prefix)/bin/"
>       install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
> -
> -.PHONY: install-desktop
> -install-desktop:
> +ifeq ($(WITH_DESKTOP),1)
>       mkdir -p "$(DESTDIR)$(desktop_dir)"
>       desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" 
> $(emacs_mua_desktop)
> +endif
>  
>  CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el 
> $(dir)/notmuch-pkg.el
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to