git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] diff-highlight: make install link into DESTDIR

From
Jeff King <peff@peff.net>
Date
Oct 12, 2024, 20:55 UTC
Message-ID
<20241012205506.GA55242@coredump.intra.peff.net>
In-Reply-To
<pull.938.v3.git.git.1728764613835.gitgitgadget@gmail.com>
On Sat, Oct 12, 2024 at 08:23:33PM +0000, immeëmosol via GitGitGadget wrote:
Show 11 quoted lines
> diff --git a/contrib/diff-highlight/Makefile b/contrib/diff-highlight/Makefile
> index f2be7cc9243..a53e09e0bdd 100644
> --- a/contrib/diff-highlight/Makefile
> +++ b/contrib/diff-highlight/Makefile
> @@ -10,6 +10,9 @@ diff-highlight: shebang.perl DiffHighlight.pm diff-highlight.perl
>  	chmod +x $@+
>  	mv $@+ $@
>  
> +install: diff-highlight
> +	test -w $(DESTDIR) && ln -s $(abspath $<) $(DESTDIR)
> +

I'm not opposed to having an install target here, like we do in the main Makefile and in a few other contrib directories.

But in that case, I think it should behave more like those other targets:

  1. Actually copy the program rather than making a symlink. Preferably
     using $(INSTALL).
  2. Respect $(prefix) in the usual way.
And also...
>  clean:
> +	test ! -L $(DESTDIR)/diff-highlight || \
> +		$(RM) -f $(DESTDIR)/diff-highlight
>  	$(RM) diff-highlight
  3. It's unusual for "clean" to reach outside of the build directory.
     What you're doing here is more like an "uninstall" target, but we
     don't usually provide one.

There are a few different approaches other contrib/ items take to work like the rest of the Git:

  - in contrib/contacts, we source config.mak from the top-level, and
    then define a default $(prefix). This gives some repeated
    boilerplate, but is pretty independent from the top-level Makefile.
  - in contrib/credential/netrc, we piggy-back on the top-level
    Makefile's "install-perl-script", which knows where the user has
    asked us to install things. That might not be appropriate here,
    though, as I think it only puts things in libexec/, so
    "diff-highlight" wouldn't be generally available in the user's $PATH
    (though it would be enough to use as a pager within git).
-Peff
Previous: immeëmosol via GitGitGadgetNext: immeëmosol
Message 8 of 11 in “diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlight”
  1. diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlightimmeëmosol via GitGitGadget, Oct 12, 2024
  2. Taylor BlauOct 12, 2024
  3. diff-highlight: make install link into DESTDIR #Makefileimmeëmosol via GitGitGadget, Oct 12, 2024
  4. Kristoffer HaugsbakkOct 12, 2024
  5. immeëmosolOct 12, 2024
  6. Junio C HamanoOct 12, 2024
  7. diff-highlight: make install link into DESTDIRimmeëmosol via GitGitGadget, Oct 12, 2024
  8. Jeff KingOct 12, 2024
  9. immeëmosolOct 12, 2024
  10. Đoàn Trần Công DanhOct 14, 2024
  11. Taylor BlauOct 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.