From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: immeëmosol <will+developer@willfris.nl>
Cc: git@vger.kernel.org,
"immeëmosol via GitGitGadget" <gitgitgadget@gmail.com>
Subject: Re: [PATCH v3] diff-highlight: make install link into DESTDIR
Date: Mon, 14 Oct 2024 10:29:23 +0700 [thread overview]
Message-ID: <ZwyQE-BMTn3Fj-BO@danh.dev> (raw)
In-Reply-To: <CABOUa4bqPiUM+=6dxW5TTHOdMzXiFD02vWoVJcgAQDhZs8DoXg@mail.gmail.com>
On 2024-10-13 01:41:06+0200, immeëmosol <will+developer@willfris.nl> wrote:
> As mentioned, `contrib/diff-highlight` is less like other perl contribs
> like `contrib/contacts` and `contrib/credential/netrc`, those two seem to
> be git subcommands (`git-*`) where diff-highlight is more of a "standalone"
> command.
>
> My usecase was to peek at what the command does by making it available in a
> `$PATH` writable by a non-root user. (Much like what is mentioned in
> `contrib/diff-highlight/README#Use`: `git log -p --color | diff-highlight`.=
> )
>
> ```sh
> echo '# Given ~/.local/bin is in $PATH,'
> ( export DESTDIR=3D"${HOME?}/.local/bin/" ; make linked-in-destdir )
> echo '# In another already open shell, try suggestion from readme.'
> ( export DESTDIR=3D"${HOME?}/.local/bin/" ; make clean )
> ```
Nah, it isn't DESTDIR's usage, it's prefix job!
make prefix=${HOME}/.local install
> ---
> Make git's diff-highlight program immediately available to the command-line=
> .
> Create a link in DESTDIR that
> refers to the generated/concatenated diff-highlight perl script
>
> Signed-off-by: imme=C3=ABmosol <will+developer@willfris.nl>
> ---
> contrib/diff-highlight/Makefile | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/diff-highlight/Makefile
> b/contrib/diff-highlight/Makefile
> index f2be7cc9243719..84f6e65c730380 100644
> --- a/contrib/diff-highlight/Makefile
> +++ b/contrib/diff-highlight/Makefile
> @@ -10,6 +10,11 @@ diff-highlight: shebang.perl DiffHighlight.pm
> diff-highlight.perl
> chmod +x $@+
> mv $@+ $@
>
> +linked-in-destdir: diff-highlight
> + test -n "$(DESTDIR)" && \
> + test -w $(DESTDIR) && \
> + ln -s $(abspath $<) $(DESTDIR)
So it would be something like this:
install: diff-highlight
$(INSTALL) diff-highlight '$(DESTDIR)$(bindir_SQ)'
> +
> shebang.perl: FORCE
> @echo '#!$(PERL_PATH_SQ)' >$@+
> @cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@
> @@ -17,7 +22,13 @@ shebang.perl: FORCE
> test: all
> $(MAKE) -C t
>
> -clean:
> +unlink-from-destdir:
> + test -z "$(DESTDIR)" || \
> + test ! -L $(DESTDIR)/diff-highlight || \
> + $(RM) $(DESTDIR)/diff-highlight
> +
> +clean: unlink-from-destdir
> $(RM) diff-highlight
>
> .PHONY: FORCE
> +.PHONY: linked-in-destdir unlink-from-destdir
>
--
Danh
next prev parent reply other threads:[~2024-10-14 3:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 15:03 [PATCH] diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlight immeëmosol via GitGitGadget
2024-10-12 15:50 ` Taylor Blau
2024-10-12 17:30 ` [PATCH v2] diff-highlight: make install link into DESTDIR #Makefile immeëmosol via GitGitGadget
2024-10-12 18:35 ` Kristoffer Haugsbakk
2024-10-12 19:10 ` immeëmosol
2024-10-12 19:22 ` Junio C Hamano
2024-10-12 20:23 ` [PATCH v3] diff-highlight: make install link into DESTDIR immeëmosol via GitGitGadget
2024-10-12 20:55 ` Jeff King
2024-10-12 23:41 ` immeëmosol
2024-10-14 3:29 ` Đoàn Trần Công Danh [this message]
2024-10-14 22:17 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZwyQE-BMTn3Fj-BO@danh.dev \
--to=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=will+developer@willfris.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).