Re: [PATCH 4/6] contrib/notmuch-mutt: add install target

Subject: Re: [PATCH 4/6] contrib/notmuch-mutt: add install target

Date: Mon, 17 Sep 2018 20:29:06 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sun, Sep 16 2018, David Bremner wrote:

> The main goal here is to be able to install the notmuch-mutt script
> with an absolute shebang. I have tried to make the notmuch-mut

Series looks pretty good to me... mut mut should probably be mutt ;D

Also we probably don't care those who have footguns in form of relative
directories in $PATH ;)

Example:
    ~$ PATH=./bin:$PATH command -v notmuch
    ./bin/notmuch
    ~$

Tomi


> Makefile use configure information from notmuch if available, but make
> suitable guesses if not.
> ---
>  contrib/notmuch-mutt/Makefile | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/contrib/notmuch-mutt/Makefile b/contrib/notmuch-mutt/Makefile
> index 87f9031c..855438be 100644
> --- a/contrib/notmuch-mutt/Makefile
> +++ b/contrib/notmuch-mutt/Makefile
> @@ -1,5 +1,11 @@
>  NAME = notmuch-mutt
>  
> +-include ../../Makefile.config
> +PERL_ABSOLUTE ?= $(shell command -v perl 2>/dev/null)
> +prefix ?= /usr/local
> +sysconfdir ?= ${prefix}/etc
> +mandir ?= ${prefix}/share/man
> +
>  all: $(NAME) $(NAME).1
>  
>  $(NAME).1: $(NAME)
> @@ -8,5 +14,12 @@ $(NAME).1: $(NAME)
>  README.html: README
>  	markdown $< > $@
>  
> +install: all
> +	mkdir -p $(DESTDIR)$(prefix)/bin
> +	sed "1s|^#!.*|#! $(PERL_ABSOLUTE)|" < $(NAME) > $(DESTDIR)$(prefix)/bin/$(NAME)
> +	chmod 755 $(DESTDIR)$(prefix)/bin/$(NAME)
> +	install -D -m 644 $(NAME).1 $(DESTDIR)$(mandir)/man1/$(NAME).1
> +	install -D -m 644 $(NAME).rc $(DESTDIR)$(sysconfdir)/Muttrc.d/$(NAME).rc
> +
>  clean:
>  	rm -f notmuch-mutt.1 README.html
> -- 
> 2.18.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: